Merge branch 'main' into flutter/start-pipeline

This commit is contained in:
2026-10-22 02:07:51 +01:00
124 changed files with 15223 additions and 440 deletions
+182
View File
@@ -0,0 +1,182 @@
# A2 — notification capability behind a platform seam
The notification capability exists as reusable Dart under
`lib/features/attention/notify/`, plus one reusable Settings tile at
`lib/features/attention/ui/notification_permission_tile.dart`. Nothing was wired
into the shell, `Settings`, the application or the Runs screen; outside those
paths only this note, the notify tests and the isolated probe changed.
## What is there
| File | Lines | Role |
| --- | --- | --- |
| `notify/notification_models.dart` | 169 | permission state, environment, copy, permission view, alert title/body, `NotificationMessage` |
| `notify/notification_bridge.dart` | 30 | the abstract `NotificationBridge` + the conditional-import factory |
| `notify/notification_bridge_web.dart` | 95 | the real `Notification` API via `dart:js_interop` (no `package:web`) |
| `notify/notification_bridge_stub.dart` | 27 | non-web stub that reports `unsupported` honestly |
| `notify/notification_ledger.dart` | 122 | run+kind identity, the qualifying-key set, ledger with pruning, total JSON codec, `pipelines.next.notify.v1` |
| `notify/notification_store.dart` | 83 | injectable store seam; total `shared_preferences` impl + memory impl |
| `notify/notification_controller.dart` | 250 | the `ChangeNotifier` capability |
| `ui/notification_permission_tile.dart` | 127 | the reusable native tile |
| `tool/notification_probe.dart` / `.mjs` | 291 / 314 | isolated real-browser probe |
## Platform seam
`NotificationBridge` answers the platform's own facts
(`environment()` → `supported`, `secureContext`, raw `permission`),
`requestPermission()` (only ever called from an explicit gesture) and
`show(message, onTap:)`. The web bridge declares `@JS('Notification')` with
`external factory`, `external static permission`, `external static
requestPermission` and an `onclick` setter, and reaches the global only after a
`globalContext` support check, so an unsupported browser is never touched. The
stub returns `supported: false` and `show() == false`.
`NotificationController.permission` is one of `unsupported`,
`needsSecureContext`, `notRequested` (the API's own `default` — `default` is a
Dart reserved word, and each state exposes `wireName` = `unsupported` |
`insecure` | `default` | `granted` | `denied`), `granted`, `denied`. It is
derived only from `notificationStateOf(environment)`; `granted` is never assumed
from an unrecognised word. `requestPermission()` asks only while the state is
still `notRequested`, issues the platform request before any `await` so it stays
inside the gesture, persists `asked` without awaiting, and follows the platform's
answer. A denied state is never re-prompted.
## Notify only on live transitions, dedupe per qualifying state
The identity is the attention surface's own `{runId}:{Kind}` key, which is also
the browser's `alertKey` and therefore the coalescing `tag`:
- The initial list seed raises no transition, so `publishTransitions` over the
attention controller's (empty) transition list posts nothing.
- `publishTransitions(transitions, qualifying:, dismissed:)` receives
`notificationQualifyingKeys(attention.rows)` — the `{runId}:{Kind}` keys of the
runs that are failed or waiting *right now*. A transition whose key is not in
that set is stale (the caller's accumulated list still holds it because the run
has moved on), so it neither posts nor re-records anything.
- At the end of the publish, every recorded identity outside the qualifying set
is forgotten ([`NotificationLedger.pruning`]). Publishing the frame that
*leaves* the state is what makes the next gate (or a later failure of a new
run id) a new announcement.
This is the browser's `forget`/`pruneNotified` model.
- A waiting run has no `finished_at`, so a timestamp marker cannot separate its
first decision gate from a later one. The run+kind identity plus pruning can:
`waiting -> running -> waiting` notifies once per gate even though both
entries carry identical timestamps. A retry that produces a new failed run id
is likewise a new identity; a failed run id never returns to running.
- A caller that misses the frame that leaves the state is still handled: the
attention detector creates one transition instance per genuine transition, so
an identity announced earlier in this session with a different instance is a
new occurrence and notifies. Republishing the same instance stays silent.
- The same transition can never notify twice across a republish, a reconnect
reseed, or a controller rebuilt over the same store while the run still
qualifies. The ledger records the identity before the platform is asked to
show it and persists it under `pipelines.next.notify.v1` through the injectable
`NotificationStore`. A value written by the previous timestamp-identity build
stops matching the qualifying set and is dropped on the next publish, so no
migration step is needed.
- The ledger is bounded by the runs currently qualifying, not by the history of
every event the install has ever seen.
- Writes are serialized through one queued future, so an older snapshot can
never land after a newer one, and a throwing read/write is swallowed: the
in-memory ledger still applies for the session.
- A dismissed identity is recorded but never shown (the transition detector
already suppresses it; the publish guard covers a caller that passes it).
- Content is the entry's own words: the kind headline (`A run failed` / `A run
needs your decision`) and `label · pipeline`, matching `web/src/notify.js` and
`RunAlerts.kt` verbatim. Nothing is invented, and no `stage` field is added
because neither reference client's alert body carries one.
- A batch posts in order, bounded to `maxNotificationsPerBatch` (5); the rest are
posted on the next call because the ones already posted are recorded.
- `notified` returns an unmodifiable copy, so a caller cannot mutate the ledger
behind the controller's back.
## Wiring the manager still owes
```dart
final notify = NotificationController(store: const SharedPreferencesNotificationStore());
notify.onOpenRun = (runId) { /* open that run — navigation lives here, not in notify */ };
await notify.load();
// after *every* authoritative read and pushed frame the attention controller handles:
notify.publishTransitions(
attention.transitions,
qualifying: notificationQualifyingKeys(attention.rows),
dismissed: attention.dismissed,
);
```
Publishing on the frames that leave a state matters as much as publishing the
one that entered it: that is when the old identity is forgotten. `load()` once,
and `publishTransitions` on every frame/seed, is enough; it is idempotent.
`refreshPermission()` re-reads the platform facts after a focus change. The tile
is embedded by the Settings screen with the live `state`/`asked` and an
`onRequest` that calls `notify.requestPermission()`.
## Tests and evidence
- `flutter test test/features/attention` — **147 passed** (12 more than before
this change; the notify/tile files hold 55). New coverage in this change: the
`waiting -> running -> waiting` second gate with the real waiting shape (empty
`finished_at`) notifies again, with and without publishing the leaving frame;
a coalesced backlog of two gates notifies once; a stale transition from a run
that left is not re-posted; the identity is run+kind so two alerts of one run
share the browser tag; pruning drops identities outside the qualifying set;
old timestamped identities are dropped; `notificationQualifyingKeys` ignores
export waits, malformed ids and duplicates; `notified` is unmodifiable; ledger
writes are serialized in call order.
- `flutter test` (whole app) — **1058 passed**.
- `flutter analyze` — **No issues found** (whole project).
- `dart format --output=none --set-exit-if-changed` on every new lib/test file —
clean.
- `flutter build web` (the real `lib/main.dart`) — **succeeded**. This does *not*
compile the notify feature: nothing under `lib/` imports it yet, so the main
bundle contains none of its strings. It is a sanity check for the app only.
- `flutter build web -t tool/notification_probe.dart -o build/notification_probe_web`
— **succeeded**. This is the build that compiles the conditional-import web
bridge (`isSecureContext`, the alert copy and the real `Notification` seam are
in this bundle).
- Real-browser probe (`tool/notification_probe.dart` + `.mjs`, isolated loopback
server, `Browser.grantPermissions` / `Browser.setPermission`,
`window.Notification` replaced with a recording spy before load):
**all 29 checks passed** — seed posted 0; one transition posted exactly 1 with
title `A run failed`, body `Nightly audit · nightly` and tag `1:Failed`; a
dismissed transition posted 0; a reconnect replay posted 1 in total; a second
decision gate posted exactly 2 in total, both tag `7:Decision`, with the
waiting frames carrying no `finished_at`; denied and unsupported pages posted 0
and read their honest copy; all five tile states read correctly on Material
**and** Cupertino at 320 logical px / 2x.
- 13 PNG captures regenerated in
`/Users/alan/.local/share/pipelines/data/artifacts/100/public/captures/notify/`
(`notification-transition-…`, `notification-denied-…`,
`notification-unsupported-…`, and
`notification-tile-{unsupported,insecure,default,granted,denied}-{material,cupertino}-dark-320-2x.png`).
One UI defect was found by the first captures and fixed in the previous visit:
putting the Enable action in a `ListTile` trailing slot squeezed the section title
to one glyph per line at 320 px / 2x, so the action now sits on its own row below
the copy (as the browser's settings section does), and the widget test guards it.
## Deliberate limits
- `PARITY.md`'s `Notifications` row is **still Missing**: this slice is a
capability plus a reusable tile, not a delivered Settings section or shell
wiring. The row should move when the manager embeds the tile and wires the
controller, with authenticated smoke evidence.
- The instance rule is session-local. A controller rebuilt over the same store
can only distinguish a later gate if the frame that left the state was
published (which prunes the old identity), so the wiring above still publishes
every authoritative read and frame rather than only entering transitions.
- A browser whose `Notification.requestPermission()` uses the legacy
callback-only form (no returned promise) falls back to the honest default
wording, as the web client also does.
- Mobile (Android/iOS) is unverified: the stub reports `unsupported` and no
device or OS notification behaviour was exercised. No `pubspec` change.
- The tile is not registered in Settings and background chat-question notices
(`web/src/app.js` `notifyChatQuestion`) are not part of this capability.
## Manager completion after the Code deadline
The run succeeded at Code, was rejected once at Review, and the retry hit the
30-minute deadline. The retained tree is complete: 147 attention tests pass and
analysis is clean. Merged directly. Shell wiring (permission tile in Settings and
transition delivery from the Runs attention controller) is the manager's next
step and is not claimed here.
+54
View File
@@ -0,0 +1,54 @@
# A3 — artifact files: download and share
## Scope
The selected artifact can be saved or shared as a real file. The external
`Open` and `Copy link` actions stay unchanged; neither is reused as a stand-in
for a file transfer.
## Implementation
- `artifact_transfer.dart` is the platform seam with a web implementation and a
stub. The web file uses `dart:js_interop`/`dart:js_interop_unsafe` only, so the
same source compiles to JavaScript and WebAssembly without `package:web`.
- `artifact_transfer_web.dart` builds a `Blob`/`File` from the fetched bytes with
the recorded name and MIME type, downloads through an anchor created for that
name, and shares through `navigator.share` only when the platform can share
files. It never puts the artifact url or a blob page into the user's hands.
- `artifact_file_controller.dart` fetches bytes through the same
`ArtifactFetch` seam the in-app viewer already uses, so the same-origin
credential policy and HTTP status handling apply. One in-flight transfer at a
time; a second activation is ignored. Cancel stops the action from continuing
and a late result is never reported as a completed transfer.
- The selection sheet exposes `Download` and `Share` beside the existing
actions, with honest states for unsupported sharing (download still works),
missing/malformed name or MIME, fetch failure with its HTTP status, and
cancel. Nothing is silently substituted.
## Evidence
- Focused suite: 123 artifact tests pass; `flutter analyze` clean.
- Browser probe (`tool/artifact_gallery_probe.mjs`, 32 captures, 27 checks) on
both hosts, dark at 2x and 320 logical px:
- Material and Cupertino `Download` hand the host `report.csv`, `text/csv`,
23 exact bytes.
- Material and Cupertino `Share` hand the host a `report.csv`, `text/csv`,
23-byte `File`.
- Existing gallery/viewer checks (recorded rows, duplicate filename, empty vs
unavailable, image in-app, HTTP failure, external artifact never fetched,
320/2x paging) still pass.
## Known limits
- The shared fetch seam has no cancellation token, so Cancel abandons the action
without aborting the HTTP request. The UI never claims the transfer finished.
- OS share sheets and file downloads are web-verified only. Android/iOS
transfer behavior remains unverified until the final build.
- No authenticated production artifact was transferred; the probe uses an
isolated fixture with fixed bytes.
## Manager note
The run reached its Code deadline with this tree complete and verified by the
manager: tests, analysis, browser build and the 27-check probe above. Merged
directly rather than replayed.
+148
View File
@@ -0,0 +1,148 @@
# C4-approvals — native permission and question cards
One checked integration slice: the chat conversation now renders recorded
`chat_permission` frames and `form` question frames as native Material/Cupertino
cards, answers them through the landed `ChatRepository` request facade, and
records the outcome. App-only; no server, `web/`, Android/iOS, shell, route or
deployment source was edited.
## What changed
| File | Lines | Responsibility |
| --- | ---: | --- |
| `lib/features/chat/conversation/chat_permission_card_model.dart` | 192 | approval card derivation, risk/resource wording, decision labels, one-shot reply ids |
| `lib/features/chat/conversation/chat_permission_card.dart` | 267 | native approval card: kind/headline/status, six-line resources with full-request disclosure, risk panel, once/always/reject |
| `lib/features/chat/conversation/chat_question_card_model.dart` | 206 | field visibility/values, web validation messages, visible answers, form folding, answer ids |
| `lib/features/chat/conversation/chat_question_card_fields.dart` | 179 | editable field shell, free-text inputs, external-URL text |
| `lib/features/chat/conversation/chat_question_option_controls.dart` | 160 | native single/multi select and boolean controls |
| `lib/features/chat/conversation/chat_question_recorded_answers.dart` | 99 | read-only recorded answers, including unknown keys |
| `lib/features/chat/conversation/chat_question_card.dart` | 275 | pending/answered/expired question card, local answer state, submit/actions |
| `lib/features/chat/conversation/chat_transcript_card.dart` | 96 | card-row builder and small permission/question dispatcher |
| `lib/features/chat/domain/chat_transcript.dart` | +10/-2 | `transcriptRows(..., trailing:)` keeps cards after the message rows |
| `lib/features/chat/conversation/chat_thread_controller.dart` | +140 | folded permission/form frames, answers, errors and one-shot send gates |
| `lib/features/chat/conversation/chat_thread_view.dart` | +26/-6 | builds/dispatches card rows inside the existing conversation list |
| `app/PARITY.md` | row update | states the native cards as Source, with the real-request smoke still open |
| `test/.../chat_permission_card_test.dart` | 300 | model + native behaviour + pushed-frame integration |
| `test/.../chat_question_card_test.dart` | 360 | field rules + native behaviour + pushed-frame integration |
| `tool/chat_approvals_probe.dart` | 167 | real-widget fixture with a scripted replaying gateway |
| `tool/chat_approvals_probe.mjs` | 335 | Chrome CDP interaction, OCR assertions and captures |
Production files stay under the ~250-line aim except the two 267/275-line card
shells; the larger question work is split by responsibility (fields, option
controls, recorded answers) rather than arbitrary fragments.
## Behaviour
- **Permission card.** Kind line `Permission request · {source.type}` when the
server records one, else `Permission request`. Headline `Approve {action}`
(`Approve tool call` when blank). Status `Waiting for your response`.
Resources are the server's non-blank entries joined by newlines, displayed at
most six lines with an ellipsis on the last kept line; when truncated, the
native disclosure `Show full request` carries every recorded resource. The risk
panel uses the server's `message`, else the web's neutral sentence naming the
action, and shows only while pending or after a rejection. Controls use the
exact `Allow once` / `always_label or Always allow` / `Reject` labels and only
while pending.
- **Permission outcome.** Answering settles the card optimistically to the
decision label and `Waiting for the agent to continue…`. A server
`resolved`/`decision` frame always wins, shows the decision label (or
`Already resolved` when the recorded decision is blank) and its `message`/the
web's fallback note. A refusal clears the optimistic answer, keeps the card
pending, and shows the server reason in a live region.
- **Reply wire.** `ChatRepository.replyPermission` sends exactly
`{chat_reply:{session_id,request_id,decision,client:'Web'}}`; no extra field is
added. Each confirmed action has the stable local id
`chat-reply:{requestId}:{decision}` held by a `ChatActionGate`, so a double tap
sends once and a refused send reopens only that id for retry.
- **Question card.** Shows the recorded title (or `Question`) and
`The agent is waiting for your answer.`. Options keep the server's value/label
and description exactly; single-select is a radio group under Material and a
checkmark row under Cupertino, multi-select is checkboxes/checkmarks, booleans
are the explicit Yes/No menu under Material and checkmark rows under Cupertino.
Free text appears for `custom` fields or fields with no options, with number,
email, URL and date keyboards and secret input where recorded.
- **Question rules.** Visibility honours `hidden` and `when` (`eq`/`neq`).
Answers preserve `false` and `0`. Required missing answers, invalid
number/integer, min/max bounds, boolean type, string length and item counts
produce the web's exact messages; invalid input blocks the send and shows the
reason. Visible, non-external, answered fields alone travel in `chat_answer`.
`accept` is sent when the form lists it; `Decline` / `Cancel question` use the
recorded actions and an empty answer map.
- **Question outcome.** Submit is one-shot through the stable id
`chat-answer:{formId}:{action|answer}`. Success marks the form resolved locally
and shows `Answer recorded.`; the server's resolved/cancelled echo replaces it
with the recorded answers. `cancelled` shows `This question expired.`.
Read-only rendering includes answers for fields no longer present, and says
`No answer was recorded.` when the resolved form recorded none. A refusal keeps
the card pending with its typed state and shows the server reason.
- **Composition.** Cards follow the message rows in server order (permissions
then questions), keyed by request/form id so streaming repaints keep an open
disclosure or half-typed answer. Unknown message parts still render through the
existing plain `Unrecognised part` disclosure; nothing in `ChatMessageView` or
the markdown renderer changed.
## Checks actually run (after the final split)
- `flutter analyze` — `No issues found!`
- `flutter test` — `All tests passed!` (1003 tests, including the 20 new focused
card/model/controller cases)
- `flutter build web --output build/web-acceptance` — `✓ Built`
- `node tool/chat_approvals_probe.mjs` for both hosts — see below.
## Browser fixture evidence
The fixture runs the **real** `ChatThreadView`/controller against a scripted
gateway that replays one pending `chat_permission` and one `form` question on
subscribe, then echoes the reply/answer back as a resolved frame. Chrome CDP at
320px logical width, device scale 2, dark appearance, both hosts. Static card
text is OCR-verified because Flutter web paints it on the canvas; controls are
driven through semantics.
Captures and evidence (shared run artifacts):
- `public/chat-approvals-probe/material-cards.png`
- `public/chat-approvals-probe/material-approval-answered.png`
- `public/chat-approvals-probe/material-question-answered.png`
- `public/chat-approvals-probe/material-evidence.json`
- `public/chat-approvals-probe/cupertino-cards.png`
- `public/chat-approvals-probe/cupertino-approval-answered.png`
- `public/chat-approvals-probe/cupertino-question-answered.png`
- `public/chat-approvals-probe/cupertino-evidence.json`
Each run asserted the pending card's recorded action, status, risk, resource
lines and all three control labels; that `Allow once` sent the reply (the fixture's
server resolution replaced it with `Allowed once` and cleared the controls); and
that selecting `Red` + `Send answer` sent the answer and produced the read-only
`Answer recorded.` card. Both runs finished with `sendAnswerStillVisible:false`
and `allowOnceStillVisible:false`. The Material capture also shows no clipped
text at 320/2x; the Cupertino capture uses only Cupertino controls (widget tests
assert no `Material` ancestor in that host).
## Limits, stated plainly
- **No live server request was answered.** The fixture's gateway is scripted and
its reply/answer responses are local; no operator chat, run, approval or real
server was mutated.
- **No authenticated smoke yet.** The `PARITY.md` row remains Source, not Preview:
a real pending approval/question against the authenticated server, and a
multi-client server resolution, are still unverified.
- **Web only.** Android/iOS builds, ADB, emulators and device/OS behavior were not
run (per the app working agreement); source is portable but mobile is
unverified.
- **External question forms** display only their recorded HTTP(S) URL as
selectable text; no URL launcher dependency exists in this app, so they are not
opened from the card. Unsupported URLs show the web's alert wording instead.
- **Uncommitted.** The pipeline input asked for a candidate commit, but the stage
instructions explicitly say not to commit, push or deploy, so the work is left
in the working tree (`flutter/chat-approvals`) with no commit or merge.
## Manager completion after a harness transport failure
The run ended on a harness transport error (`/api/session/active`) after a full
Code visit; the retained tree was complete. Manager verified 173 chat tests,
clean analysis, and the both-host browser probe. Two probe expectations were
corrected against the web rather than against the app: the approval card's
headline is the recorded action (the web has no separate "Permission request"
heading), and OCR merges whitespace, so comparisons now ignore it and accept a
control that is present in the semantics tree. No app behaviour was changed to
make the probe pass.
+144
View File
@@ -0,0 +1,144 @@
# Graph viewport: pan, zoom, fit and expanded
The measured definition/run canvases now share one viewport layer. Nothing in
the graph's wiring changed: `DefinitionGraphView` and `RunGraphView` keep their
existing props and call sites, and the pipeline Graph tab / run detail open the
expanded presentation without edits to those tabs.
## Landed
- `lib/features/graph/viewport/graph_viewport_math.dart` — the web graph's
`fitScale`/`clampOffset` rules (padding 24, min 0.3, max 3, at least 40px of
the scaled graph visible) plus the `offset + point * scale` matrix.
- `lib/features/graph/viewport/graph_viewport_controller.dart` — owns the
`TransformationController`, auto-fits on first layout, re-fits a resize only
before the reader interacts, clamps every later transform, and round-trips a
`GraphViewportSnapshot`.
- `lib/features/graph/viewport/graph_viewport.dart` — the bounded canvas: the
host's `InteractiveViewer` gestures (drag, pinch, wheel, trackpad) with an
infinite boundary margin so the graph's own fit/bounds win, plus native Fit
and Expand controls (`Fit graph to view`, `Expand graph`).
- `lib/features/graph/viewport/graph_expanded_view.dart` — a native full-screen
presentation (`Scaffold`/`CupertinoPageScaffold`) with one visible `Close`
action, `openGraphExpanded()` as the widget/callback seam, and an optional
fixed `header` above the canvas. It fits the larger box exactly as the web
re-fits when its panel expands, keeps the selected node selected, re-fits a
resize until the reader interacts and clamps one afterwards. It owns a
separate controller, so closing restores the inline transform exactly.
- `DefinitionGraphView`/`RunGraphView` now wrap their measured content in
`GraphViewport`; `RunGraphCanvas` is the passive content only (the viewer
moved out of it). `DefinitionGraphCanvas` owns the measured definition
composition, and `RunGraphHeader` owns the route legend + elapsed line and is
carried into the expanded run presentation. Node sizes, routing,
executed/unvisited evidence, labels and legend are unchanged.
## Behavior and bounds
- The graph is fitted on first layout with 24px padding and never upscaled past
1:1, before the first paint: the first layout attaches synchronously, when
nothing is listening to the transform yet, rather than flashing an identity
transform for a frame.
- Scale is clamped to 0.3–3 and a drag can never leave an empty viewport
(40px minimum visible per axis).
- Pinch/wheel zoom anchors the graph point under the moving focal point; a tap
that does not move still reaches the native node under the pointer because
hit-testing follows the same transform.
- Fit and Expand are stock host buttons with one accessible name and the
button's own tap action on both hosts. The icon is the only excluded child
and `MergeSemantics` folds the real button action into the labelled node; a
hand-written sibling `Semantics` around an `ExcludeSemantics`d button would
announce the control with no action at all.
- Single taps select nodes; dragging over a node pans instead of selecting.
- The canvas consumes gestures only inside its own box. An ancestor scroll view
keeps scrolling for gestures outside the canvas, and the canvas never pans
from a drag that starts outside it.
- Expanded draws the same canvas at its own fit, keeps the legend (run graph),
keeps the selection, and leaves the inline canvas untouched.
## Checks (final tree)
From `app/` with Flutter 3.44.6 / Dart 3.12.2:
- `flutter analyze` — **No issues found**.
- `flutter test` — **1025 tests pass** (1m 06s in this run).
- `flutter test test/features/graph` — **175 pass**.
- `flutter test test/features/graph/viewport` — **20 tests pass**
(8 math/controller, 9 viewport widget, 3 expanded), covering:
- drag pans and pan stays bounded;
- pinch clamps at 0.3 and 3;
- zoom keeps the graph point under the moving focal point;
- the first painted frame is already fitted;
- Fit restores the fitted scale/offset;
- tap selects the node visually under the pointer after a transform (synthetic
targets and real `DefinitionGraphView` nodes);
- ancestor scroll is not hijacked outside the canvas;
- Fit and Expand are labelled buttons with a tap action on Material and
Cupertino, and performing that action runs the real callback;
- 320px/2x on Material and dark Cupertino;
- expanded fits the larger canvas, preserves selection and returns the inline
state exactly;
- a rotation re-clamps the expanded transform into the new box.
- `flutter build web` — succeeds for the app and the probe target.
- Real Chrome probe (`tool/graph_zoom_probe.dart` + `tool/graph_zoom_probe.mjs`,
loopback server, OS-assigned port) re-run against this final source, 7 runs:
- pipeline graph: Material light 1280x800 1x, Material light 320x700 2x,
Cupertino dark 390x844 1x, Cupertino dark 320x700 2x;
- run graph: Material light 1280x800 1x, Material dark 320x700 2x,
Cupertino dark 390x844 1x.
Each asserted a real drag moved a node, wheel zoom grew it, Fit restored it,
Expand opened the titled full-screen canvas with the selected node still
announced selected, and Close returned to the same inline place and selection.
42 captures (initial/panned/zoomed/fitted/expanded/restored per run) were
regenerated after the last source edit and are in
`/Users/alan/.local/share/pipelines/data/artifacts/101/public/graph-zoom-captures/`.
- `dart format --output=none --set-exit-if-changed` on the changed Dart files —
0 changed; `git diff --check` — clean.
## Corrections from actual checks
- The transform's z axis must be scaled with x/y: `getMaxScaleOnAxis` otherwise
reported 1.0 for a 0.8 fit and InteractiveViewer's own pinch math used the
wrong scale. Fixed in `graphViewportMatrix`.
- Two existing measurement tests compared on-screen rectangles, which now
include the fit scale. They divide by the current scale and assert the
measured graph-space extent instead; the assertions about wrapping and
overlap are unchanged.
- Cupertino's full-screen route added its own `Cancel` leading button next to
the explicit Close; `automaticallyImplyLeading: false` leaves the one Close
action.
- `tester.drag` can lose the pre-acceptance movement to the pan slop; gesture
tests warm up past the slop and measure from the accepted transform, and the
browser probe pans with eight real pointer moves.
- The first implementation excluded the whole Cupertino button from semantics
and put the label on a sibling node: VoiceOver/TalkBack saw a labelled button
with no tap action. The exclusion now covers only the icon and
`MergeSemantics` merges the host button's action; the regression test performs
the semantics action itself, not a pointer tap.
- Material controls previously had only a tooltip as their accessible name. Both
hosts now expose one explicit label (`Fit graph to view` / `Expand graph`);
Material keeps the tooltip for pointer hover, excluded from semantics so the
name is not duplicated.
- The inline canvas used to paint one identity-transform frame before the
post-frame fit. The first layout now attaches before its child viewer exists,
and the regression test pumps exactly once.
- Expanded used to keep the small inline scale, unlike the web, which calls
`fit()` after growing the panel. It now fits its own canvas and re-clamps (or
re-fits) on resize; the inline place/selection still return unchanged on
Close.
- The expanded run canvas had no route legend; `RunGraphHeader` now travels
with it.
## Limits
- Inside an ancestor scroll view, a **vertical** drag that starts on the canvas
is claimed by the scrollable (Flutter's gesture arena gives the 18px vertical
drag the win over the 36px pan slop); horizontal drags and pinch stay with the
canvas. The graph is not inside a scrollable in either current tab. Outside
the canvas the list scrolls normally, which is the accepted behavior here.
- Opening expanded fits the graph rather than keeping the inline place (web
behavior); closing still restores the inline transform exactly.
- Web only: Android/iOS builds, device gestures and OS behavior are unverified.
- `run_graph_view.dart` remains over the 250-line aim (324 lines: measurement,
evidence and viewport composition; the legend/header and definition canvas
were split out). The new viewport files and viewport test files are all under
250 lines.
+190
View File
@@ -0,0 +1,190 @@
# R4 — recorded-visit pane
## Delivered
The Timeline tab now opens a real recorded visit. Selecting a row, or clicking a
visited stage in the Graph tab, shows that visit inside the Timeline tab:
- **Facts** — the row's exact stage/visit title, then only the fields the reply
recorded: Status, Outcome, Duration (only when both `started_at` and
`finished_at` parse and the finish is not before the start), Provider/model
(`provider / model`, or the one part recorded), Target, a recorded Verdict
(option and reason) and the visit's Diagnostic. A blank field is absent, never
`0`, `false`, `0s` or a guessed value.
- **Native sections** — Input, Output, Artifacts, Session, Definition, using the
Material segmented button or Cupertino segmented control. The strip scrolls
rather than squeezing labels at 320/2x.
- Input/Output use the run detail's existing field rendering and the exact
empty sentences `No input recorded.` / `No output recorded.`.
- Artifacts lists this visit's stage files (`visitArtifacts`, so a shared
`public/` file stays with the visit that first recorded it) and opens the
existing artifact gallery page for that visit. The page is given the whole
run and the focused visit, so it lists exactly the rows the pane lists and
keeps the run's own visit group. An empty list uses the landed per-visit
capture wording (`Artifacts · capture pending` for a running visit,
`Artifacts · capture unavailable` when the field is absent, `Artifacts ·
not recorded for this visit` only for an explicitly empty capture) and shows
the partial-capture notes when the scan was bounded.
- Session shows the recorded session identity and, when the visit exported
one, `Open <export name>`. The recorded URL is resolved by the landed
`resolveArtifactUrl` and opened through `openArtifactExternally`; a refusal
or an unresolved relative URL is reported, never silently swallowed. The
state comes from the recorded export evidence (including a repair), falls
back to the legacy `session.html` system file web audit uses, and otherwise
reports the recorded state in the web client's words: skipped, stopped,
session being created, failed with its diagnostic, or the runtime error for
a model visit with no identity. An export whose evidence is partial or
failed stays openable and says so.
- Definition embeds the landed `StageDefinitionView` for the run's own pinned
graph and stage, so the authored prompt/output/outcomes/raw source show
exactly as landed. When the reply does not declare the stage, the landed
exact sentence `This stage is not declared in this pipeline version. No
definition has been reconstructed.` is shown instead.
- **Back** — `Back to timeline` (native back arrow / Cupertino chevron) closes
the pane and restores the rows. The run header, Changes, Artifacts, Rename,
Cancel, Retry and Decide actions are untouched and stay outside the tabs.
- A different run clears the selection; an unvisited Graph node still opens
nothing.
## Files
Added:
- `app/lib/features/runs/ui/run_detail_visit.dart` — pane layout, facts, verdict
and diagnostic, Back.
- `app/lib/features/runs/ui/run_detail_visit_facts.dart` — pure step lookup,
duration/provider/model/verdict/definition facts, exact wording.
- `app/lib/features/runs/ui/run_detail_visit_session_state.dart` — recorded
session/export state: identity, repair/legacy export resolution and the
state-specific wording.
- `app/lib/features/runs/ui/run_detail_visit_sections.dart` — section enum,
adaptive strip, section body selection.
- `app/lib/features/runs/ui/run_detail_visit_artifacts.dart` — visit artifact
rows opening the existing gallery entry.
- `app/lib/features/runs/ui/run_detail_visit_session.dart` — session pointer and
safe-link export open.
- `app/lib/features/runs/ui/run_detail_visit_definition.dart` — pinned
stage-definition pane or exact missing wording.
- `app/test/features/runs/ui/run_detail_visit_support.dart`,
`run_detail_visit_test.dart`, `run_detail_visit_sections_test.dart`,
`run_detail_visit_session_test.dart`.
- `app/tool/run_detail_visit_probe.dart`, `run_detail_visit_probe.mjs`.
- `app/notes/R4-visit.md`.
Changed (minimal wiring):
- `run_detail_timeline.dart` — rows become selectable and report their index.
- `run_detail_tabs.dart` — selected visit index opens the pane; Back closes it;
Graph selection uses the latest recorded index.
- `run_detail_view.dart`, `run_detail_material.dart`,
`run_detail_cupertino.dart` — pass the configured endpoint for the session
safe link; the endpoint cast now comes from `configuredGatewayEndpoint` in
`core/transport/pipelines_client.dart`.
- `run_detail_tab_strip.dart` — `ScrollWhenOverflowing` is public and shared by
both tab strips, so the pointer-drag and minimum-width rules live once.
- `lib/features/artifacts/domain/artifact_groups.dart` —
`visitArtifactGroup` returns the gallery group of exactly one visit from the
whole run.
- `lib/features/artifacts/ui/artifact_gallery_page.dart`,
`artifact_gallery_action.dart` — an optional focused visit limits the page to
that visit's attributed group and summary; the run-level gallery is unchanged.
- `run_detail_graph_tab_test.dart` — the stage-click expectation now asserts
the opened pane and its facts (previous test asserted the row highlight).
- `run_detail_graph_support.dart` — optional light/dark theme for 2x checks and
an empty-tree reset so one test can pump a second run.
- `run_detail_graph_probe.mjs` — the stage-click check now expects the pane and
its sections; re-run once to keep the existing probe green.
The artifact changes are the two focused-visit additions above: the run-level
gallery, its viewer and its domain grouping are otherwise untouched. No
`graph/`, `pipelines/`, `chat/`, `application/`, `schedules/`, `templates/` or
backend file was edited.
## Checks run
From `app/` with Flutter 3.44.6:
- `flutter analyze` — no issues.
- `flutter test` — **1014 tests passed** (full suite).
- `flutter build web` — built `build/web`.
- Probe builds:
`flutter build web --target tool/run_detail_visit_probe.dart --output build/probe-run-detail-visit`
and the existing `run_detail_graph_probe.dart` build both succeeded.
- `node tool/run_detail_visit_probe.mjs` — passed for Material and Cupertino at
1280×900/1x dark and 320×568/2x dark: 9/9 checks and 8 captures each.
- `node tool/run_detail_graph_probe.mjs` — Material 1280×900/1x dark re-run
passed with the pane expectation.
## Browser evidence
Probe drives the real `RunDetailView` over a server-shaped fake gateway (plan
visit with provider/model, both timestamps, verdict, diagnostic, input/output,
artifacts, session id + `session.html` export; a sparse build visit with no
timestamps/provider/session). Checks: Graph stage click opens `plan · visit 1`
with all five sections; Definition shows the pinned "Draft the plan." source;
Session shows `sess-1` and `Open session.html`; Artifacts lists `plan.csv`; the
row opens a gallery whose summary says `Artifacts · 1 recorded`, whose only
group is `plan · visit 1` and whose only row is `plan.csv` (the `session.html`
evidence file is absent); Back restores the rows; the sparse visit has no
Duration or Provider/model and its Artifacts tab says
`Artifacts · capture unavailable`.
Under `/Users/alan/.local/share/pipelines/data/artifacts/95/public/r4-visit-fix/`:
| Host | Viewport | Captures |
| --- | --- | --- |
| Material | 1280×900, dark, 1x | `run-detail-visit-material-dark-1x-1280x900-{visit-pane,definition,session,artifacts,timeline-rows,sparse-visit,sparse-artifacts,visit-gallery}.png` |
| Material | 320×568, dark, 2x | `run-detail-visit-material-dark-2x-320x568-{visit-pane,definition,session,artifacts,timeline-rows,sparse-visit,sparse-artifacts,visit-gallery}.png` |
| Cupertino | 1280×900, dark, 1x | `run-detail-visit-cupertino-dark-1x-1280x900-{visit-pane,definition,session,artifacts,timeline-rows,sparse-visit,sparse-artifacts,visit-gallery}.png` |
| Cupertino | 320×568, dark, 2x | `run-detail-visit-cupertino-dark-2x-320x568-{visit-pane,definition,session,artifacts,timeline-rows,sparse-visit,sparse-artifacts,visit-gallery}.png` |
Evidence JSON: `evidence-{material,cupertino}-{1x-1280x900,2x-320x568}.json`;
each records 9 checks, all `true`, and the 8 captures above (32 PNGs).
At 320/2x the run detail keeps its own 240px minimum tab body, so the visit
facts area is a short scroll region; all facts remain reachable by scrolling and
the section strip/body stay usable. No overflow or exception is reported.
## Review fixes (visit 2)
- Artifact empty states now use the landed per-visit capture wording instead of
one "nothing recorded" sentence; tests cover absent, explicitly empty and
running captures.
- The artifact row opens the gallery focused on the same visit with the whole
run as context, so a shared `public/` file is not re-attributed. Tests cover
two visits of one stage plus a repeated public file, asserting the pane and
the opened page both exclude it.
- Session resolution handles a repair and the legacy `session.html`, reports the
evidence status/diagnostic when the file is missing, and uses the web client's
state-specific sentences. Tests cover a legacy export, a running model visit
and a failed one.
- Advisory cleanups: shared `ScrollWhenOverflowing`, one timeline lookup for the
latest visit, one endpoint helper, corrected stale selection comments and the
added refusal test.
## Known gaps
- The pane title and timeline rows still use the global recorded `sequence`
(`plan · visit 5`), while the gallery group uses the per-stage visit number
(`plan · visit 2`). This predates this pane; aligning the rows and pane would
change the timeline titles and is recorded here rather than done.
- At 320/2x the existing 240px minimum tab body leaves the facts area a short
scroll region; all facts are reachable by scrolling and no overflow occurs.
## Not done / unverified
- No commit, push, merge or deployment (this stage forbids it; the input's
“commit the candidate” was not performed).
- Web only. Android/iOS builds, layout and device behavior were not run; the
source stays portable (Material/Cupertino only, no platform-only imports).
- No backend changes. The pane reads only fields the existing `get_run` reply
already carries; nothing new was requested from the server.
## Manager completion after the Code deadline
The run had succeeded at Code once, been rejected at Review, and its retry hit the
30-minute stage deadline. The retained tree is complete: 280 runs/artifacts tests
pass and analysis is clean. Merged directly. The only cross-feature edit is an
11-line `configuredGatewayEndpoint` helper in the transport so relative recorded
artifact/session urls resolve against the configured origin without repeating a
cast in the UI.
+84
View File
@@ -0,0 +1,84 @@
# Runs-list Needs-you bell wiring
The landed attention model and native bell/sheet are now registered in the real
Runs destination. The bell sits in the Runs list heading area and reads the same
`list_runs` rows the screen already loaded; it issues no attention request and
adds no poll.
## Code
- `lib/features/attention/runtime/attention_store.dart` — the injectable
`AttentionStore` seam, a `SharedPreferences` implementation under
`pipelines.next.attention.v1` (only that key), and an in-memory implementation
for tests/fixtures. Reads and writes are total: an unavailable plugin or full
store returns null/false instead of throwing.
- `lib/features/attention/runtime/attention_controller.dart` — derives today's
ordered entries from rows plus the persisted dismissal set, loads asynchronously,
and folds pushed `run_event` frames with the runs feature's existing
`foldRunEvent`. The attention transition detector is seeded by authoritative
list reads, reseeded on reconnect, and keeps emitted keys, so a failure/wait
that appears while the screen is open reaches the bell once while a reconnect
never replays it. Dismissals update memory and notify before the store write, so
a slow or failed write cannot block the sheet. Pushed `title`/`name`/`diagnostic`
are retained because the lifecycle fold does not carry the row's attention text.
- `lib/features/attention/ui/needs_you_runs_heading.dart` — owns the controller
and shared-frame subscription for the destination, passes the dismissed list to
the landed `NeedsYouBell`, and opens the existing run through `RunsList`'s
`onSelected` (the existing run route).
- `lib/features/runs/ui/runs_list.dart` — small heading insert plus injectable
store/clock and reconnect token; no other destination is touched.
- `lib/features/runs/screen.dart` — forwards the reconnect token and the test
seam to the list.
- `lib/features/runs/ui/runs_filters.dart` — the existing filter controls moved
out of the list file unchanged for Material, with the Cupertino strip made
horizontally scrollable. At 320 logical px / 2x the old wrapping strip alone
made the Runs `Column` overflow before the attention change; one native row is
the same narrow-toolbar shape the browser uses and keeps every control
reachable. File split keeps `runs_list.dart` at 159 lines.
The bell keeps the native `NeedsYouBell` semantics (`Notifications` /
`Notifications, N needing attention`), shows no badge when empty, and uses the
already-landed Material bottom sheet / Cupertino popup. Failed rows dismiss before
opening; Decision rows open without dismissing; Clear all uses the snapshot the
sheet captured when it opened. Dismissals survive a screen rebuild through the
same store.
## Verification
- `flutter test` — 966 tests passed.
- Focused `flutter test test/features/attention/runtime` — 20 tests passed:
rows -> entries, export waits and yesterday excluded, dismissal persistence
across a rebuilt controller, slow write does not block, failed read/write is
harmless, clear-all snapshot leaves a later arrival, live failed frame adds an
entry, a frame can create a new run summary, reconnect keeps dismissals and
emitted keys, empty state keeps the bell and hides its badge, both hosts at
320 logical px / 2x with no list/sheet overflow, and the SharedPreferences key
ownership test.
- `flutter analyze` — no issues.
- `flutter build web` — normal `lib/main.dart` built successfully.
- Real browser (`tool/attention_wiring_probe.mjs`, isolated `startFixture`, two
fresh app boots, one shared socket each): four captures in
`public/attention-wiring/` at 320 logical px / 2x:
`attention-runs-cupertino-bell-320x2.png`,
`attention-runs-cupertino-sheet-320x2.png`,
`attention-runs-material-bell-320x2.png`,
`attention-runs-material-sheet-320x2.png`.
The drive asserted the accessible count `Notifications, 2 needing attention`,
both void rows absent, the `Dismiss ...` names and Clear all, and viewed both
PNGs. The fixture list held a running row and an `export_pending_sequence`
wait that did not enter the sheet; the fixture served one connection and no
`get_run`/attention request (`listRuns: 4` across the two boots, the existing
screen loads). Both bell and sheet captures were inspected.
`tool/runs_probe_server.mjs` now accepts an optional `runs` list so this fixture
can use current-day timestamps without changing the existing runs probe's
default data. No legacy driver was edited.
## Not done / limits
- No commit, push, merge, deployment, preview cutover or service restart.
- Notification permission/tray delivery remains separate work; the transition
ledger is exposed for that wiring but no permission is requested here.
- Android/iOS builds and real devices were not run; web only, as required.
- The fixture is isolated (loopback, its own browser profile) and does not touch
operator runs, chats, storage or production credentials.