Merge branch 'main' into flutter/chat-markdown

This commit is contained in:
2026-10-21 23:34:35 +01:00
91 changed files with 12318 additions and 149 deletions
+87
View File
@@ -0,0 +1,87 @@
# A1-viewer — native in-app artifact viewer
## What changed
The recorded-artifact gallery now opens a reusable native viewer for a viewer
artifact with a resolved url. Images are drawn in-app from fetched bytes,
`text/plain` is selectable fetched text, `.md`/`.markdown` or `text/markdown`
uses an injected markdown builder (default: plain selectable text), and every
other type shows an explicit cannot-preview state with the existing Open/Copy
link actions. An external origin is opened in the viewer as a marked,
unfetched page; unsafe and absent urls stay in the facts dialog.
| File | Responsibility |
| --- | --- |
| `lib/features/artifacts/domain/artifact_preview.dart` | Safe-url preview classification and exact unavailable/unsupported wording |
| `lib/features/artifacts/ui/artifact_viewer_page.dart` | Page, paging state, fetch generations, cache, Open/Copy |
| `lib/features/artifacts/ui/artifact_viewer_body.dart` | Facts, position, live status, preview surface, actions, Previous/Next |
| `lib/features/artifacts/ui/artifact_viewer_content.dart` | Image/text/markdown/loading/error/unsupported surface and markdown seam |
| `lib/features/artifacts/ui/artifact_viewer_fetch.dart` | `ArtifactFetch` seam, status/bytes result, network failure |
| `lib/features/artifacts/ui/artifact_viewer_fetch_web.dart` | Web `fetch` with `credentials: 'same-origin'` |
| `lib/features/artifacts/ui/artifact_viewer_fetch_stub.dart` | Native `HttpClient`, no cookies, no redirects |
| `lib/features/artifacts/ui/artifact_gallery_page.dart` | Opens the viewer for previewable same-origin rows; optional fetch/builder seams |
| `lib/features/artifacts/domain/artifact_kind.dart` | `text/plain` joins the viewer list; video stays pageable but unpresentable |
| `lib/features/artifacts/domain/gallery_navigation.dart` | One visit identity helper shared by rows and viewer |
| `tool/artifact_gallery_probe.dart` / `.mjs` | Gallery + viewer fixture, both hosts, 320/2x, real PNG, 404 and external states |
| `test/features/artifacts/domain/artifact_preview_test.dart` | Same-origin, external, unsafe, absent and unsupported plans |
| `test/features/artifacts/ui/artifact_viewer_page_test.dart` | Image no-tab, text content, markdown seam, external refusal, unsupported, paging/clamp, loading/404/network, Cupertino |
## Behaviour
- The gallery row identity is the recorded stage/visit plus recorded url (or
name), so paging starts on exactly the selected row.
- Preview pages are `pagedArtifacts(groups)` in gallery order. Previous/Next use
`pagedIndex` and are disabled at both ends; a one-page viewer has no pager.
- The viewer keeps the recorded MIME/size and `stage · visit N` facts visible on
every page, along with the position label (`3 of 4 · image/png`).
- Open/Copy link are the existing external actions and operate on the resolved
url. They are not previews.
- Fetch failures report `The server answered <status>.`; network failures report
`Could not load preview: …`; loading says `Loading preview…`. An image that
cannot decode says so.
- Native `Back`/AppBar/CupertinoNavigationBar close returns to the gallery row
list and restores the row focus captured before the push.
## Checks actually run
```
flutter analyze # No issues found! (1.2s)
flutter test test/features/artifacts \
test/features/runs/ui/run_artifacts_action_test.dart # 104 passed
flutter build web # ✓ Built build/web
flutter build web -t tool/artifact_gallery_probe.dart # ✓ Built build/probe-gallery
node tool/artifact_gallery_probe.mjs --root build/probe-gallery --out … # 21 checks, 23 captures
```
Browser captures: shared
`artifact-viewer-captures/` (material/cupertino image, text, unsupported,
HTTP 404, external marked page, 320/2x both hosts, plus the retained gallery
states). The viewer text assertion for fetched content relies on the rendered
capture; Flutter web did not expose `SelectableText` content in the extracted
DOM text. The widget test asserts the fetched value directly.
## Honest limits
- No HTML embed, video player, download or file-share action was added.
- Only web was built and captured. Android/iOS were not built, installed or
device-tested.
- The default markdown seam is plain selectable text; the markdown lane can
inject a real renderer through `ArtifactMarkdownBuilder`.
- The fixture and browser evidence use loopback files only; no server, real run
or operator session was touched.
## Manager completion after a harness transport deadline
The Code visit ended with `HARNESS TRANSPORT: context deadline exceeded`; the
session was no longer active and every edit was retained. No retry was started.
The manager ran the full artifacts suite (99 tests pass) and analysis, rebuilt the
gallery/viewer fixture, and ran the probe: it passes and writes the viewer states
(text, image, unsupported, external-origin marked, HTTP error, plus 320/2x and
Cupertino variants). The Material text viewer and the Cupertino 320/2x image
viewer were inspected: recorded facts, page position, in-app image, paging at both
ends and Open/Copy link.
Deliberate limits: markdown is rendered through an injected builder that defaults
to selectable plain text (the markdown lane supplies the real renderer later),
external-origin urls are never fetched, and video/CSV/archives are explicitly
unsupported rather than faked. Share/download/file-upload remain open items.
+150
View File
@@ -0,0 +1,150 @@
# A1-wire — native Artifacts action and recorded-group gallery
## What changed
The run detail now offers a standard native **Artifacts** action whenever the
loaded detail carries steps. It pushes a native page that lists the recorded
stage/visit groups from the landed `artifactGroups`/`ArtifactVisitList`.
Selecting a row opens the host's native dialog with the recorded name, MIME and
size, the visit's own capture facts, and — only when the recorded url resolves
through the existing `resolveArtifactUrl` rules — native **Open** and a separate
**Copy link**.
| File | Lines | Responsibility |
| --- | --- | --- |
| `lib/features/artifacts/ui/artifact_gallery_action.dart` | 104 | Action gate, steps snapshot, native button, page push |
| `lib/features/artifacts/ui/artifact_gallery_page.dart` | 194 | The page: summary/empty state, list, selection, Open/Copy link |
| `lib/features/artifacts/ui/artifact_selection_facts.dart` | 71 | Group→step map and the recorded-facts widget |
| `lib/features/artifacts/ui/artifact_external_open.dart` | 14 | `ArtifactExternalOpen` capability + default |
| `lib/features/artifacts/ui/artifact_external_open_web.dart` | 20 | `window.open` through `js_interop` (JS and wasm) |
| `lib/features/artifacts/ui/artifact_external_open_stub.dart` | 6 | Non-web refusal (no launcher dependency in this slice) |
| `lib/features/artifacts/ui/artifact_visit_list.dart` | +28/-25 | Exposes the landed label helpers the page reuses |
| `lib/features/runs/ui/run_detail_actions.dart` | +3 | Composes the action beside Rename/Cancel |
| `test/features/artifacts/ui/artifact_gallery_page_test.dart` | 321 | Page, identity, capture facts, url rules, copy |
| `test/features/runs/ui/run_artifacts_action_test.dart` | 161 | Action gate and wiring on both hosts |
| `tool/artifact_gallery_probe.dart` | 232 | Isolated fixture entry (real `RunDetailView`) |
| `tool/artifact_gallery_probe.mjs` | 421 | Loopback server + headless Chrome driver |
No shell/main, pubspec, `web/`, Go server, `android/` or other feature was
edited. No dependency was added.
## Behaviour
- **Gate.** `showRunArtifactsAction` is true exactly when the loaded detail has
at least one step. A detail with no steps shows no action; the page also has
an explicit `No steps recorded for this run.` state if ever reached.
- **Truthful empty/unavailable.** The page header is the landed
`artifactsHeader`: `Artifacts · N recorded` (`· partial capture` when a visit
excluded/omitted files), `Artifacts · capture pending` while executing,
`No artifacts recorded for this run.` only for a recorded empty capture, and
`Artifacts · capture unavailable` when the field was absent. An unavailable
capture never says nothing was recorded.
- **Selection identity.** `ArtifactVisitList` selection uses
`artifactVisitIdentity`; two visits that both recorded `result.csv` stay two
distinct rows and selections (unit + browser evidence).
- **Facts.** The dialog shows the recorded filename (or `(unnamed artifact)`),
the recorded MIME/size (`type not recorded` when empty), the group's
`stage · visit N`, the visit's `artifactsSummary` and its
`artifactCaptureNotes`. Nothing is inferred from a name.
- **Url rules.** Open/Copy link appear only when `resolveArtifactUrl` returns a
value: absolute http(s) or a server-relative path resolved against the
configured endpoint. Protocol-relative, credentialed, malformed and
non-http(s) urls are rejected and the dialog says
`The recorded artifact URL cannot be opened safely.` A record with no url says
`No artifact URL recorded.` and offers no action. The endpoint comes from the
app's shared `PipelinesClient` when the gateway exposes it; a fixture gateway
leaves it blank, which only disables relative resolution.
- **Open vs copy.** Open calls the injected `ArtifactExternalOpen` with the
resolved `Uri` (web: a new tab via `window.open` reached through
`js_interop`, so it compiles for JS and wasm). Copy link is a separate action
that writes the resolved url to the clipboard. Each reports
`Link opened externally.` / `Could not open the link.` and `Link copied.` /
`Could not copy link.` as an inline live region.
- **Controls.** Material uses `FilledButton.tonalIcon` + `AlertDialog`; Cupertino
uses `CupertinoButton.tinted` + `CupertinoAlertDialog` and the grouped page
background. No fixed row/button sizes, custom font or palette. The Cupertino
action is text-only: the icon variant overflowed by 11 px at 2x text on 390 px
(caught by the existing `run_detail_widget_test`), and dropping the icon keeps
the label whole without clipping.
- **Out of scope, labelled next:** in-app preview/viewer, download, share files,
gallery filters and any network artifact fetch were not written.
## Checks actually run
```
flutter analyze # No issues found
dart format --output=none --set-exit-if-changed ... # 0 changed
flutter test test/features/artifacts test/features/runs # 203 passed
flutter test # 712 passed (whole app)
flutter build web # ✓ Built build/web
flutter build web -t tool/artifact_gallery_probe.dart # ✓ Built build/probe-gallery
node --check tool/artifact_gallery_probe.mjs # ok
node tool/artifact_gallery_probe.mjs ... # 13/13 checks, 16 captures
```
`git status --short --untracked-files=all` lists only the files above;
`pubspec.yaml`/`pubspec.lock` are unchanged. No commit, push or deploy.
## Real browser evidence
`tool/artifact_gallery_probe.dart` renders the real `RunDetailView` over a fake
`get_run` gateway; `tool/artifact_gallery_probe.mjs` serves the build on an
OS-assigned loopback port and drives headless Chrome. Recorded urls point at the
probe's own loopback origin (plus unsafe/no-url/empty/unavailable states). No
server or operator run was touched.
13/13 checks passed; 16 captures in
`/Users/alan/.local/share/pipelines/data/artifacts/81/public/a1-wire/`
(`evidence.json` holds the machine-readable result):
- The run detail offers the native Artifacts action; the page lists the actual
recorded rows (`build.log`, `shot.png`, two `result.csv` visits, group
headings, MIME/size), not nav labels.
- Selecting the lower duplicate `result.csv` selected `reviewer · visit 2` with
its own `Artifacts · 1 recorded · partial capture` and
`2 files excluded from artifact capture.`
- The safe selection offers native **Open** and a separate **Copy link**; a
protocol-relative url offers neither and shows the unsafe wording; a url-less
record shows `No artifact URL recorded.` and no action.
- A recorded empty capture says `No artifacts recorded for this run.`; an
unavailable capture says `Artifacts · capture unavailable` and never the empty
wording.
- Cupertino lists the same rows with its native dialog and actions; dark
Cupertino dialog text samples light (max luminance 1.0).
- Both hosts at 320 px / 2x text keep the recorded rows, facts and actions
whole.
Captures: `a1w-material-{detail,gallery,selected,open,unsafe,nourl,empty,
unavailable}.png`, `a1w-cupertino-{gallery,selected,dark-gallery,
dark-selected}.png`, `a1w-{material,cupertino}-2x-320-{gallery,selected}.png`.
## Not verified / limits
- The actual new-tab open could not be driven in headless Chrome: a synthetic
semantics activation carries no user gesture, so the app reports its honest
`Could not open the link.` refusal path. The browser proves the action is
offered only for a safe resolved url; the widget test proves the exact
`http://127.0.0.1:8081/artifacts/1/1/result.csv` uri handed to the opener and
the clipboard write. A genuine user tap was not captured.
- Non-web external open returns false (no launcher dependency is in scope); the
page reports that refusal. Mobile targets were not built or run, so **mobile
remains unverified**.
- All data is fixture data; no live server or operator run was used.
- Page/viewer/share/download/filters are not part of this slice and are labelled
as next work.
## Manager completion after the Code deadline
The Code visit hit its 30-minute deadline while still active; its session settled
and all edits were retained. No retry was started. The manager confirmed the dirty
paths were exactly this slice, then ran the focused artifacts/UI tests (29 pass),
analysis, and the fixture probe. The probe covers both hosts plus 320px/2x and
produced 16 captures (detail, gallery, selected facts, Open, unsafe url, no url,
empty, unavailable capture). The Cupertino dark selected dialog and the Material
320px/2x selected dialog were inspected: recorded name/MIME/size, the visit's own
capture facts, excluded-file note, and distinct Open / Copy link / Close where a
safe url exists.
Deliberate scope: this slice links to a validated url externally and copies that
link. It performs no in-app preview, download or file sharing, so the artifact
viewer/Share rows in app/PARITY.md remain open.
+139
View File
@@ -0,0 +1,139 @@
# C2-wire — Chat session list to read-only conversation
The Chat tab is now the real session browser plus a selected read-only thread.
The shell registers a normal Chat destination, `/chat/:id` is a real history
entry, and the existing `ChatThreadController`/`ChatMessageView` render the
stored transcript. No composer, markdown, forms, metrics, attachments, new
socket, server or platform change is included.
## Behavior
- The destination renders the list at `/chat`; tapping a row records
`/chat/<session-id>`, and Back (the in-page control, browser Back, or system
back through `AppRouterDelegate.popRoute`) returns to `/chat`. The list stays
mounted offstage, so its rows, grouping, search text and actions survive the
round trip.
- `/chat/:id` opens the exact session. Parsing is total and matches the web
parser: a nonempty, bounded, URL-safe id is accepted after percent-decoding;
malformed escapes, extra segments and invalid ids resolve to the default
Pipelines route rather than throwing. The route serialises through
`Uri.encodeComponent`.
- Before the shared socket has ever connected, the destination shows the normal
connection screen and sends no chat request. It never opens its own socket or
subscribes outside the shared `AppSession`.
- The selected thread subscribes that one session, reads the newest history
page (`limit: 200`, empty cursor), renders `transcriptRows` with
`ChatMessageView`, and folds pushed `chat_event` frames for that session only.
Live text/reasoning/tool parts use the landed native surfaces; reasoning and
tools stay collapsed until opened.
- `Load older` is shown only while the server says `has_more`; the server's
`next_cursor` is passed back verbatim and is never parsed. Paging prepends
messages, and a page boundary can fall inside one folded assistant turn (the
repository's paged history fixture pages consecutive assistant messages). A
turn's first message id is therefore not widget identity: `ChatRowKeys`
carries each turn's key forward while it still holds a message it had before,
and each agent part carries its server id. An open reasoning/tool disclosure
stays on the answer the operator opened, whether the older page extends a turn
at its head or the `Load older` control disappears. A part without a server id
still falls back to its position; server history parts carry ids.
- `ChatThreadController.subscriptionError` and history `error` render as two
separate notices with separate Retry actions. Readable stored history can
therefore never hide a refused live watch. Initial loading, a running turn
and an honest empty transcript each have their own state.
- On reconnect, `connectionEpoch` advances the thread's `syncToken`; the
mounted view re-subscribes and replaces the transcript in place, keeping the
selected session id and route. A session change mounts a keyed view, so a
superseded read from the previous session cannot land in the new thread. The
offstage session list also re-reads on the same token, so a session created,
renamed or closed on another device during the socket gap appears without
pressing Refresh.
- The shell owns the only navigation bar. `ChatSessionsScreen` gained a small
`embedded` flag: under the shell it renders a compact action row for New chat
and Refresh instead of a second `AppBar`/`CupertinoNavigationBar`. Standalone
use keeps its previous native scaffolding.
- Deep links only carry the session id, so a directly opened thread may show no
title until it is opened from a list row. The transcript itself is complete
and honest; this is not treated as chat parity.
## Files
| Path | Lines | Role |
| --- | ---: | --- |
| `lib/features/chat/screen.dart` | 99 | List/thread switch, selection, in-page Back, reconnect token |
| `lib/features/chat/conversation/chat_thread_view.dart` | 195 | Keyed read-only transcript, paging, live/history notices |
| `lib/features/chat/conversation/chat_row_keys.dart` | 63 | Stable row identity while a folded turn grows at either end |
| `lib/features/chat/domain/chat_transcript.dart` | 246 | History merge, turn folding, live frame fold |
| `lib/features/chat/ui/transcript/chat_message_view.dart` | 218 | Agent parts keyed by part identity (disclosure state) |
| `lib/application/chat_destination.dart` | 69 | Connection gate/banner and shared session wiring |
| `lib/features/chat/ui/sessions/chat_sessions_screen.dart` | 191 | Embedded layout flag, actions, reconnect re-read |
| `lib/application/app_route.dart` | +30/−4 | `/chat/:id` parse, serialise, equality |
| `lib/application/app_router.dart` | +13/−3 | System Back callback for a chat session |
| `lib/application/pipelines_app.dart` | +9 | Destination registration and `/chat` route mapping |
Focused tests: `test/application/chat_registration_test.dart`,
`test/application/chat_destination_test.dart`, `test/application/app_router_test.dart`,
`test/application/app_route_test.dart`,
`test/features/chat/conversation/chat_thread_view_test.dart`,
`test/features/chat/conversation/chat_row_keys_test.dart`.
The thread tests cover both paging variants (the older page keeps `has_more`, and
the older page ends history) in Material and Cupertino, for alternating pages and
for the assistant-only fixture shape. In every case the newest `Reasoning` stays
open and the older blocks stay collapsed. `chat_row_keys_test.dart` covers a
prepended assistant page, an appended live assistant message and distinct turns.
Probe: `tool/chat_wire_probe.dart` and `tool/chat_wire_probe.mjs` include both
alternating variants plus two assistant-fold sessions (`has_more` kept and ended).
## Checks (actual)
- `flutter test test/features/chat test/application` — **110 tests passed**.
- `flutter test` (full suite) — **696 tests passed**.
- `flutter analyze` — **No issues found**.
- `dart format --output=none --set-exit-if-changed` on the changed Dart files —
exit 0.
- `flutter build web` — built successfully.
- `flutter build web -t tool/chat_wire_probe.dart` for the Material and Cupertino
dark fixtures — both built successfully.
- `node tool/chat_wire_probe.mjs` against real headless Chrome for both hosts —
exit 0. Each run checked, with the semantics tree and OCR of the rendered
canvas:
- embedded list shows server rows and keeps New chat/Refresh;
- the thread shows the exact stored user body, assistant body, `Reasoning` and
`shell` disclosures while collapsed bodies stay hidden;
- `Load older` renders the opaque-cursor page;
- a pushed `chat_event` delta appends to the open thread;
- after expanding the newest `Reasoning`, paging with `has_more` still true and
paging that removes `Load older` both keep the newest body open and the older
body collapsed (`newestKept: true`, `olderLeaked: false` in both hosts);
- the assistant-fold sessions repeat that check with pages of consecutive
assistant messages, for both `has_more` outcomes.
- Captures and evidence JSON: `/Users/alan/.local/share/pipelines/data/artifacts/79/public/chat-fold-paging/`
(`{material,cupertino}-{list,thread,expanded,older,live,more-expanded,more-older,fold-expanded,fold-older,fold-end-expanded,fold-end-older}.png`
and `*-evidence.json`). These come from the standalone `ChatScreen` fixture.
- Normal-app rendered check: `/Users/alan/.local/share/pipelines/data/artifacts/79/public/chat-fold-app/`
has `{material,cupertino}-{fold,fold-end}-{collapsed,expanded,older}.png` and
`fold-app-evidence.json`, driven through the real `build/web` composition and
the real router at `/chat/<session>`. Material is a Linux UA in light mode,
Cupertino the macOS host in dark mode. Both hosts and both `has_more` outcomes
report `newestKept: true`, `olderLeaked: false`, and the expected `Load older`
presence; no page exceptions.
Not done: composer, markdown rendering, attachments, forms, permissions, model
selection, metrics, shells, and the initial newest-message placement / live
follow scroll behaviour remain the tracked next chat items. The transcript is
still an eager, keyed `ListView` so an open disclosure also survives while its
row is offscreen; moving to a lazy builder would need that expansion state to
live above the rows. Mobile builds/devices were not used or verified. Nothing
was committed, pushed, merged or deployed.
## Manager completion after the Code deadline
The final Code visit reached its 30-minute deadline while active; the session then
settled and all edits were retained. No retry was started. The manager ran the
focused application/chat suites (110 tests pass) and drove the fixture probes for
both hosts. Material and Cupertino each passed and wrote captures; the Cupertino
live capture was inspected and shows the read-only conversation with the exact
user text, the stored assistant reply, collapsed Reasoning/tool disclosures, the
live delta and the responding line, all under the shell's single bar.
Scope stays read-only: no composer, markdown rendering, forms, approvals, metrics
or attachments are claimed by this item.
+103
View File
@@ -0,0 +1,103 @@
# P2 stage: read-only definition pane
The definition graph can now open one stage's authored definition without
reading a run. `StageDefinitionView` receives the graph JsonMap pinned for a
pipeline/version, a stage key and that identity; it performs no request and
shows no visit, status or session data. `openStageDefinition` pushes the
platform's normal page with one navigation bar and its standard back control,
for the manager's graph hook.
## Behaviour
- Fields match `stageDefinitionFields`/`terminalFields` in `web/src/graph.js`:
Type, Prompt, Output, Outcomes (ordered, targets resolved, terminals marked),
configs in sorted order with the web labels, Tools, Max visits, Limit on,
Memory, Notify on/destination/artifacts. Only non-blank fields are emitted.
- `effectiveStageType` keeps the web rule that a blank/absent type reads
`model`; no other default is invented.
- A terminal (`#success`/`#failure`) lists its incoming definition routes and
says explicitly that these are definition targets, not recorded visits. Its
page is titled with the web's display label (`Failure definition` /
`Success definition`, via `nodeDisplayLabel`), never the raw `#failure` key.
- A stage key this version does not declare gets an explicit missing state. No
fields, terminal note or raw JSON are fabricated.
- Every declared stage also shows its exact pretty-printed stage JSON in a
selectable raw section, so unknown/future fields stay available. The raw
value is the only source for those keys; the structured rows only interpret
documented ones.
- Host text roles only: Material `Theme`/`ColorScheme`, Cupertino
`CupertinoTheme`/`CupertinoColors`, system fonts, light/dark and text scale
follow the host. No palette, font family, fixed component size or custom
control clone.
- Selectable body blocks force a strut derived from that same host style.
Without it, a glyph the host font lacks (the outcomes arrow `→`) pulls in a
fallback font with taller metrics and doubles only that block's leading. The
strut is the host's own family/size, not a font override or fixed height, and
selection stays native.
## UI review fixes
- Cupertino `Outcomes` leading: the block's rendered line pitch matched a
fallback font (34 px between outcome lines against 19 px for `Tools` at 1×,
68 px against 30 px at 2×). With the forced host strut the line pitch is
19 px for both blocks at 1× and 37/39 px at 2×, and the semantics block
heights are equal (72/72 at 1×, 123/123 at 2×). The 390×844 / 2× wrap of
`(terminal)` now sits on the same rhythm as the line above it.
- Terminal titles: `#failure definition`/`#success definition` became
`Failure definition`/`Success definition`. The Cupertino widget test now
asserts `Success definition` and the absence of the raw key; a Material
test covers `Failure definition`; the browser probe fails if `#failure`
reappears in the terminal page or if the outcomes/Tools block heights
diverge.
## Integration dependency
`PipelineDetail` still has no `graph` field, so the manager's graph hook must
supply the pinned JsonMap it already draws. This item deliberately does not
change the pipeline repository/model. There is no run-mode latest-visit pane
here; recorded visits remain the separate run-graph/audit work.
## Checks run
- `flutter test test/features/graph` - 140 tests passed (138 before; two new
regression tests for the terminal title and the forced host strut).
- `flutter analyze` - no issues.
- `dart format --set-exit-if-changed` on the five Dart files - 0 changed.
- `flutter build web` (normal app) - succeeded.
- `flutter build web -t tool/stage_definition_probe.dart` - succeeded.
- `node --check tool/stage_definition_probe.mjs`.
- Real Chrome probe, 1280x900: material dark/light 1x, Cupertino dark/light 1x
and Cupertino dark/light 2x. Each case passed 9 checks and produced 5
captures. The probe now compares the `Outcomes` and `Tools` semantics block
heights (equal in every case), fails on any raw `#failure` in the terminal
page, asserts `Failure definition`, and scrolls to the pane bottom so the
raw capture really shows `future_field.kept` and `fallback_error`.
- Real Chrome probe, 390x844: Cupertino dark 2x and Material light 1x. Each
passed 8 checks and produced 5 captures, including the `(terminal)` wrap and
the raw JSON at the narrow width. The accent-free rhythm check is skipped at
this width because the outcomes value wraps to three lines.
- Pixel measurement of the final captures: Cupertino 1x outcomes 19 px vs
Tools 19 px (was 34 vs 19); Cupertino 2x outcomes 37 px vs Tools 39 px (was
68 vs 30); Material 1x outcomes 19 px vs Tools 20 px.
Captures (under the run's shared artifact folder
`public/stage-definition/`): `<host>-<scheme>-<scale>x-{declared,raw,terminal,unknown,closed}.png`
for the six 1280x900 cases, and the same names prefixed with `stage-definition-`
under `narrow-390x844/` for the two 390x844 cases. The raw capture is the real
bottom-scrolled state and its sha1 differs from the declared capture in every
case.
Mobile (Android/iOS) remains unverified; only web was run.
## Manager completion after result-validation failure
Run 77's final Review visit returned no parseable outcome, so the runner retained
its edits and failed the stage without undoing them. No retry was started. The
manager verified the dirty files were the reviewed slice only, ran the focused
domain/view tests (10 pass), and drove the real-browser probe on both hosts:
Material light 1x desktop and Cupertino dark 2x 390x844. Each run passed and
produced five captures (declared, raw, terminal, unknown, closed) under approved
temp/stage-def-browser. The Cupertino dark 2x declared pane was inspected: pinned
identity, wrapping outcome line, native type roles, readable secondary labels.
This remains a definition pane only; run visits and the pipeline graph hook are
separate work.
+158
View File
@@ -0,0 +1,158 @@
# R2c-wire — Retry/restart in the real run detail
## Result
The already-landed `RetryRunAction` now renders in the real run detail action
row under both native hosts, beside Rename and Cancel/decision wiring. Only a
loaded, stopped `failed` run offers it. Resume sends exactly `run_id` and
`request_key`; restart additionally sends `retry_mode: "restart"`. `Keep` sends
nothing. The accepted reply is delivered through
`RunsController.acceptRunDetail` like cancel/title, and the new run is opened
only when the reply itself carries a numeric, different run id. A reply without
an id, a reply naming the source run, a late reply, or a reply after leaving
never guesses a run or moves the route.
The action row now uses the detail's native 8 dp / 4 dp `Wrap` spacing. It
previously used the default zero spacing, so the outlined Rename border met the
filled Retry button at 320 px (browser-measured gap 0.008 CSS px). Only actions
that render are included in the `Wrap`: a hidden action still consumed spacing
and would have doubled the visible gap.
The browser probe found one real web-only defect in the landed key generator:
dart2js evaluates `1 << 32` as `0`, so `Random.nextInt` raised every retry
before the request left the app. The bound is now a literal `0x100000000`; a
browser-compiled test and the web probe both exercise the real generator.
## Files
| File | Change |
| --- | --- |
| `lib/features/runs/ui/run_detail_actions.dart` | Renders `RetryRunAction` in the action row, forwards the reply-id callback, uses 8/4 dp spacing, includes only eligible actions |
| `lib/features/runs/ui/run_detail_view.dart` | Passes an optional server-identified run opener through to the actions |
| `lib/features/runs/screen.dart` | Opens the reply-named run through the existing `_select` path (controller selection + route) |
| `lib/features/runs/actions/retry_action.dart` | After the accepted detail callback, opens only a different numeric reply id |
| `lib/features/runs/actions/retry_intent.dart` | Web-safe 2^32 entropy literal instead of `1 << 32` |
| `test/features/runs/ui/run_retry_wiring_support.dart` | New: fixture gateway and both-host detail mount |
| `test/features/runs/ui/run_retry_wiring_test.dart` | New: real screen wiring, exact resume/restart payloads, server-named navigation |
| `test/features/runs/ui/run_retry_guard_test.dart` | New: no-id/same-id/refusal/late reply and eligibility gates |
| `test/features/runs/ui/run_retry_layout_test.dart` | New: action-row spacing at 320 px and 2x, no doubled gap from a hidden action |
| `test/features/runs/actions/retry_action_test.dart` | Full-width entropy regression for the request key |
| `test/features/runs/actions/retry_intent_web_test.dart` | New browser-only (`@TestOn('browser')`) regression for the dart2js entropy defect |
| `tool/retry_wiring_probe.dart`, `tool/retry_wiring_probe.mjs` | Normal-app browser probe; `CHROME_PATH`/`TESSERACT`/`PROBE_THEME` envs; measures the 8 dp action gap |
No dialog, repository protocol, server, web, shell, main, pubspec, Android or
iOS file changed. No new server command or API.
## Behaviour
- Action order in the detail `Wrap` is Rename, Retry, Cancel; Retry renders
nothing unless `canRetryRun(run)` holds (`!executing && status == "failed"`).
Both Material (`FilledButton`) and Cupertino (`CupertinoButton.filled`) use
their native controls and host typography. The row uses `spacing: 8` and
`runSpacing: 4`, matching the detail's other action rows.
- Opening the prompt and choosing `Keep` send nothing. Resume sends exactly
`{run_id, request_key}`; restart sends
`{run_id, request_key, retry_mode: "restart"}`. The key is
`app-retry-<runId>-…`, bounded at 128 characters, fresh per deliberate
intent, and retained across an uncertain resend by the landed dialog.
- The accepted `run_detail` goes through `onRunChanged`, i.e.
`controller.acceptRunDetail`: it folds an existing list row and replaces the
open detail only when its id still matches. A refusal stays in the prompt
with the server words and a bounded `get_run` recheck, as landed.
- The new run is opened only when `retryRunId(reply)` is numeric and differs
from the source id. `RunsScreen._select` then uses the existing controller
`select` generation guard and reports the route change, so the URL becomes
`/runs/<reply id>`. No id or same id, no navigation; a later reply after
leaving is ignored by the action's ownership check and never reaches the
controller. The accepted reply for the source run is still folded normally.
- The reply is not used to invent a title, status or id. The opened detail is
the server's `get_run` for the id the retry reply named.
## Checks actually run
```
dart format lib/features/runs test/features/runs tool/retry_wiring_probe.dart
# Formatted 61 files (0 changed)
flutter analyze # No issues found!
flutter test test/features/runs/ui/run_retry_guard_test.dart \
test/features/runs/ui/run_retry_layout_test.dart \
test/features/runs/ui/run_retry_wiring_test.dart # 13 passed
flutter test test/features/runs test/application/runs_destination_test.dart
# 134 passed
flutter test # 708 passed
flutter test --platform chrome \
test/features/runs/actions/retry_intent_web_test.dart
# 1 passed (dart2js)
flutter build web # Built build/web
flutter build web --target=tool/retry_wiring_probe.dart -o build/retry_probe_web_code
# Built
OPENCODE_ARTIFACT_DIR=.../public/r2c-retry-wire-code-fix \
node tool/retry_wiring_probe.mjs build/retry_probe_web_code
# ok: true, 9 checks, 10 captures
OPENCODE_ARTIFACT_DIR=.../public/r2c-retry-wire-code-fix PROBE_THEME=light \
node tool/retry_wiring_probe.mjs build/retry_probe_web_code
# ok: true, 9 checks, 10 captures
```
Regression guards were mutation-checked: with `spacing: 0` the 320 px spacing
test fails, and with `Random().nextInt(1 << 32)` the browser test fails with the
dart2js `RangeError`; both were restored.
Real-browser probe (normal app composition, isolated loopback websocket,
320×480 CSS at DPR 2, both themes and hosts):
- The action row measures **8.016 CSS px** (Cupertino) and **8.008 CSS px**
(Material) between Rename and Retry in both themes, versus 0.008–0.016 px
before the fix. Failed and running rows are visually separated in dark and
light.
- Cupertino: failed run shows Rename and Retry; `Keep` recorded zero retry
requests; restart sent
`{run_id: 7, request_key: "app-retry-7-…", retry_mode: "restart"}` and opened
only `/runs/8`, the reply's run. Resume from the still-failed source sent
only `{run_id: 7, request_key: "app-retry-7-…"}`, omitted `retry_mode`, and
opened only `/runs/9`.
- Material: the same failed run and action row; `Keep` sent nothing; resume
sent the same two-field payload and opened only `/runs/10`.
- All retry request keys started with `app-retry-7-`, fit 128 characters, and
no navigation occurred before a reply. Back listed the source and retried
runs.
- Twenty PNGs in
`/Users/alan/.local/share/pipelines/data/artifacts/80/public/r2c-retry-wire-code-fix/`
cover both themes and both hosts (failed, prompt, kept, restart prompt,
restart run, list, resume run; seven Cupertino and three Material each).
OCR asserted the source/new-run titles; the
failed captures were inspected for the restored native gap and readable
320 px layout.
Before the key fix, the same probe failed with
`ZONE ERROR: RangeError: max must be in range 0 < max ≤ 2^32, was 0` and
recorded zero retry requests.
## Honest limits
- **Mobile unverified.** No Android/iOS build, emulator, ADB or device was used;
sources stay portable Material/Cupertino.
- No production server, operator run or real retry was touched. The probe used
an isolated fixture with no credentials or shared data.
- Browser text scaling cannot be driven from CDP; 2x text at 320 px is covered
by the widget tests, while the browser probe covers 320 CSS px at DPR 2 in
dark and light.
- The browser entropy test is not part of the default `flutter test` VM run; it
needs `flutter test --platform chrome` and a Chrome install. No CI wiring
exists in this repository to add it to.
- The app opens the reply-named new run, while `web/src/views/dialogs.js`
silently re-selects the source run. The reply is genuinely the new run, so
this remains an intended improvement rather than pure parity; the product
decision is unchanged in this turn.
- The accepted reply's own detail is discarded when navigating and one
`get_run` follows, briefly showing the loading placeholder. Correct, one
extra round trip; not changed in this focused fix.
- `tool/retry_wiring_probe.mjs` remains long and requires Chrome; it now
honours `CHROME_PATH`, `TESSERACT` and `PROBE_THEME`, but is not otherwise
split.
- The post-Keep Cupertino capture is identical to the failed state; the
"sent nothing" claim rests on the probe's zero-request fixture state.
- A pre-existing Cupertino detail-header defect was observed at 320 px/2x: the
landed Changes button's internal `Row` overflows by 14 px. It reproduces with
Retry absent and belongs to the Changes lane, so it was not edited here.
- Nothing was committed, pushed, merged to main or deployed.
+62
View File
@@ -0,0 +1,62 @@
# Attention model (pure domain)
The `Needs you` model exists as reusable, widget-free Dart under
`lib/features/attention/domain/`. The list, identity, wording and local-day
window mirror the browser's `src/attention.js`; no UI, storage plugin,
notification permission or API request is added here.
`attention_transitions.dart` is an attention transition ledger, not a port of
`src/notify.js`: notification permission, tray alerts, `notify_mode` suppression
and success alerts are deliberately outside this slice.
- `attention_models.dart` owns the two kinds (`Decision` rank 0, `Failed` rank 1),
qualification, ordered entries, labels/detail wording, `{runId}:{kind}`
identities, dismissal/snapshot bookkeeping and the JSON string-array
serialisation under this app's own `pipelines.next.attention.v1` (deliberately
not the legacy web key, so neither client rewrites the other's local state).
- Only `waiting` and `failed` statuses qualify, after trimming/lowercasing. A
waiting run with a session audit/export handoff (`export_pending_sequence > 0`)
asks no person and is excluded; a failed run stays failed. `resource_wait` is
deliberately not consulted, matching `web/src/attention.js` and `Attention.kt`
(the server retired the field, and a stale value must not hide a decision).
- The surface is today's work: `attentionEntries` accepts an optional `since`
cutoff and drops an entry when its recency parses and is before it, keeping a
blank or unreadable recency, exactly as the browser does. No cutoff (or an
epoch-zero one) shows everything. Callers pass `startOfLocalDay()` to the bell,
the sheet and the Clear-all snapshot, so yesterday's failures become history.
Stored dismissals themselves still never expire.
- `startOfLocalDay({now})` returns local midnight and takes an injectable `now`
so the UI does not re-derive it and tests stay deterministic.
- Ordering is kind rank, then `finished_at` else `created_at` descending using the
server's timestamp text, then run id descending. The label is the trimmed title
else pipeline name; the detail is `Waiting for your decision`, or the trimmed
diagnostic else `Run failed`.
- Entries retain the whole source summary map, so fields this model does not read
(and unknown future fields) are preserved. `AttentionEntry` is constructed only
by `attentionEntryFor`, so its `runId` is always a validated positive id.
- `attention_transitions.dart` is a pure detector: a seed/first-seen run,
duplicate frame, nonqualifying status, export wait, reconnect reseed or a
snapshot bracketed with `beginSeed`/`endSeed` never emits. It emits once when a
known run enters `failed` or a human `waiting`, forgets the key when the run
leaves that state, and keeps the emitted set across `resetForReconnect`/`reseed`
so a gap cannot replay a transition. A reseed keeps the key of a run that still
qualifies (or that is absent from the read) and prunes one whose run no longer
asks. Dismissed identities are marked seen but suppressed.
Focused tests in `test/features/attention/` cover qualification and exclusions,
ordering and tie-breaks, the local-day cutoff (older/newer, unparseable/blank
recency, no cutoff, decisions, dismissal composition), wording/labels, identity,
dismissal filtering, the clear-all snapshot, defensive copying, malformed/blank
storage, unknown-field preservation, and transition dedupe/first-seen/
nonqualifying/reconnect reseed/emitted-key retention.
Verification: `flutter test test/features/attention` passed all 44 tests;
`flutter analyze` reported no issues. No browser capture applies to this
nonvisual domain slice.
Not done here: no `Needs you` screen/sheet, badge, storage write, store/controller
wiring or notification permission was added, and `PARITY.md` remains `Missing`
until those land. The older `orderAttention` helper in
`lib/features/runs/domain/run_models.dart` was left untouched for lane ownership;
the runs UI must delegate to this model when it is wired, so the two authorities
cannot diverge. Mobile is unverified.
+183
View File
@@ -0,0 +1,183 @@
# T1 — reusable native Templates gallery
Manager acceptance: re-ran the templates suite (38 tests) and rebuilt the
in-process fixture. Seven probe checks pass with seven captures under approved
temp/templates-gallery-browser; the selected-template capture was inspected and
shows metadata, the verbatim selectable source and the native create action with
one bar. No real template was created or submitted; every request came from the
fixture gateway. Settings/route registration and a post-create pipelines-list
refresh are still manager wiring, not claimed here.
## Result
`TemplatesScreen` is one reusable gallery over the server's actual template
catalogue. It lists every `list_templates` row, opens the selected template's
metadata and its source byte-for-byte in the host's selectable body, and offers
the browser's one create action. That action calls the already-landed
`showTemplateCreateDialog` unchanged, so validate-then-submit, Cancel,
create-only `submit` and the single accepted `detail` stay in the existing
prompt. The accepted detail is forwarded through the optional `onCreated`
callback.
A refused refresh is reported above whichever body is current, including an open
template, with the host's native Retry; the selection and already-read rows are
kept. The screen's loading state, late-reply guard and single create path are
unchanged.
Nothing is registered in the shell, Settings, routes or application; the
manager owns that next. No pipeline/gallery/create code was rewritten and no
run, schedule, publish, cancel or graph control exists here.
## Files (all new; no tracked file modified)
| File | Lines | Responsibility |
| --- | ---: | --- |
| `lib/features/templates/screen.dart` | 208 | Load/selection/create state, late-reply sequencing, failure banner above either body, embedded flag, system back |
| `lib/features/templates/ui/template_gallery.dart` | 138 | Catalog rows and honest loading/empty/full-failure states |
| `lib/features/templates/ui/template_detail.dart` | 168 | Browser wording, metadata, verbatim selectable source, create action, embedded Back row |
| `lib/features/templates/ui/templates_failure.dart` | 118 | Full failure state and the screen-level failed-refresh banner, each with native Retry |
| `lib/features/templates/ui/templates_frame.dart` | 104 | Native standalone app bar or embedded Refresh row; Back/Refresh controls |
| `test/features/templates/ui/template_gallery_test_support.dart` | 112 | Recording gateway, catalogue fixtures, Material/Cupertino host pump |
| `test/features/templates/ui/template_gallery_screen_test.dart` | 379 | States, retry, refresh, detail-refresh failure (both hosts, embedded), back, embedded, 2x, late/disposed replies |
| `test/features/templates/ui/template_gallery_create_test.dart` | 104 | Cancel sends nothing, verify+submit once, optional callback, Cupertino prompt |
| `tool/templates_gallery_probe.dart` | 178 | Isolated in-process fixture entry; default, empty and detail-refresh-refusal scenarios |
| `tool/templates_gallery_probe.mjs` | 386 | Loopback static server + real headless Chrome driver |
| `notes/T1-gallery.md` | — | This evidence |
`TemplateEntry`, `TemplateRepository`, `TemplateRepositoryException`,
`ApiGateway`, `showTemplateCreateDialog` and its wording/keys are reused
unchanged. `pubspec.*`, `lib/main.dart`, `lib/application/`, `lib/shell/`,
Settings, routes, Pipelines, `web/`, the Go server and `android/` were not
touched.
## Behaviour
- Gallery wording is the browser's: `Loading templates…`, `No templates are
available on this server.`, a blank catalogue name as `(unnamed template)`,
description verbatim, and a blank detail heading falling back to the key.
- Detail shows the description (when non-blank), `Key`, `Includes a schedule`
(when true), `Definition source`, and the server's complete source in
`SelectableText`. The source is never trimmed, re-indented or re-encoded.
- The action is exactly `Create pipeline from this template`. It calls
`showTemplateCreateDialog` with the current repository, the selected entry and
the host's native flag. Opening the prompt, typing, or Cancel sends nothing.
Only the dialog's Create validates and then submits create-only; an accepted
detail reaches `onCreated` exactly once.
- Standalone Material uses `Scaffold`/`AppBar` with a native `BackButton` when a
template is open and a tooltip `Refresh` action; Cupertino uses
`CupertinoPageScaffold`/`CupertinoNavigationBar` with the native back chevron
and refresh icon. Doors are opened on the detail as this screen's own page, so
Android system back also returns to the gallery via `PopScope`.
- `embedded: true` drops the app bar, keeps a Refresh control at the body's
trailing top edge and shows a native Back row inside the detail, matching the
shell-owned-navigation contract used by other feature screens.
- Loading, empty and refusal have their own truthful states. A refusal shows the
server's own text and `Retry`; a refresh failure keeps already-loaded rows and
shows the refusal/`Retry` above them instead of blanking the gallery. The same
banner is rendered above an open template, so pressing Refresh on the detail
never fails silently; Retry re-reads with the template and rows kept.
- Only the newest `list_templates` generation may publish. A gateway change
clears the old server's rows and selection, an older reply is ignored, and a
reply completing after disposal is dropped (no `setState`).
- No stage-count read, stage list, Graph tab or mini graph is included: this
slice deliberately sends no per-card `validate`. The browser's stage count is
therefore not claimed here. The detail's metadata is description, key and
schedule flag; its source is complete.
## Checks actually run
```
cd app
flutter analyze # No issues found
dart format --output=none --set-exit-if-changed \
lib/features/templates test/features/templates/ui/template_gallery_*.dart \
tool/templates_gallery_probe.dart # 0 changed
flutter test test/features/templates # 37 passed
flutter test # 690 passed
flutter build web -o <private>/web-normal # ✓ Built
flutter build web --target=tool/templates_gallery_probe.dart \
-o <private>/probe-web # ✓ Built
```
The focused suite covers: loading then catalogue; empty; refusal + Retry;
failed refresh retaining rows; a failed refresh with the detail open on Material
and Cupertino, including the native Retry control and the template staying
open; the same failure in embedded mode; refresh re-reading without losing
selection; selection showing metadata/source with no validate/submit;
native/system back; embedded framing; Cupertino list/back/detail controls; 2x at
360×640 with no overflow; stale reply ignored after a gateway replacement; late
reply after disposal; Cancel sending nothing; exact `validate`/`submit` payloads;
callback once; optional callback; Cupertino prompt.
## Browser evidence (real headless Chrome, loopback only)
The probe's gateway is in-process; it never opens a socket and never contacts a
real Pipelines server. All runs are dark (`MaterialApp` standard dark theme /
`CupertinoThemeData(brightness: dark)`), with no font, colour or component-size
overrides. Each default run asserts: refusal + Retry; loading; actual rows;
selection metadata + `Definition source`; back; refresh adding
`Added after refresh`; Cancel with zero requests; accepted create with exactly
one validate and submit, exact
`{name: "Probe release", source: <verbatim fixture>, create_only: true}`,
callback once, and Close sending nothing.
- Material dark, 390×844, 1x — `public/t1-gallery/`
(`error`, `loading`, `gallery`, `detail`, `refreshed`, `create-blank`, `created`).
- Material dark, 360×640, 2x text — `public/t1-gallery-2x/` (same seven states).
- Cupertino dark, 390×844, 1x — `public/t1-gallery-cupertino-1x/` (same seven).
- Cupertino dark, 360×640, 2x text — `public/t1-gallery-cupertino/` (same seven).
- Material dark empty catalogue — `public/t1-gallery-empty/t1-gallery-empty-empty.png`.
- Material dark failed refresh with the detail open —
`public/t1-gallery-detail-refresh/` (`detail-refresh-error`,
`detail-refresh-retried`).
- Cupertino dark failed refresh with the detail open —
`public/t1-gallery-detail-refresh-cupertino/` (same two states).
The new scenario loads the catalogue, opens `Release workflow`, presses Refresh
and the fixture read genuinely refuses. The run asserts the refusal and Retry
are present above the still-open definition source, that exactly two
`list_templates` reads and no `validate`/`submit` happened, then presses Retry,
asserts the banner clears, the template stays open and a third read happened.
Inspected both Material and Cupertino captures: the native banner sits above the
detail, then disappears after Retry without losing the template.
Inspected screenshots: the Material dark gallery/detail, the 2x detail with
wrapped action and title, the Cupertino 1x gallery/detail, the 2x Cupertino
gallery (names now wrap to two lines rather than ellipsizing), the error/Retry
state and the created dialog with the exact success line.
## Task diff
```
?? app/lib/features/templates/screen.dart
?? app/lib/features/templates/ui/template_detail.dart
?? app/lib/features/templates/ui/template_gallery.dart
?? app/lib/features/templates/ui/templates_failure.dart
?? app/lib/features/templates/ui/templates_frame.dart
?? app/test/features/templates/ui/template_gallery_create_test.dart
?? app/test/features/templates/ui/template_gallery_screen_test.dart
?? app/test/features/templates/ui/template_gallery_test_support.dart
?? app/tool/templates_gallery_probe.dart
?? app/tool/templates_gallery_probe.mjs
?? app/notes/T1-gallery.md
```
All are additions in the working tree. No tracked file changed, no concurrent
lane or manager commit was modified, and nothing was staged, committed, pushed
or deployed. `git diff --check` is clean.
## Honest limits
- Not wired into the shell/Settings/routes; this is reusable source, not a
normal-app preview entry. The manager owns registration.
- No real Pipelines server, credentials, operator pipeline or create request was
touched. Browser evidence uses the in-process fake gateway.
- Mobile (Android/iOS) is unverified: no Android/iOS build, emulator, device or
ADB. The Cupertino captures are Chrome's rendering of Cupertino widgets, not
iOS; VoiceOver/TalkBack was not run.
- Stage counts, stage lists and the Graph tab are intentionally not implemented
in this slice (no per-card validate), so they are not claimed as parity here.
- Browser captures remain standalone use only; `embedded: true` is covered by
widget tests, not by the headless-Chrome probe.
- `/artifacts`/live authenticated data and the real dark app-shell theme were
not exercised; the probe supplies the standard dark host themes.