148 lines
9.5 KiB
Markdown
148 lines
9.5 KiB
Markdown
# C5-list — shared chat session actions
|
|
|
|
The landed chat list already had rename/star/close/reopen request shapes. This
|
|
slice makes their outcome handling match the current web client (B1/B10 moved
|
|
rename and star to server-shared state) and adds the list-local hide/read state
|
|
from C13. All changes are under `lib/features/chat/ui/sessions/`, its tests,
|
|
`tool/chat_sessions_probe*`, `notes/` and one `PARITY.md` row. No thread,
|
|
composer, permission, runs, pipelines, graph, application, artifacts, schedules
|
|
or templates file changed.
|
|
|
|
## Behaviour
|
|
|
|
- **Create** is sent by the open dialog. The reply's `chat_session` is required
|
|
(a reply without one is refused with the web's exact sentence
|
|
`The server did not return the new chat session.` instead of opening an
|
|
invented row), the accepted session opens immediately and the list re-reads
|
|
`chat_sessions` in the background. A refusal keeps the dialog, its fields and
|
|
the server's words in place. The operation id is minted once per create intent
|
|
in the screen and passed back unchanged on every retry; `_submitting` plus a
|
|
disabled Creating… action makes a double submit send once.
|
|
Request: `{chat_create:{title,directory,operation_id}}`, plus `backend` only
|
|
when it is not `opencode` and `instructions` only when non-blank — the web's
|
|
exact shape. The pre-existing dialog title field remains (default `New chat`);
|
|
the web's own create pane fixes that title.
|
|
- **Rename** is sent by the open dialog, seeded with the effective current title
|
|
and sending only `{chat_rename:{session_id,title}}` (trimmed). The dialog stays
|
|
open with the server's words on refusal; an accepted reply closes it and the
|
|
rows come from a fresh `chat_sessions` read, never a guessed local update. The
|
|
refusal is shown only in the dialog — it is not duplicated under the row.
|
|
- **Star** sends only `{chat_star, chat_query:{session_id, starred:<flipped
|
|
server value>}}`. **Close** / **Reopen** keep the web's confirmation and send
|
|
`{chat_query:{session_id}}` to `chat_close` / `chat_reopen`. Every accepted
|
|
reply refreshes the rows from the server. A refusal is shown at full width
|
|
beneath its row in the host's error colour, so the whole server sentence
|
|
wraps instead of being clipped by `CupertinoListTile`'s one-line subtitle, and
|
|
a long reason cannot make one Material row taller than the viewport.
|
|
- **Local hide** (`Hide on this device`, after Rename and Close/Reopen in the
|
|
menu) removes the row without a server call and offers Undo in a floating
|
|
one-bar report (`Hidden on this device; the chat stays on the server.`, eight
|
|
seconds), the way the web's fixed report behaves. In Material it sits clear of
|
|
the New-chat FAB; both hosts keep it out of the body column so 2x text cannot
|
|
push the list off screen.
|
|
Hidden ids and the read watermark persist through `shared_preferences` under
|
|
`pipelines.chat.local.v1`. A first sight of a session seeds its baseline, and
|
|
`New` appears only for a strictly newer `updated_at`; opening the row advances
|
|
the watermark monotonically. The local store never gates the server read. A
|
|
closed row never reports `New`, matching `!session.closed` in the web list and
|
|
`!session.closed` in `ChatListPane.kt`.
|
|
- No session or title is invented. The local-only `New` marker reads the server
|
|
row's recency; explicit unseen marks arriving as pushed `chat_event`s and the
|
|
web's `Open` badge are not wired in this list slice.
|
|
|
|
## Files
|
|
|
|
- `lib/features/chat/ui/sessions/chat_session_local.dart` — pure hidden/seen
|
|
model, tolerant decoder and `SharedPreferences` store.
|
|
- `chat_sessions_controller.dart` — per-row action errors, create/rename
|
|
throw-paths, server refresh after acceptance, hide/undo, read watermark.
|
|
- `chat_sessions_screen.dart`, `chat_sessions_body.dart`,
|
|
`session_list_material.dart`, `session_list_cupertino.dart` — full-width row
|
|
refusals beneath the tile, local `New`, hide wiring and the floating Undo bar
|
|
(placed above the Material FAB and outside the body column).
|
|
- `create_chat_dialog.dart` + `chat_create_dialog_frame.dart`,
|
|
`rename_chat_dialog.dart` — in-dialog submit, refusal retention, one-shot guard.
|
|
- `chat_create_fields.dart` — expanded, ellipsised Material dropdowns with
|
|
intrinsic item height so real paths and 2x text fit.
|
|
- `session_actions.dart` — `Hide on this device`.
|
|
- `chat_adaptive.dart` — `ChatRowError` (full-width, host error colour) and the
|
|
native Undo surface.
|
|
- `tool/chat_sessions_probe_entry.dart` — stateful fixture: accepted mutations
|
|
change the next list read; `Refused title` returns the server's rename refusal;
|
|
reopening `Closed fixture` returns a multi-line refusal; `No session title`
|
|
omits `chat_session`; `?unseen=1` reports newer recency so the browser can
|
|
prove `New` (and its absence on the closed row).
|
|
- `tool/chat_sessions_probe.mjs` — real-browser flow for both hosts, including
|
|
hide/Undo at 390 and 320/2x, the `New` marker, both dialogs at 320/2x, and a
|
|
refused reopen whose full reason is captured in both hosts.
|
|
|
|
## Checks (actual)
|
|
|
|
- `flutter test test/features/chat/ui/sessions` — 47 tests pass. New coverage
|
|
this pass: a long row refusal keeps the whole sentence on both hosts at
|
|
320px/2x (`RenderParagraph.didExceedMaxLines == false`, and the message is not
|
|
inside a `CupertinoListTile`/`ListTile`), the Undo bar fits 320px/2x on both
|
|
hosts and Undo still restores the row. Earlier coverage retained: create
|
|
refusal keeps the dialog and retries the same `operation_id`; double submit
|
|
sends one create; a reply without `chat_session` shows exactly
|
|
`The server did not return the new chat session.` (no `Bad state:`); rename is
|
|
seeded and sends only its two fields; a rename refusal stays in the dialog and
|
|
not under the row; star flips one field and refreshes the icon; close refusal
|
|
is visible on the row; hide/Undo touches no server action; `New` follows the
|
|
local watermark and never appears on a closed row; Material and Cupertino
|
|
rename refusals fit 320px at 2x; both create catalogs fit a real directory
|
|
path at 320px/2x, including the Material opened menu.
|
|
- Review probes (outside the repo, not committed):
|
|
`flutter test /Users/alan/.local/share/pipelines/data/artifacts/98/public/review/review_findings_test.dart`
|
|
— 5 passed (closed `New`, exact missing-session wording, Material rename
|
|
overflow, create dialog with a real path, create dialog at 320/2x).
|
|
- `flutter test` — 1006 tests pass.
|
|
- `flutter analyze` — no issues.
|
|
- `flutter build web` — built successfully.
|
|
- Fixture bundles built with
|
|
`flutter build web -t tool/chat_sessions_probe_entry.dart --dart-define=CHAT_PROBE_STYLE={material,cupertino}`
|
|
and driven in real headless Chrome over isolated loopback ports. Each host
|
|
passed list → hide/Undo (390 and 320/2x) → `New` marker → dialogs at 320/2x →
|
|
missing-session wording → create → rename → star → close → rename refusal →
|
|
refused reopen, and captured fourteen PNGs. The probe asserts: the hidden row
|
|
leaves and returns with Undo and the report stays on screen at 320/2x; the open
|
|
row reads `New` while the closed row does not; the missing-session dialog shows
|
|
the exact web sentence and no `Bad state`; the created/renamed titles come back
|
|
from the fixture's `chat_sessions`; the star count increases; the closed row
|
|
offers `Reopen`; the rename refusal keeps the dialog with
|
|
`a title with usable text is required`; and the refused reopen shows the whole
|
|
multi-line server reason under its row on both hosts. Captures are in
|
|
`public/chat-list/`:
|
|
- `material-{list-phone,list-dark-320-2x,hidden-undo,hidden-undo-320-2x,create-320-2x,rename-320-2x,new-marker,create-missing-session,created-list,renamed-list,starred-list,rename-refusal,row-refusal,row-refusal-320-2x}.png`
|
|
- the same fourteen `cupertino-*` files
|
|
|
|
## Limits / not verified
|
|
|
|
- Mobile (Android/iOS builds, devices, installs) is unverified.
|
|
- Browser evidence uses the in-process fixture, not an authenticated live
|
|
server; no real operator chat was created, renamed, starred, closed or hidden.
|
|
- The Cupertino list truncates long *titles* at 320px/2x (standard
|
|
`CupertinoListTile` behaviour, unchanged). Row refusals are no longer in that
|
|
one-line subtitle slot.
|
|
- A star/close/reopen refusal stays under its row until a later accepted action
|
|
on that row; the web shows a dismissible action-failed report instead.
|
|
`PARITY.md` records this as remaining.
|
|
- The Undo report is offered for eight seconds; the web uses six
|
|
(`installChatSnackbar`). Wording and one-slot replacement match.
|
|
- Hiding a row does not close an already-open conversation (the web does); that
|
|
belongs to chat-shell state, outside this list slice.
|
|
- `New` is driven by the list read plus the local watermark. The web's `Open`
|
|
badge and its active/deep-linked read suppression are not in this slice; a
|
|
deep-linked conversation is not marked read until the list reopens it.
|
|
- The Material FAB can still overlap the last row's action button at 320px/2x.
|
|
That is pre-existing list layout; the browser flow filters the refused row into
|
|
view for its 320/2x capture rather than changing the list.
|
|
- The 320/2x browser dialog captures show the fixture's default
|
|
`/workspace/demo`; selecting the real long path at that size is covered by the
|
|
widget test, not by a rendered capture.
|
|
- In the real browser, the Cupertino Undo coordinate tap is swallowed by Flutter
|
|
web's semantics DOM node; the probe activates the same rendered button through
|
|
its semantics click. Material accepts the coordinate tap. Widget tests tap the
|
|
native control directly.
|
|
- The candidate is uncommitted; no merge, push or deploy was performed.
|