Files
pipelines/app/notes/C2-message.md
T

9.5 KiB
Raw Blame History

C2 message — one native transcript row

Manager integration follow-up: role labels keep the host's own weight rather than forcing w600. Unknown user parts now also retain a native raw disclosure; they are not silently dropped while assistant unknown parts remain available. The added focused regression checks native label weight and exact unknown user data after opening its disclosure. Full conversation integration remains separate.

The first transcript slice renders one row already produced by transcriptRows (lib/features/chat/domain/chat_transcript.dart). It is a pure widget with no gateway, history, network, composer, shell or chat-screen wiring.

This visit fixed the two blocking review findings and the actionable advisories: Material disclosure bodies are no longer centred, blank known-type parts no longer read as Unrecognised, closed bodies are no longer encoded, and the Cupertino disclosure now reports its expanded state.

Behavior

  • The visible role (User/Assistant) identifies the row and a single User message/Assistant message semantics group carries it. The visible role label is excluded from semantics so a screen reader hears the role once. Role text uses the host's semantic secondary colour, not a hardcoded colour or font family.
  • A user row joins its text parts with the web's newline rule and keeps the exact string in a SelectableText, including leading/trailing spaces. Its optional client label is shown. file parts show the web's attachmentDisplayName fallback (name, else URI basename, else file), also selectable.
  • An agent turn draws every part in its original order. Text parts are selectable; reasoning and tool parts are collapsed native disclosures. A non-text part of an unknown type gets Unrecognised part: <type> (or Unrecognised part) with the full pretty-printed raw JSON behind the disclosure, so no field is silently dropped.
  • Blank known parts draw nothing, as the web's partRendering does: empty text/reasoning, and file parts with neither a name nor a URI. The Unrecognised part fallback is reserved for unknown types (and for a part with no type at all, which keeps its raw JSON).
  • textBuilder is the seam for the forthcoming markdown renderer. It receives each assistant text part; when absent, the default is the untouched SelectableText.
  • Material uses ExpansionTile; Cupertino uses a CupertinoButton with the standard chevron. No custom-painted control, fixed component size, custom font or palette was added.
  • Material disclosures set tilePadding: EdgeInsets.zero and expandedAlignment: AlignmentDirectional.centerStart with a stretched body: the label and a short body both start at the row edge (the tile's default padding indented the label and its body defaulted to centred). Cupertino already started both at the row edge.
  • NativeDisclosure takes a childBuilder and only calls it while open, so a collapsed tool/unknown body never runs JsonEncoder.withIndent.
  • The Cupertino disclosure wraps CupertinoButton in one Semantics node with the label, button action and expanded state; ExcludeSemantics stops the child button from replacing that node. The browser exposes aria-expanded=false → true.

Files

Path Lines Role
lib/features/chat/ui/transcript/chat_message_view.dart 195 Row composition, part rules, attachment name
lib/features/chat/ui/transcript/native_disclosure.dart 79 Native Material/Cupertino disclosure
test/features/chat/ui/transcript/chat_message_view_test.dart 321 Ten row tests
test/features/chat/ui/transcript/native_disclosure_test.dart 64 Two lazy-body tests
tool/chat_message_probe.dart 82 Material/Cupertino dark fixture
tool/chat_message_probe.mjs 386 Reproducible Chrome + OCR probe

Production total is 274 lines. No tracked file, domain file, shell file, pubspec or main.dart changed. git status --short shows only new paths, including this note and the probe driver.

Checks (actual)

  • flutter test test/features/chat/ui/transcript: 12 tests passed (10 view, 2 disclosure).
  • flutter test test/features/chat: 45 tests passed.
  • flutter analyze: no issues.
  • flutter build web for both probe hosts (Material and Cupertino defines): built successfully.
  • node tool/chat_message_probe.mjs for both hosts: real headless Chrome, loopback OS-assigned port, dark appearance, 390x844 at DPR 2. It asserted the role groups, client, all three disclosures, the collapsed bodies' absence before tapping, the expanded reasoning/tool/unknown text after tapping, and each body's leading edge within 2 device px of its label (Material 35/33, 34/32, 34/32; Cupertino 34/32, 33/32, 34/32). Cupertino also reported aria-expanded=false before and true after. Captures were inspected.
  • The review repro review_findings_test.dart now passes F1 and F2 and fails only F4, whose assertion expects the raw boolean true; the semantics data reports Tristate.isTrue, and the candidate's own test asserts Tristate.isFalse → Tristate.isTrue. F3 printed 112 ms before the fix and a warm 44 ms for the 1 MiB collapsed body after it (small 53 ms), i.e. no per-byte cost remains.

Widget-test conditions: the two user-row tests pump a dark MaterialApp and a dark CupertinoApp at 2.0x text on 390x844 and assert no exception. The agent order test uses Material at 2.0x on 390x844. The alignment test runs Material at 1x and 2x on 390x844 (resetting the tree between scales). The remaining tests use the default 800x600 surface at 1x, with the Cupertino disclosure tests in a Cupertino app. The builder-seam test uses a plain light MaterialApp. No test asserts a fixed row width or height.

Browser evidence

Captures under /Users/alan/.local/share/pipelines/data/artifacts/70/public/c2-message/:

  • material-top.png, material-reasoning-expanded.png, material-tool-expanded.png, material-unknown-expanded.png
  • cupertino-top.png, cupertino-reasoning-expanded.png, cupertino-tool-expanded.png, cupertino-unknown-expanded.png
  • material-evidence.json, cupertino-evidence.json

These replace the pre-fix captures: the old Material expanded shots showed the centred JSON body and are no longer current. The six earlier files with the same names are overwritten; the two *-tool-expanded.png files and both evidence files are new.

OCR is imperfect on the small Cupertino paperclip glyph (‘eport.csv); the image shows report.csv, the probe asserts the stable eport.csv suffix, and exact names are covered by the widget test. Flutter web paints SelectableText on the canvas, so browser assertions use OCR for body text and the semantics DOM for controls, as the existing Runs probe does.

Review findings this visit

  • Fixed: Material disclosure body centring (blocking). Regression asserts the body's dx equals the label's at 1x/2x and for the unknown JSON body, plus a browser leading-edge measurement per host.
  • Fixed: blank text/reasoning parts (blocking). The fallback now applies only to unknown types. Regression covers blank text, whitespace text, blank reasoning, a nameless file part, and the still-visible unknown part.
  • Addressed: eager JSON encoding of collapsed bodies (advisory). childBuilder is lazy; two tests count body builds while closed and open.
  • Addressed: Cupertino expanded state (advisory). One semantics node now reports expanded, and a widget test plus the browser aria-expanded check cover it.
  • Addressed: inaccurate notes (advisory) — the test conditions above are the actual ones.
  • Addressed: browser evidence not reproducible (advisory) — the CDP+OCR driver is now tool/chat_message_probe.mjs, matching the existing *_probe.dart + *_probe.mjs pairs.
  • Addressed: duplicate role announcement (advisory) — the visible role label is excluded from semantics; a test asserts the group label and the absence of a second Assistant label.
  • Hardened: a non-list parts value is ignored instead of throwing.
  • Not changed (recorded for integration): the transcript still imports ../sessions/chat_adaptive.dart; promoting the chat-wide helper is an integration decision outside this lane. Expanded tool/unknown bodies remain unbounded single selectables (rich tool cards are later work). Agent file parts still render as attachments (web draws only answer/reasoning/tools). User text remains verbatim rather than web-trimmed (declared acceptance). transcriptRows still emits an assistant row for an all-blank turn, unlike the web's visible-turn rule; the transcript-list wiring must account for that.

Not implemented in this slice

  • Markdown rendering is not implemented. Assistant text is shown verbatim; the textBuilder seam is the handoff for the later renderer.
  • Rich tool cards are not implemented. Tool bodies are raw JSON, collapsed, as agreed for this slice. Large outputs are not bounded yet.
  • The reasoning label is always Reasoning; the web's streaming Thinking… and · N steps wording, elapsed times and tool duration/status cards remain later work.
  • No transcript list, history loading, live frames, composer, approvals, forms, attachments opening/downloading, shell registration or chat screen is included.
  • Mobile was not built, run or installed; only web was exercised. Source uses standard portable widgets.
  • No commit, merge, push or deployment was performed; the new paths are the uncommitted candidate.

Full unified diff: /Users/alan/.local/share/pipelines/data/artifacts/70/public/c2-message/c2-message.diff.