Merge branch 'main' into flutter/d1-diff-viewer

This commit is contained in:
2026-10-21 18:26:55 +01:00
238 changed files with 30326 additions and 71 deletions
+101
View File
@@ -0,0 +1,101 @@
# A1a — artifact records, capture facts, grouping, kinds and safe urls
## What changed
New nonvisual `artifacts` domain slice. Every file is new; no existing file was
edited. Nothing under `lib/main.dart`, `lib/shell/`, another feature, `pubspec.*`,
`web/`, the Go server or `android/` was touched. No dependency was added and no
network/transport code was written.
| File | Lines | Responsibility |
| --- | --- | --- |
| `lib/features/artifacts/domain/artifact_record.dart` | 85 | One recorded artifact: name, url, content type, size and deeply read-only `raw`; retired `session.md` and system names |
| `lib/features/artifacts/domain/artifact_capture.dart` | 63 | Per-step capture availability (`unavailable`/`recorded`), recorded files, skipped and truncated counts |
| `lib/features/artifacts/domain/artifact_selection.dart` | 67 | Record parsing, retired/system/repair filtering (`presented`, `stage`, `system`) |
| `lib/features/artifacts/domain/artifact_groups.dart` | 109 | Group stage artifacts by stage and recorded visit; shared `public/` attribution; per-visit list |
| `lib/features/artifacts/domain/artifact_kind.dart` | 225 | MIME/extension kind vocabulary, labels, markdown/viewer predicates, `humanBytes` |
| `lib/features/artifacts/domain/artifact_summary.dart` | 78 | Run/visit summary and empty wording, partial-capture flag and notes |
| `lib/features/artifacts/domain/gallery_navigation.dart` | 76 | Filtered viewer page order, stable identities, previous/next clamp, position label |
| `lib/features/artifacts/domain/artifact_url.dart` | 78 | Safe http(s) resolution against the configured endpoint and cross-origin marking |
| `test/features/artifacts/domain/artifact_fixtures.dart` | 44 | Local step/artifact fixtures; no fake gateway or socket |
| `test/features/artifacts/domain/artifact_capture_test.dart` | 241 | Unavailable/null/empty/partial capture facts and exact wording |
| `test/features/artifacts/domain/artifact_groups_test.dart` | 308 | Visits, identity, retired/utility files, public attribution, empty states |
| `test/features/artifacts/domain/artifact_selection_test.dart` | 154 | Field preservation, deep immutability, filtering, duplicates |
| `test/features/artifacts/domain/artifact_kind_test.dart` | 110 | Known/unknown MIME and extension classification, markdown/viewer gates, bytes |
| `test/features/artifacts/domain/gallery_navigation_test.dart` | 197 | Filtered order, duplicate urls/names, url-less identities, paging clamp, label |
| `test/features/artifacts/domain/artifact_url_test.dart` | 148 | Relative/absolute urls, wss/https, IPv6, encoded path/query, schemes, credentials, cross-origin |
## Behaviour (from `web/src/artifacts.js` and `artifactNavigation.js`)
- **Record facts are verbatim.** `ArtifactRecord.fromJson` reads `name`, `url`,
`content_type`, `size_bytes` and keeps every other server field in a deep
unmodifiable `raw`. A missing url stays `''`; nothing is derived from the name.
Two records with the same name stay distinct because identity is the recorded
url (or a visit-scoped fallback in the viewer).
- **Capture availability is a recorded fact.** An absent, null or non-list
`artifacts` field is `unavailable`; an explicit empty list is a recorded empty
capture. `artifacts_skipped`/`artifacts_truncated` are preserved as counts and
mark a partial capture. Unavailable capture never degrades to "no artifacts"
or "not recorded": the run header says `Artifacts · capture unavailable`
instead of `No artifacts recorded for this run.`, which is the task's explicit
requirement and the one deliberate wording extension beyond the web client.
- **Grouping and identity.** `artifactGroups` keeps first-appearance stage order,
orders each stage's visits by sequence (recorded order on ties), and uses
`displayVisit` from the existing graph domain (`control.visit` when positive,
else position + 1). A step with no presented stage artifact yields no group, so
unavailable/empty captures and utility-only visits never fabricate a visit.
Shared `public/` files are attributed to the first recorded visit; repeated
non-public names in later visits remain separate artifacts.
- **Retired and utility files.** `session.md` is hidden everywhere; `session.html`,
`input.md`, `memory.md`, `output.md` remain system evidence and are excluded
from stage output. Repaired session exports named by `session_export_repairs`
are system evidence too.
- **Kinds.** Image/video come from the content type; audio, PDF, JSON, archive,
spreadsheet, log, code, document then match normalised MIME or extension;
unknown values are `other`/`File`. `isMarkdownArtifact`/`isViewerArtifact` keep
logs, source, CSV and HTML out of the in-app viewer while images, videos and
md/markdown/txt pages enter it.
- **Navigation.** `pagedArtifacts` filters group by group in recorded order;
`viewerIndexByUrl` maps the first occurrence of each url; url-less pages use a
visit-scoped identity; `pagedIndex` clamps with no wrap; the position label
trims content-type parameters and falls back to `artifact`.
- **Safe urls.** Server-relative paths resolve against the configured endpoint's
http(s) origin (endpoint path/query dropped, `wss` → `https`, IPv6 brackets and
percent-encoding kept). Absolute http(s) urls are preserved. Output is always
http(s): blank, protocol-relative, backslash-relative, hostless, credentialed,
malformed and non-http(s) urls return null. A url whose origin differs from the
configured origin is marked `external`, so a future authenticated fetch can
refuse to send cookies or headers; a same-origin url stays internal.
## Review and quality fixes in this visit
- `flutter analyze` reported four infos in this slice; all fixed: block braces in
`artifact_summary.dart` and null-aware map entries (`'key': ?value`) in the
test fixtures. Analyze is now clean for the whole app.
- `dart format` found one unformatted test file; all 15 files are now formatted.
- Semantics were re-read against `web/src/artifacts.js` (`presentedArtifacts`,
`stageArtifacts`, `systemArtifacts`, `artifactKind`, `pagedArtifacts`,
`viewerIndexByUrl`, `pagedIndex`, `displayVisit`) and `artifactNavigation.js`.
No other concrete deviation was found, so no behaviour was rewritten.
## Checks actually run
```
flutter test test/features/artifacts/domain # 60 passed
flutter test test/features/graph/domain # 41 passed (stage_visits reuse)
flutter analyze # No issues found! (0.9s)
dart format lib/features/artifacts test/features/artifacts # clean, 15 files
grep trailing whitespace # none
```
## Honest limits
- No gallery screen, viewer, sharing, fetching or transport helper exists in this
slice, so there is no rendered change and no browser capture. The gallery and
viewer are separate future slices.
- No live server, socket, artifact download or real run data was used; tests are
local fixtures and pure functions only.
- Mobile is unverified: no Android/iOS build, emulator, ADB or device was used.
- **Committed by the Land stage** as `ff0f812` on `flutter/a1-data` and merged
with `main` in `a303368`; the checks above were re-run on the merged candidate.
This stage did not merge into `main`, push or deploy.
+5
View File
@@ -0,0 +1,5 @@
# C1 — Chat sessions and repository adapter
The sessions browser now requests server directory and backend catalogs before showing the create dialog, exposes both selectors and model-default guidance, and reports unavailable catalog capabilities instead of silently substituting values. Catalog envelope regressions are covered. Closed starred rows no longer appear twice; directory headings appear only when grouping multiple directories; empty and search-no-match states are distinct.
Verification: focused chat tests, `flutter analyze`, fixture `flutter build web -t tool/chat_sessions_probe_entry.dart`, `git diff --check`, and an isolated Chrome DevTools probe passed. Captures: `/private/var/folders/jp/q0qvjyg54fl_c5vhhk1ylz2m0000gn/T/opencode/chat-sessions-capture/chat-sessions-phone.png` and `chat-sessions-create-dialog.png` (plus desktop). The probe enabled semantics, matched the exact “New chat” label, and verified the rendered body changed to show server catalog controls. Cupertino-specific controls, controller/row/dialog decomposition under 250 lines, and wider out-of-order reply UI regression coverage remain incomplete; this is not a parity-complete delivery. Mobile builds were not performed. The fixture entry point is `tool/chat_sessions_probe_entry.dart`.
+163
View File
@@ -0,0 +1,163 @@
# C1b — Chat session browser completion
The 406-line sessions screen is split into a controller, adaptive primitives,
session groups/rows, action dialogs, a rename dialog and a create dialog. The
server directory and backend catalogs, the instructions field, the closed/star
grouping and the distinct empty/no-match states are retained. No repository,
domain, shell or pubspec file changed.
The UI review's must-fix is addressed: Cupertino no-match, empty and error
messages are no longer forced through `CupertinoListTile`'s one-line title. They
use a wrapping grouped card with `Clear search`/`Retry` as separate buttons. The
same turn also fixed the related behavioural findings: a failed initial load no
longer also shows the empty-server message, creating a chat opens it without
waiting for the list refresh, blank rename disables Save, and row action labels
name their session (adding the id when titles repeat).
The second UI review's must-fixes are also addressed:
- `ChatCupertinoMessage` now sets `DefaultTextStyle.merge` from
`CupertinoTheme.of(context).textTheme.textStyle`. Mounted under a bare
`MaterialApp` (the screen's iOS/macOS path, no `Material` ancestor), its text
previously inherited MaterialApp's intentional "missing Material" fallback
style (48px red monospace with a double yellow underline). The card now
renders as ordinary Cupertino body text in that configuration.
- The Material rename dialog sets `helperMaxLines: 2`, so "This name is shared
with every device." wraps instead of being ellipsised at 2.0x text scale.
## Source layout
All paths under `lib/features/chat/ui/sessions/` (1,584 lines total):
| File | Lines | Responsibility |
| --- | ---: | --- |
| `chat_sessions_screen.dart` | 176 | Screen composition, toolbar/FAB, controller wiring |
| `chat_sessions_controller.dart` | 111 | List state, generation-guarded refresh, row actions, create |
| `chat_sessions_body.dart` | 97 | Filtering, starred/open/closed sections, duplicate titles |
| `session_list_material.dart` | 140 | Material list sections and rows |
| `session_list_cupertino.dart` | 134 | Cupertino list sections and rows |
| `session_row_style.dart` | 51 | Shared subtitle, icons and action labels |
| `session_actions.dart` | 161 | Star control, actions menu/sheet, close confirmation |
| `rename_chat_dialog.dart` | 107 | Rename dialog and its blank-name guard |
| `create_chat_dialog.dart` | 222 | Create state, draft fields, submit |
| `chat_create_fields.dart` | 185 | Catalog loading/error/retry and directory/backend pickers |
| `chat_adaptive.dart` | 200 | Style detection, bar actions, search, wrapping message card, loading |
`chatControlsStyleOf` chooses Cupertino for a Cupertino app (no `MaterialApp`
ancestor) and for iOS/macOS Material themes; Material otherwise. The Cupertino
branch uses only Cupertino controls (`CupertinoPageScaffold`,
`CupertinoNavigationBar`, `CupertinoSearchTextField`, `CupertinoListSection`/
`CupertinoListTile`, `CupertinoAlertDialog`, `CupertinoActionSheet`,
`CupertinoTextField`, `CupertinoActivityIndicator`). It therefore has no
Material ancestor dependency. The `SafeArea` in that branch keeps the search
field below the translucent navigation bar (the first browser capture caught
this overlap).
Behavior:
- `chat_sessions`, `chat_directories`, `chat_backends` and `chat_create` use the
existing repository envelopes; no fallback directory or backend is invented.
- A catalog failure keeps the dialog open, shows the server reason with Retry,
and retains the typed name and instructions.
- Closed starred rows appear once, only under Closed.
- Directory headings appear only when a section has more than one directory.
- Empty and search-no-match states stay distinct; "Clear search" restores the
list. In the Cupertino branch the message and its action are a wrapping
`ChatCupertinoMessage` card, and a failed load uses the same card for the
server reason with Retry. The failed initial load no longer also renders the
empty-server message. The card supplies a Cupertino text style, so it renders
normally when the Cupertino branch is mounted under the app's bare
`MaterialApp` root instead of a `Material`/`CupertinoApp`.
- Creating a chat opens it as soon as `chat_create` replies; the list refresh
continues in the background, so a slow listing cannot look like a failed
create.
- Star, rename, close (with the web's confirmation wording), reopen and row
opening keep their existing request shapes. Save is disabled while the
rename name is blank, matching the web dialog.
- Row action labels are `Chat actions for {title}`, adding `({id})` when two
visible sessions share a title, matching the web's accessible label.
## Checks (actual)
- `flutter test test/features/chat/ui/sessions`: 24 widget tests, all passed.
They cover Material and Cupertino list branches, both create branches, the
delayed catalog failure with draft retention and Retry, rename/close/reopen/
star, blank-name Save disabling in both branches, the close confirmation,
catalog-empty state, stale refresh ordering, dispose while a reply is
pending, opening a created chat before the refresh completes, Cupertino
no-match/error wrapping (including 2x text scale), separate Clear search
semantics, duplicate-title action labels, the Cupertino message card under a
bare `MaterialApp` iOS theme (empty, no-match, long error style), and the
Material rename helper at 2x text scale. The three MaterialApp-hosted tests
fail when the `DefaultTextStyle` merge is removed (verified).
- `flutter test`: 46 tests passed.
- `flutter analyze`: no issues.
- `flutter build web`: built `lib/main.dart` successfully.
- Fixture probe built for both variants and run in real headless Chrome through
the local loopback server in `tool/chat_sessions_probe.mjs`. Each run loaded
the list, opened the create dialog, confirmed the rendered catalog controls,
opened a row action menu/sheet, and captured PNGs. The probe now clicks the
per-session action label and requires `Rename…` in the action labels instead
of accepting the dismiss barrier. Material and Cupertino PNGs were inspected.
Captures from this turn's fix (shared with later stages under
`public/c1b-fix/`):
- `/Users/alan/.local/share/pipelines/data/artifacts/42/public/c1b-fix/cupertino-fix-search-no-match.png` — light, 390x844, long query wraps in full with Clear search on its own line.
- `.../cupertino-fix-search-no-match-dark.png` — same state in dark appearance.
- `.../cupertino-fix-load-error.png` — long server reason wraps; Retry is separate and the empty-server message is absent.
- `.../cupertino-fix-list-phone.png` and `.../material-fix-actions.png` — probe list and actions after the label change.
Probe commands (run from `app/`):
```sh
flutter build web -t tool/chat_sessions_probe_entry.dart \
--dart-define=CHAT_PROBE_STYLE=material --output build/probe-material-fix
PROBE_WEB_ROOT="$PWD/build/probe-material-fix" PROBE_VARIANT=material \
OPENCODE_ARTIFACT_DIR=/private/var/folders/jp/q0qvjyg54fl_c5vhhk1ylz2m0000gn/T/opencode/chat-sessions-capture \
node tool/chat_sessions_probe.mjs
# repeat with CHAT_PROBE_STYLE=cupertino and build/probe-cupertino-fix
```
Captures for the second review's fixes (same `public/c1b-fix/` folder, real
headless Chrome at 390x844 through a temporary fixture entry that was deleted
afterwards; the shipped probe entry was not changed):
- `platform-default-empty-phone.png` — `MaterialApp` default theme (macOS →
Cupertino branch), empty server. The message is ordinary body text.
- `platform-default-search-no-match-phone.png` — long query; message wraps and
`Clear search` is a separate control.
- `platform-default-error-phone.png` — long server reason wraps; `Retry` is
separate and no empty-server message appears.
- `material-scale2-rename-phone.png` — Material rename dialog at 2.0x text
scale; the helper sentence wraps onto two lines in full.
## Not changed in this turn
These review notes remain advisory and were left alone because they predate
C1b or are native behaviour:
- The Material FAB can still cover the last row's star/actions when the list
exactly fills a phone viewport. Same as the base screen.
- Raw exception text (`Bad state: …`, `Exception: …`) is still shown to the
operator; wording belongs to a separate error-presentation change.
- Cupertino row titles/subtitles still truncate to one line (standard
`CupertinoListTile` behaviour). The no-match/error messages no longer do.
- The Cupertino-under-MaterialApp probe still takes its accent from the ambient
`ThemeData`. No theme override was added.
## Remaining gaps
- Mobile is unverified: no Android/iOS builds, devices or installs were run.
Source is portable but only web was exercised.
- Browser evidence uses the fixture gateway, not an authenticated live server.
No real chat was created, renamed, closed or starred in the browser; those
request paths are covered by widget tests.
- The Cupertino list/actions probes use the local Chrome dark appearance; the
no-match fix was captured in both light and dark. The long-error capture came
from a temporary private fixture entry that was deleted afterwards.
- The create dialog still omits the web's default instruction text and its
backend segmented control; it preserves the existing name/directory/backend/
instructions request fields.
- This stage did not commit. The changes remain an uncommitted working-tree
candidate for the next stage.
+17
View File
@@ -0,0 +1,17 @@
# F4 chat foundation
Non-visual chat foundations for the UI lane, using the shared `ApiGateway` and no socket ownership.
## Imports and API
- `package:pipelines_app/features/chat/domain/chat_sessions.dart`: `chatSessionTitle`, `filterChatSessions`, `groupChatSessions`, `chatSessionActivity`, and `chatUsageSnapshot`.
- `package:pipelines_app/features/chat/domain/chat_transcript.dart`: `mergeChatHistory`, `transcriptRows`, `reconcileChatUser`, `applyChatEvent`, `QueuedChatSend`, and `ChatSendQueue`.
- `package:pipelines_app/features/chat/data/chat_repository.dart`: `ChatRepository(gateway)`; exposes sessions, directories, history, subscribe, create/rename/star/close/reopen, prompt/interrupt, form answer, permission reply, models/shells and model selection. `gateway.frames` remains the UI/controller's unsolicited event source.
History uses `chat_history.next_cursor` verbatim, falls back to legacy `chat_messages`, and replaces duplicate authoritative messages while preserving order. `transcriptRows` preserves unknown part maps. Live fold supports user echoes, text/reasoning deltas, tool state snapshots, and step activity; UI should retain its richer thread/timing state as needed. Queue operation IDs are stable across retry objects and deduplicated within each session. Usage values remain unavailable unless reported and valid.
Wire envelopes are asserted in `test/features/chat/chat_foundation_test.dart`. Current backend has no `chat_forms` or `chat_permissions` list command; forms and permissions arrive as live events and are answered through `chat_answer` / `chat_reply`.
## Verification
`/Users/alan/development/flutter/bin/flutter test test/features/chat` passed. Nonvisual foundation: UI/browser review and captures are not applicable at this stage. Web is the only permitted target; Android/iOS remain unverified.
+119
View File
@@ -0,0 +1,119 @@
# I1 — live Runs destination, routes and resilient connection
## Change
- `lib/application/` composes the real app separately from `main.dart`:
`bootstrap.dart` resolves the endpoint and starts the composition,
`pipelines_app.dart` owns one `AppSession` and one `Router`,
`runs_destination.dart` frames the Runs destination, and `app.dart` keeps the
injectable `MyApp` shell for existing widget tests. `main.dart` exports `MyApp`
and calls `runPipelinesApp()`.
- Web endpoint: the page origin from `Uri.base` over `ws(s)` at `/connect`, so
the same server that served the bundle is the live server. Native builds use
only the explicit `--dart-define=PIPELINES_SERVER_URL=ws://host:port/connect`
value; there is no baked host or fallback endpoint.
- **Routes/deep links (I1's second half):** the app now uses Flutter's `Router`
with a total `AppRoute` parser (`/pipelines`, `/runs`, `/runs/:id`, `/chat`,
`/settings`) and the path URL strategy (`flutter_web_plugins` declared as a
direct dependency). `/runs/1` opens that run directly, tab and run selection
push browser history, Back/Forward move between them, and a malformed or
unknown path renders Pipelines and is corrected to `/pipelines`. Non-web
platforms keep the same routes through the Router without an address bar.
A single-page `Navigator` inside the Router delegate supplies the Overlay
native controls need while keeping the shell state across route changes.
- **Reconnects keep the destination:** before the first successful connection
the destination is a full connection screen. After that the loaded Runs screen
stays mounted through drops: a compact status banner reports `Reconnecting to
Pipelines…` or `Not live — Pipelines server unavailable.` with a Retry action,
and `connectionEpoch` triggers an in-place list/detail refresh. The open run,
its scroll position and Back all survive the reconnect; the screen is not
remounted and the selection is not reset.
- **Honest connection copy:** the full gate no longer prints a raw transport
exception. A failed first attempt stays `Pipelines server unavailable` with
`Retrying automatically…` while the client retries instead of flickering to
`Connecting…` on every attempt. Only the first attempt shows `Connecting to
Pipelines…`.
- **Live-watch status:** `AppSession` now observes the send-only `subscribe`
ack/error. A server refusal is reported as `Not live — run updates are
unavailable.` with the server's own refusal reason and a Retry that repeats the
watch; silence (servers that never ack, like the fixture) is left pending
rather than guessed as "not live".
- `AppSession` owns the single shared `PipelinesClient` and its state stream. It
sends `subscribe` with `{workspace: ''}` on every connected transition and
`unsubscribe` on stop/dispose.
- `RunsScreen` consumes `controller.selectedRunId` as the only selection source;
a route change, an initial run, a pending/failed detail and Back all navigate
the same path. Removed the nested `CupertinoPageScaffold`/`CupertinoNavigationBar`;
the shell owns the single native bar.
- `RunDetailView` keeps Back available while the detail is pending as well as on
failure. The detail's back row and the pending/error action now read
`Back to list` (Cupertino's compact row reads `Back`), matching web's
accessible name instead of the ambiguous `Runs`.
- Cupertino-host detection is centralized in `lib/ui/adaptive/host.dart` and used
by the destination, detail and runs list instead of three different checks.
- Inherited web build defect: `run_models.dart` used `0x7fffffffffffffff`
sentinels, which dart2js cannot represent. Replaced them with the `DateTime`
maximum millisecond value (`8640000000000000`), also an exact JavaScript
number; sort behavior is unchanged.
## Checks
- `flutter test`: **86 passed** (12 new since the previous visit; the prior suite
plus route, reconnect-retention, subscribe-status and composition coverage).
- `flutter analyze`: **no issues**.
- `flutter build web` (normal `lib/main.dart`): **succeeded**.
- `dart format --output=none --set-exit-if-changed lib test tool`: clean.
- `git diff --check`: clean.
## Browser acceptance
`tool/runs_probe.mjs` ran real headless Chrome against the isolated loopback
fixture (`tool/runs_probe_server.mjs`) with a same-origin `/connect` WebSocket.
HTML MIME is checked before launch; body assertions use Flutter semantics and
Tesseract OCR of canvas-rendered text. The probe now also drives:
- `Runs` tab → URL `/runs`; run row → `/runs/1`; browser Back → list at
`/runs`; browser Forward → detail at `/runs/1`.
- a direct `/runs/1` load opens the detail and leaves the address bar there.
- `/fixture/refuse` drops the socket and rejects upgrades: the open detail stays
visible, the banner reads `Reconnecting to Pipelines…`, no raw
`WebSocketException`/`Failed to connect` text is rendered, and the URL stays
`/runs/1`.
- accepting again plus Retry restores the same detail without a remount
(`subscribed`, `listRuns` and `getRun` all increase on the fixture).
- a fresh load while upgrades are refused shows the friendly
`Pipelines server unavailable` gate with no raw exception and does not flicker
back to `Connecting…`; Retry recovers the list.
Probe result: `ok: true`, `subscribed: 4`, `listRuns: 5`, `getRun: 7`,
`dropped: 2`, `live: true`. Captures are in
`/Users/alan/.local/share/pipelines/data/artifacts/50/public/i1-fixes/`
(18 PNGs), including:
- `i1-runs-phone-browser-back-list.png`
- `i1-runs-phone-browser-forward-detail.png`
- `i1-deeplink-run-1-phone.png`
- `i1-reconnect-detail-retained-phone.png`
- `i1-reconnect-detail-restored-phone.png`
- `i1-gate-unavailable-friendly-phone.png`
- `i1-gate-recovered-list-phone.png`
- `i1-material-deeplink-run-1-phone.png` — a Linux user-agent override selects
the Material host; the same deep link renders Material controls with the
`Back to list` action.
The existing list/detail/pending/error/input/output/metrics captures were also
regenerated. No page exceptions were logged in the final probe run.
## Limits
- Read-only live authenticated smoke through the manager preview was not
performed: `http://127.0.0.1:8096/` requires auth. No credentials were
available without reading secrets. The preview was not restarted or replaced.
- Mobile builds/devices were not run; mobile is unverified. The shared Router
and single-page Navigator are used on all targets but only web was exercised.
- The fixture does not ack `subscribe` (by design), so the "live" ack path is
covered by widget tests; the refusal banner is covered by tests and the gate
by browser evidence.
- No real run was modified. No commit, push or deployment was made.
- Adding `flutter_web_plugins` to `pubspec.yaml` is the one dependency change;
it is required for path-style routes on web.
+130
View File
@@ -0,0 +1,130 @@
# N1 Settings
The Settings destination for the Flutter client: server connection and the
server-side workspace, in native Material controls and Cupertino controls on iOS.
## Files
- `lib/features/settings/settings_screen.dart` — `SettingsScreen`.
- `lib/features/settings/settings_controller.dart` — draft/validation, shared
client actions, ping-on-connected, workspace persistence, dispose ownership.
- `lib/features/settings/settings_store.dart` — `SettingsStore`,
`SharedPreferencesSettingsStore`, `MemorySettingsStore`.
- `lib/features/settings/settings_copy.dart` — the web/Android words, workspace
validation, connection-card lines.
- `lib/features/settings/default_endpoint.dart` — same-origin web default.
- `lib/features/settings/settings_controls.dart`, `settings_sections.dart`,
`settings_trust_warning.dart`, `settings_layout.dart`, `settings_keys.dart`.
- `lib/features/settings/settings.dart` — public barrel for manager registration.
- `test/features/settings/*` — copy, persistence, controller and widget tests.
- `tool/settings_probe.dart`, `tool/settings_probe_server.dart`,
`tool/settings_probe_capture.dart` — isolated browser fixture/capture entry.
## Manager registration
```dart
import 'package:pipelines_app/features/settings/settings.dart';
SettingsScreen(client: sharedPipelinesClient)
// optional: initialEndpoint: Uri?, store: SettingsStore?, ping: PingCallback?
```
`SettingsScreen` takes the shell's single `PipelinesClient`. It subscribes to
`client.states`, sends `ping` once per connected transition (plus once when the
screen opens against an already-connected client), and offers Connect /
Disconnect / Reconnect. It never calls `client.dispose()` and never opens a
connection on construction, so registering/rebuilding the screen cannot start a
second socket or tear down another feature's connection.
While connected it shows `Server build {version} ({commit})` and
`Server time {time}` from the ping reply. Until that reply arrives the card says
`Loading server details…`, so a request in flight is never reported as an
unavailable value. Only a completed reply that omits a field renders `Server
build unavailable` / `Server time unavailable`; a failed ping renders one
explicit `Server details unavailable: …` line instead of repeating both
"unavailable" lines. No zero or stale value is substituted. Disconnect and
reconnect clear the previous server's details.
Connection card copy and state lines follow `web/src/settings.js` and
`SettingsScreen.kt`: `Not connected`, `Connecting (attempt N)…`, `Connected`,
`Disconnected` + reason + `Retrying with backoff…`, plus the trusted-LAN/VPN
warning. A dropped socket's attempt/backoff state comes from the transport.
Workspace validation is the web rule: blank is untouched (no error), a relative
path is rejected, Save is enabled only for a trimmed absolute path. The saved
line is `Saved workspace: /path` or `Saved workspace: (none)`, and the helper
states that the path is an absolute directory on the execution server, not the
phone's storage. Save failures keep the previous saved value and say so.
## Persistence
`shared_preferences` keys are owned by this feature:
- `pipelines.next.serverUrl.v1`
- `pipelines.next.workspace.v1`
No legacy Android/web key (`server_url`, `workspace`,
`pipelines.web.serverUrl.v2`, `pipelines.web.workspace.v1`, notification keys)
is read, migrated or written. The endpoint is validated and persisted before
`client.connect` is attempted, matching the web's write-before-connect
behaviour; a value that fails to connect stays stored. When the store write
itself fails, the screen still connects and says the value applies to this
session only. Credentials in a URL are rejected before any write or socket.
Only those two strings are stored; nothing else.
The web `shared_preferences` implementation may namespace its keys internally;
the logical keys above are the independent feature keys and tests assert the
legacy keys stay untouched.
## Web default endpoint
`defaultServerUrl()` returns `''` on native builds. On web it derives
`ws(s)://<page host[:port]>/connect` from `Uri.base` (`kIsWeb`, no `dart:html`),
so the screen starts from the configurable same-origin proxy and no server host
or production endpoint is baked into the app. The field remains editable and
only the validated value is persisted.
## Verification
- `flutter test test/features/settings` — 39 tests pass (copy/default endpoint,
persistence keys/legacy isolation, controller connect/validation/ping/
disconnect/reconnect/backoff/dispose ownership/workspace errors, Material and
Cupertino widgets, invalid URL, pending vs completed-empty ping, failed-ping
single line, field labels in semantics, narrow + 2× text with full labels and
helper copy, unmount ownership).
- `flutter test` (full app) — 52 tests pass.
- `flutter analyze` — no issues; `dart format --set-exit-if-changed` clean on the
19 Dart settings/test/tool files.
- `flutter build web` (main) and `flutter build web -t tool/settings_probe.dart`
— both built.
- Real browser evidence from an isolated loopback probe server (`/connect`
answers `ping` with `probe-1.2.3`/`abc1234`/time), headless Chrome over CDP:
`settings-idle`, `settings-connected`, `settings-validation` (clicked Connect
after an `http://` draft), `settings-workspace` (typed `/srv/pipelines`,
clicked Save), `settings-dark`, `settings-ios`, `settings-narrow` (390×844,
1.6× text). See `public/settings-captures/manifest.md`.
- Fix verification with a 6 s delayed pong: at 1.5 s the card shows
`Connected` + `Loading server details…` (no "unavailable"), and after the pong
it shows the real build/time. At 320×700/2× and 390×844/2× the full
`Server URL`/`Workspace path (on the server)` labels and the complete helper
and error sentences render (no ellipsis or line cap). See
`public/settings-fix-captures/manifest.md`.
- The 20 candidate paths are new and currently **untracked** (`??`, none
ignored); landing must `git add` them. The candidate is left uncommitted per
the stage instruction.
## Gaps / not done
- Notifications are not part of this screen yet. The queue item names them, but
the task scope here was connection/workspace and the project has no
notification plugin; adding one needs a dependency decision.
- No Templates card: navigation into the templates feature is shell/feature
registration work owned elsewhere.
- No protocol-mismatch warning (the web page shows one); it needs a shared
protocol-version constant not present in the app yet.
- Mobile builds/devices and the real production server were not used. The
Cupertino rendering is shown through the web probe with an iOS platform theme,
not on an actual iOS device.
- The probe's `connected` capture is an automatic fixture connect; validation
and workspace-save captures use actual browser clicks/typing. The main web
entry (`lib/main.dart`) is still the scaffold and was not modified.
+114
View File
@@ -0,0 +1,114 @@
# P2a — graph domain: nodes, edges, terminals, run evidence and stage visits
## What changed
New, app-only, pure-Dart files. No server, web client, legacy client, shell,
`main.dart`, pubspec, other feature or platform source was edited.
| File | Lines | Responsibility |
| --- | --- | --- |
| `lib/features/graph/domain/graph_protocol.dart` | 43 | terminal constants, `resolveTarget`, terminal labels |
| `lib/features/graph/domain/graph_definition.dart` | 152 | outcome/edge order, definition edges, definition nodes |
| `lib/features/graph/domain/run_graph_state.dart` | 124 | recorded visited stages/routes, current-stage fallback, live start |
| `lib/features/graph/domain/stage_visits.dart` | 107 | sequence-ordered visits, display visit, clamped visit selection |
| `test/features/graph/domain/graph_fixtures.dart` | 96 | linear/diamond/self-loop/incomplete definitions and step fixtures |
| `test/features/graph/domain/graph_protocol_test.dart` | 56 | shorthand and terminal-label regressions |
| `test/features/graph/domain/graph_definition_test.dart` | 229 | edge order/ids, loops, duplicate keys, missing/unknown targets |
| `test/features/graph/domain/run_graph_state_test.dart` | 170 | linear/diamond/self-loop/repeated visits/outcomes/terminals/no evidence |
| `test/features/graph/domain/run_graph_state_live_test.dart` | 91 | current/last-stage fallback, live start, finished run |
| `test/features/graph/domain/stage_visits_test.dart` | 150 | repeated visits by sequence, latest default, clamping, absent visit |
No layout, coordinates, widgets, styles or rendering were added.
## Behavior copied from the current web client
- **Terminals and `#`** (`web/src/protocol.js`): `#success`, `#failure`,
`isTerminal` only for the explicit keys, and `resolveTarget`: a bare `#`
becomes `#failure` for the `error` outcome and `#success` for every other
outcome. All other values are preserved verbatim, including `""` and unknown
stage keys. A missing target stays `null`, never a fabricated terminal.
- **Labels** (`web/src/graph.js`): `nodeDisplayLabel` gives `Success` /
`Failure` for graph nodes; `nodeLabel` gives the TUI-mirroring `SUCCESS` /
`FAILURE`. Stage keys are unchanged.
- **Definition edges** (`web/src/graph.js`): outcomes are success first, other
outcomes alphabetical, `error` last; stages keep declaration order; ids are
contiguous in that order; the label carries `error*` only when
`fallback_error` is true. A `null` edge value declares no edge and is
skipped. Empty/unknown targets are kept, with `knownTarget == false`.
- **Definition nodes** (`web/src/graph.js` `layoutGraph`): stage nodes keep
declaration order and one identity per key; terminal nodes are appended
failure then success once any declared edge resolves to a terminal. These
are definition nodes only, never run evidence.
- **Run evidence** (`web/src/runDetail.js` `runGraphState`): visited stages in
first-appearance order without duplicates; routes keyed
`source\0outcome\0resolvedTarget` without duplicates; only a resolved
terminal is visited by its target; a non-terminal target is not visited until
a step lands there. Current stage is `current_stage` when non-blank, else the
last recorded step's stage, else `null`. A start timestamp is read only while
executing, for a `running` visit of the current stage.
- **Visits** (`web/src/runDetail.js` `runTimeline`, `clampVisitIndex`,
`displayVisit`, and `web/src/app.js` stage routing): visits are grouped by
stage and ordered by recorded sequence with stable ties; the display visit
is a positive `control.visit`, else position + 1; no requested visit selects
the stage's most recent visit; an explicit index clamps to `[0, count)`; a
stage with no recorded visit yields `step == null`.
The run map is the same detail the runs feature already holds; this slice only
reads `steps`, so it adds no second event fold. Live-event merging remains in
`lib/features/runs/domain/run_step_evidence.dart` and `run_events.dart`.
## Honest edge handling
- A missing/`null` definition edge produces no edge and no node.
- An empty or unknown target is returned as recorded, flagged `knownTarget:
false`; it never becomes a stage node or terminal and never produces a
visited stage.
- A blank recorded stage key is not turned into an empty visited identity. A
step with a blank outcome or target records no route and no terminal visit.
- Self edges and loops record one route and one node identity; nothing recurses.
- A stage with no recorded visits cannot be presented as visited: selection
exposes a null step rather than synthesizing one.
## Checks actually run
```
flutter pub get
dart format lib/features/graph test/features/graph # 10 files, 0 changed after formatting
flutter test test/features/graph/domain # 41 passed
flutter analyze # No issues found! (0.8s)
flutter test # 139 passed
```
Focused coverage is the requested matrix:
- **Linear**: plan -> build -> ship, contiguous ids, implicit `error*`
fallback, terminals.
- **Diamond**: fan-out/fan-in edges stay distinct and ordered; converging
routes do not merge.
- **Self loop**: `a/retry -> a` is one edge and one node identity; one run
self-loop is one route and one visited stage.
- **Repeated stage**: repeated visits remain separate ordered entries; visited
stage identity is not duplicated; repeated identical routes collapse.
- **Different outcomes**: success/approved/rejected routes to the same target
remain distinct.
- **Terminals**: bare `#` resolves by outcome, explicit terminals normalize,
labels are `SUCCESS`/`FAILURE`, mid-run targets do not fabricate visits.
- **Missing evidence**: null/absent/malformed steps and graphs yield empty
evidence, no terminals and no fabricated visits.
## Honest limits
- **No UI, layout or wiring.** This is deliberately the nonvisual foundation
slice; the native graph screen, layout, highlighting and interaction are
later work and are not claimed here.
- **No browser evidence.** A nonvisual pure-Dart change has no rendered
behavior to capture; no browser or screenshot check applies.
- **No live server or device used.** All tests use local fixtures. No run,
pipeline, schedule, workflow or service was created, changed or restarted.
- **Mobile unverified.** Only web-targeted Flutter tests and analysis ran; no
Android/iOS build, emulator, ADB or device.
- **Committed, not deployed.** The reviewed slice is commit `2c10507` on
`flutter/p2-model`; current `main` was merged in after review (final merge
`f07ada0`, which includes `main` `e8bde4f`). No push, install, preview server
or canonical-URL change was made by this landing stage; server-side checks and
the actual land follow.
+100
View File
@@ -0,0 +1,100 @@
# P2b — deterministic pure node layout
## What changed
New app-only, pure-Dart files. No existing file, server, web client, legacy
client, shell, `main.dart`, pubspec, other feature or platform source was edited.
| File | Lines | Responsibility |
| --- | --- | --- |
| `lib/features/graph/layout/layout_models.dart` | 127 | measured extents, gap config, immutable node box, layout + ranks |
| `lib/features/graph/layout/graph_ranks.dart` | 191 | deterministic SCC ranks over the landed definition nodes/edges |
| `lib/features/graph/layout/graph_node_layout.dart` | 142 | column/row placement, bounds, validation |
| `test/features/graph/layout/layout_fixtures.dart` | 102 | shared definitions and measured extents |
| `test/features/graph/layout/graph_ranks_test.dart` | 116 | linear/diamond/cycle/self-loop/disconnected/unknown/long-chain ranks |
| `test/features/graph/layout/graph_node_layout_test.dart` | 224 | ordering, terminals, heterogeneous and expanded extents, bounds, determinism |
| `test/features/graph/layout/graph_layout_validation_test.dart` | 96 | empty input, missing/extra measurements, duplicate keys, invalid sizes |
No layout widgets, painters, edge routing, styling or shell wiring were added.
## Public API
```dart
GraphRanks assignGraphRanks(List<GraphNode> nodes, List<GraphEdge> edges);
GraphLayout layoutGraphNodes({
required List<GraphNode> nodes,
required List<GraphEdge> edges,
required Map<String, NodeExtent> extents,
required GraphLayoutConfig config,
});
```
`NodeExtent` is the caller's measured width/height after text layout.
`GraphLayoutConfig` takes `columnGap`, `rowGap` and an optional outer `padding`.
No node size, font, colour or device value is assumed in the library.
`GraphLayout` returns an unmodifiable `nodes` list of `GraphNodeBox`
(`key`, `terminal`, `stageIndex`, `rank`, `x`, `y`, `width`, `height`), an
unmodifiable `ranks` map, `rankCount`, and total `width`/`height` including
padding. Node keys, terminal flags and stage indices are copied from the
landed `graphNodes` identities unchanged.
## Ranking behavior
Ranks are read from the definition supplied by the caller; the existing
`graphNodes`/`graphEdges` helpers remain the source of identities.
- Iterative Tarjan strongly connected components (no recursion; a 2000-stage
chain is covered), then longest-path ranks over the condensation DAG.
- Every member of a cycle shares one rank, so cyclic routes cannot recurse or
push members apart. Self loops are internal supervision and add no rank.
- Disconnected stages and disconnected terminals stay at rank 0.
- Edges whose source or target is not a node are ignored. An unknown or empty
target never creates a node or a rank.
- Ranking is linear in nodes plus edges and stable for repeated input.
## Placement behavior
- One column per rank; nodes keep definition order inside a rank.
- A column is as wide as its widest measured node; columns are separated by
`columnGap` and top-aligned.
- Nodes are centred in their column and stacked with exactly `rowGap` between
measured boxes (centres are compared in the heterogeneous test).
- Supplied widths/heights are placed verbatim, so expanded text is never
clipped to a fixed box; growing the extents grows the total bounds.
- Bounds include every box: tests assert `right <= width` and
`bottom <= height` for every fixture.
- The result is immutable and identical for identical input.
Measurements are required for every node; a missing key throws
`ArgumentError` rather than inventing a default size. Extra measurements are
ignored because they cannot become nodes. Duplicate/empty node keys, negative
or non-finite gaps and extents are rejected.
## Checks actually run
```
flutter pub get
dart format lib/features/graph/layout test/features/graph/layout
flutter test test/features/graph/layout # 21 passed
flutter analyze # No issues found!
flutter test # 173 passed
git diff --check # clean
```
Tests cover linear, diamond, cycle, self-loop, disconnected, terminals,
unknown/empty targets, heterogeneous extents, 2.6x expanded text, determinism,
bounds and invalid input.
## Honest limits
- **Nodes only.** Edge routing, ports, labels, lanes, hit testing, selection
highlighting, painting and native controls are separate later items.
- **Not rendered.** A pure nonvisual slice has no browser behavior to capture;
no screenshot or browser check applies.
- **No server or device.** Tests use local fixtures only; no run, pipeline,
schedule, service, emulator, ADB, Android/iOS build or live chat was touched.
- **Mobile unverified.** Only web-targeted Flutter test/analyze ran.
- **Uncommitted candidate.** Per this stage's instruction the slice is left in
the worktree; no commit, push or deployment was made.
+116
View File
@@ -0,0 +1,116 @@
# P2c — deterministic orthogonal edge and label routing
## What changed
New app-only, pure-Dart files. No existing file, server, web client, legacy
client, shell, `main.dart`, pubspec, domain, layout, other feature or platform
source was edited.
| File | Lines | Responsibility |
| --- | --- | --- |
| `lib/features/graph/routing/route_models.dart` | 261 | public route, port, label, diagnostic and bounds types |
| `lib/features/graph/routing/routing_inputs.dart` | 64 | measured label extents and caller clearances |
| `lib/features/graph/routing/route_geometry.dart` | 175 | axis track allocator and column-gap bands |
| `lib/features/graph/routing/corridor_plan.dart` | 105 | vertical corridor allocation per column gap |
| `lib/features/graph/routing/edge_route_planner.dart` | 265 | forward/back/same-rank/self-loop polyline planning |
| `lib/features/graph/routing/edge_label_placement.dart` | 175 | measured label boxes clear of nodes and other labels |
| `lib/features/graph/routing/graph_edge_routing.dart` | 135 | validation, skipped diagnostics, labels, total bounds |
| `test/features/graph/routing/routing_fixtures.dart` | 143 | chain/diamond/parallel/cycle/self-loop/disconnected fixtures |
| `test/features/graph/routing/routing_assertions.dart` | 215 | orthogonality, borders, node interiors, corridors, labels, bounds |
| `test/features/graph/routing/graph_edge_routing_test.dart` | 191 | chain, diamond, parallel, cycle, loop, disconnected, expanded text, unknown targets |
| `test/features/graph/routing/graph_routing_geometry_test.dart` | 161 | wide labels, tight gaps, 3-stage SCC, backward layout, loop + forwards |
| `test/features/graph/routing/graph_routing_validation_test.dart` | 222 | empty input, missing measurements, duplicate ids, invalid config, determinism/immutability |
No painting, widgets, styling, shell wiring or font/CSS/device constants were
added.
## Public API
```dart
GraphRouting routeGraphEdges({
required GraphLayout layout,
required List<GraphEdge> edges,
required Map<int, LabelExtent> labelExtents,
required RoutingConfig config,
});
```
`RoutingConfig` takes `nodeClearance`, `laneSpacing`, `corridorSpacing`,
`portSpacing`, `labelGap` and optional `boundsPadding`. `LabelExtent` is the
caller's measured label width/height. The node boxes and ranks are the landed
`GraphLayout` values; the router never moves or resizes a node.
`GraphRouting` exposes unmodifiable `routes`, `labels`, `skipped`, `width` and
`height`, plus `routeFor(id)` / `labelFor(id)`. Each `EdgeRoute` keeps the
definition `id`, `source`, `outcome`, `target`, `label` and `fallback` flag, and
returns `sourcePort`, `targetPort`, a `RouteKind` and an orthogonal `points`
list. Each `EdgeLabelBox` carries the measured box for its edge id.
## Deterministic guarantees (and what is not claimed)
- **Identity:** routed edges copy the definition identity unchanged; skipped
edges keep it in `RouteDiagnostic` with `unknownSource`/`unknownTarget`. No
node, route or visit is invented for an empty, missing or unknown target.
- **Order and stability:** routes, labels and diagnostics are ordered by edge id
regardless of input order. Equal input produces equal, immutable results.
- **Orthogonality and ports:** every consecutive point pair shares one
coordinate. Endpoints are exactly on the source/target border with the
recorded side: forward routes leave right and enter left; same-rank, backward
and self-loop routes leave/enter the right side.
- **Node avoidance:** a forward one-rank route is a straight horizontal run only
when the boxes share a port band and leave room for label-aware track spacing.
Every other route drops into a unique horizontal lane below the node grid,
travels vertically only inside column gaps (or the free space right of the
last column), and returns to a port through its own stub. Vertical corridors
and lanes never enter a node column, and every horizontal stub stays on a row
that is clear of unrelated node boxes.
- **Distinguishable runs:** vertical tracks are spread across each gap, one
slot per corridor request; horizontal stubs and straight routes share one
interval-aware allocator; every wrapping route owns its own lane. Two edges
cannot share a collinear run in the tested fixtures.
- **Labels:** each routed edge needs a measured `LabelExtent`; a missing one is
an `ArgumentError`. The box is placed at a deterministic route run, clear of
node interiors and earlier labels. If a run is too narrow (for example a wide
label between close columns), the label moves to a free shelf below the
drawing and the returned bounds grow instead of covering a node.
- **Bounds:** `width`/`height` include the landed node layout, all route points
and all label boxes, plus `boundsPadding`. A self loop or an edge into the
right-free gap expands the box; nothing is clipped.
- **Not claimed:** perfect general crossing minimization or minimal bend
counts. Corridors and lanes are deterministic and locally separated, not a
globally optimal routing.
## Checks actually run
```
flutter pub get
dart format lib/features/graph/routing test/features/graph/routing # 0 changed
flutter test test/features/graph/routing # 20 passed
flutter analyze # No issues found!
flutter test # 193 passed
```
Focused coverage includes chain, diamond fan-out/fan-in, three outcomes to one
target, a two-stage and a three-stage SCC, a self loop alone and beside forward
routes, disconnected stages, heterogeneous widths, 2.6x expanded text, tight
gaps, wide labels, a caller-supplied backward rank, missing/empty/unknown
targets, immutability, stable ordering and finite bounds.
## Honest limits
- **No rendering.** This is a nonvisual geometry slice: no painter, widgets,
native controls, screenshots or browser behavior. Rendered parity belongs to
the next renderer task.
- **Layout is an input.** The router does not widen columns for labels or move
nodes. Very wide labels may sit on the free shelf below the drawing; callers
that want labels beside an edge should reserve enough column gap when laying
out nodes. A zero-width column gap leaves no space for distinct vertical
corridors, so callers should supply a positive gap (the landed layout keeps
whatever gap it is given).
- **No general crossing optimum.** Only deterministic corridor/lane separation
is guaranteed, as described above.
- **No server or device.** Tests use local fixtures only; no run, pipeline,
schedule, service, emulator, ADB, Android/iOS build or live chat was touched.
- **Mobile unverified.** Only web-targeted Flutter test/analyze ran.
- **Uncommitted candidate.** Per this stage's instruction the slice is left in
the worktree; no commit, push or deployment was made.
+7
View File
@@ -0,0 +1,7 @@
# R1a — runs controller correctness
Implemented in `runs_controller.dart`: selection requests now retain prior detail while loading and ignore stale/disposed replies; list and detail loading indicators are independent; Back invalidates selection and cancels scheduled refresh; selected-run refreshes use captured ID/generation and preserve detail until the reply; identity-less or unresolvable run events trigger list resynchronization.
Added six fake-gateway regression tests in `test/features/runs/ui/runs_controller_test.dart` for stale selection, pending futures after disposal, Back cancellation, unrelated events, identity-less list resync, and full-refresh detail retention.
Verification: `flutter test test/features/runs/ui` passed (6 tests), `flutter analyze` passed with no issues, and `flutter build web` passed. Cupertino UI/browser evidence is outside this R1a slice and remains incomplete for the overall R1 task; mobile is unverified.
+55
View File
@@ -0,0 +1,55 @@
# R1b — runs controller request independence
Focused correctness fix on retained candidate `6b8d5ea`. Files:
`lib/features/runs/ui/runs_controller.dart`,
`test/features/runs/ui/runs_controller_test.dart`.
## Fixes
- List and detail requests now use independent generations (`_listGeneration`,
`_detailGeneration`). `load(initialId)` no longer bumps the detail generation
that `select(initialId)` also advances, so both `loading` and `detailLoading`
clear when the requests resolve. Manual list loads also no longer invalidate
valid detail refreshes.
- List resyncs (`_reloadList`) capture and check a list generation, so a stale
reply cannot overwrite a newer `load()`. Concurrent resync requests are
coalesced into exactly one followup; a resync requested during a manual load
runs after that load instead of being dropped.
- Detail refreshes capture the current detail generation and selected run.
Same-id refreshes keep the existing detail and are coalesced (in-flight plus
one followup). Selecting a different run clears the previous detail instead of
presenting it as the new run. Back/dispose invalidate pending replies, and
stale requests cannot clear another generation's loading flags.
- Added `num? get selectedRunId` for the native UI lane. All existing public
methods and fields are preserved.
The existing 150 ms event debounce is retained; no polling or extra timers were
introduced. File is 260 lines; the fix stays within the controller responsibility
rather than fragmenting it.
## Tests
Extended `test/features/runs/ui/runs_controller_test.dart` with regressions for:
- `load(initialId)` resolves with `loading == false` and `detailLoading == false`.
- Overlapping list loads with reversed completion order: newer reply wins.
- List resync leaves the selected detail request valid.
- Manual `load()` does not invalidate an in-flight detail refresh.
- Sparse unknown run events coalesce into one followup resync.
- A followup requested while a superseded resync is still marked in flight
starts once that stale reply arrives instead of being stranded.
- Selected refresh coalescing (in-flight plus followup) and Back ignoring the
pending reply.
- Choosing another run does not display the previous run's detail.
- Pending detail refresh is safe after dispose.
Existing six regression tests remain and pass.
## Verification
- `/Users/alan/development/flutter/bin/flutter test test/features/runs/ui` — 15 tests passed.
- `/Users/alan/development/flutter/bin/flutter test test/features/runs` — 26 tests passed.
- `/Users/alan/development/flutter/bin/flutter analyze` — no issues found.
- `flutter build web` not run in this NONVISUAL controller slice; manager
integration/UI review owns rendered and build acceptance.
- Mobile remains unverified; no device or browser tools used.
+50
View File
@@ -0,0 +1,50 @@
# R1c2 — run detail native widget slice
## Change
`RunDetailView` keeps its existing `controller` and `onBack` API but now selects
its presentation from the host: MaterialApp uses the standard Material controls,
CupertinoApp uses Cupertino controls without a Material ancestor. Selection is
based on `MaterialLocalizations`, so it works on the web's desktop host and in
widget tests without relying on the browser's target platform.
- Material: `Chip`, `ExpansionTile`, `ListTile`, `TextButton`, `IconButton`,
selectable text and `SnackBar` feedback.
- Cupertino: `CupertinoButton`, `CupertinoExpansionTile`, `CupertinoListTile`
and grouped list sections. Copy feedback is inline in a live-region status;
no `ScaffoldMessenger`/`SnackBar` is used.
- Loading and failure states are platform-specific and honest: only the error
text is shown when no detail exists, and the Back action remains available.
A refresh with retained detail reports `Refreshing run details…` instead of
clearing the view.
- The scrollable list has a stable per-run key and a test proves a live detail
update keeps its scroll offset.
Detail-only helpers split formatting from presentation:
- `run_detail_content.dart`: title/pipeline, prompt extraction, nested JSON,
usage metrics and recorded timeline entries.
- `run_detail_material.dart` and `run_detail_cupertino.dart`: the two native
presentations.
- Input/output are pretty-printed, selectable JSON. Copy prompt passes the
stored string byte-for-byte (no trim, no fallback field).
- Usage distinguishes reported zero from unknown: token/cost totals are
`Unavailable` unless the corresponding stage count proves reporting; a known
stage count with an omitted zero cost renders `$0.000000`. Timeline rows show
the server's recorded sequence.
## Verification
- `flutter test test/features/runs/ui/run_detail_widget_test.dart`: 7 tests
passed. They run both platforms at 390px width with 2x text, exercise
loading/error and Back, exact prompt copy and denied clipboard feedback,
nested JSON, recorded sequences, zero vs missing usage, and scroll retention.
- `flutter test test/features/runs`: 24 tests passed.
- `flutter analyze`: no issues.
- `flutter build web`: succeeded.
## Limits
No real browser interaction or rendered capture was performed in this slice; the
manager separately tracks R1 browser acceptance. Android/iOS builds and devices
were not run, so mobile is unverified. No commit, push or deployment was made.
+84
View File
@@ -0,0 +1,84 @@
# R2a — native human-decision action
## What changed
New `lib/features/runs/actions/` slice (no existing source file edited):
| File | Lines | Responsibility |
| --- | --- | --- |
| `decision_action.dart` | 141 | `HumanDecisionAction`, gating, submit/refusal/resync orchestration |
| `decision_dialog.dart` | 248 | Material `AlertDialog` / Cupertino `CupertinoAlertDialog` prompt |
| `decision_wording.dart` | 24 | Web-verbatim words, meta/target formatting and test keys |
| `test/.../decision_action_test.dart` | 237 | Material/Cupertino deliberate send and gating |
| `test/.../decision_resilience_test.dart` | 240 | refusal resync, double submit, disposal, 2x/narrow |
`HumanDecisionAction` takes the run, the shared `ApiGateway` and an
`onRunChanged` callback. It renders one `FilledButton` (`Decide`) on Material
and one `CupertinoButton.filled` on Cupertino, and nothing at all when
`pendingDecision(run)` is null. Recorded waiting-step options therefore win over
the pinned graph, and a pending session export suppresses the action through the
existing domain rule without duplicating it here.
Opening the prompt sends nothing. The prompt uses the web wording
(`Waiting for your decision`, `Feedback (optional)`, `Cancel`,
`Confirm decision`, `Sending…`), shows the stage/run meta line and each option's
`→ target` when declared. Confirm is disabled until an option is selected;
selecting itself only updates the draft. Confirm calls `RunsRepository.decideRun`
with the exact stage, trimmed option and trimmed optional feedback (blank
feedback is omitted by the repository).
A refusal is shown verbatim inside the kept-open prompt; the option selection
and feedback controller are untouched. The action then calls
`RunsRepository.getRun` and passes the refreshed run to `onRunChanged`. A
successful decision passes the server's `run_detail` to `onRunChanged` and
closes the prompt. Both sends are guarded in the prompt and in the owner state;
buttons are disabled while `Sending…`. Every asynchronous resume checks
`mounted` before `setState` or `onRunChanged`, so a late reply after disposal is
ignored.
Platform style follows the enclosing app: `MaterialApp` gets the Material
dialog and controls, `CupertinoApp` gets the Cupertino dialog with native
buttons/radios/field. No custom palette, font family, fixed button/row size,
dependency or CSS token was added; the theme's error color and default control
spacing are used. The one optional `cupertino` override exists for
callers/tests that do not wrap in either app.
## Checks actually run
```
flutter pub get # dependencies resolved
dart format lib/features/runs/actions test/features/runs/actions
flutter analyze # No issues found!
flutter test test/features/runs # 18 passed
flutter test # 36 passed
flutter test test/features/runs/actions # 7 passed
flutter build web # Built build/web (14.2s)
```
Focused coverage maps to the requested acceptance:
- material: action visible, dialog open, selection does not send, Confirm is
disabled before selection, exact `decide_run` stage/option/`looks good`
feedback, callback gets the decided run and the action disappears;
- cupertino: native `CupertinoAlertDialog`, disabled Confirm first, blank
feedback omitted, exact request fields;
- gating: running, export-pending and non-human runs render no action;
- refusal: `decide_run` then `get_run`, verbatim error still visible, selected
option and typed feedback retained, refreshed failed run delivered to owner;
- double submit: two Confirm taps produce one `decide_run`, Cancel is disabled
while sending;
- stale disposal: completing the decision after the tree is replaced produces
no exception and no owner callback;
- 320×480 at 2x text on both apps: prompt opens with no rendering exception.
## Honest limits
- **Not wired into a run-detail screen.** `lib/features/runs/` has no screen or
controller on this branch; the manager owns that integration. There is
therefore no real browser interaction or capture for this widget. The
`flutter build web` result proves compilation only, not rendered behavior.
- **Mobile unverified.** No Android/iOS build, emulator, ADB or device was used.
Source uses only portable Flutter/Cupertino/Material widgets.
- No real server or run was mutated. Tests use a local fake gateway.
- No repository/domain/controller/screen/main, `web/`, Go server, installer or
deployment file was changed. Nothing was committed, pushed or deployed.
+92
View File
@@ -0,0 +1,92 @@
# R2b-refusal — immediate refusals, separate resync
Focused correction on the retained `faa5866` cancellation candidate. The action
source is now shared by both deliberate run actions (cancel and human decision);
no wiring, screen, controller, repository, socket, pubspec, web, server or
device file was touched.
## What changed
| File | Lines | Responsibility |
| --- | --- | --- |
| `lib/features/runs/actions/action_refusal.dart` | 18 | Refusal message plus optional bounded re-read outcome; local guard words |
| `lib/features/runs/actions/cancel_run_action.dart` | 119 | Immediate refusal return, single-flight resync, ownership checks |
| `lib/features/runs/actions/cancel_dialog.dart` | 165 | Shows the refusal and re-enables Keep before the resync settles |
| `lib/features/runs/actions/decision_action.dart` | 176 | Same async flow for `decide_run`, draft preserved |
| `lib/features/runs/actions/decision_dialog.dart` | 268 | Shows refusal, keeps draft, disables retry only on server truth |
| `test/features/runs/actions/cancel_resilience_test.dart` | 271 | Three new fake-gateway regressions |
| `test/features/runs/actions/decision_resilience_test.dart` | 351 | Three new fake-gateway regressions |
| `test/features/runs/actions/decision_action_test.dart` | 265 | Cancel/no-request coverage |
## Async flow
A refused mutation no longer awaits `get_run` before returning:
1. `_submit` catches the mutation error and computes the refusal text.
2. It returns `ActionRefusal(message, stillPossible: _resyncRun(id))` at once.
`_resyncRun` starts one `get_run` for that refusal; a concurrent refusal
observes the same future instead of issuing another request.
3. The prompt clears its sending state, shows the server's words and makes
Keep/Cancel available in the same frame. Back is enabled too (`PopScope`
only gates the in-flight mutation). Confirm stays disabled while the check
is pending and after it proves the action impossible, so a doomed mutation
cannot be resubmitted from the open prompt.
4. The resync runs detached but bounded: exactly one `get_run`, no retries or
polling. Every exception becomes `null` (unknown truth), which leaves the
refusal visible and a deliberate retry available.
5. Before delivering a refreshed run, the action checks `mounted` and that the
run id it owns is still the request's id. A late read after disposal or
navigation touches nothing and raises nothing.
On success the mutation reply is still used directly, the prompt closes, and no
duplicate `get_run` is issued. The dialog and action keep the existing
in-flight double-submit guard. The human-decision prompt keeps the selected
option and feedback controller untouched while a refusal or resync is pending;
its retry is disabled only when the refreshed run no longer offers the same
decision (same stage and option keys).
No repository, protocol or socket code changed. The web's `cancel_run` plus
silent refresh remains the reference; this version keeps the diagnostic in the
open prompt rather than moving it to the web's separate Action-failed dialog.
## Regression coverage added
Fake gateway, no socket or real server:
- immediate `cancel_run` refusal plus a deliberately unresolved `get_run`: the
exact message is visible, Keep is enabled, confirm is disabled and no run
callback has fired **before** the resync completes; Keep closes the prompt;
a late resync still delivers server truth safely;
- late cancel resync after the whole action is disposed: no exception, no
callback;
- resync proving the run is no longer cancellable: refusal stays visible,
confirm cannot submit again (an attempted tap adds no request), Keep
dismisses and the ineligible run is delivered;
- immediate `decide_run` refusal plus an unresolved `get_run`: exact message,
selection and feedback retained, Cancel enabled, no callback yet; after the
resync proves the decision gone, the message remains and confirm is disabled;
- decision resync that fails: message and draft remain, Confirm is re-enabled
because server truth is unknown;
- late decision resync after disposal: no exception, no callback;
- Cancel on an untouched decision draft sends nothing and keeps the action
available.
## Checks actually run
```
dart format lib/features/runs/actions test/features/runs/actions # clean
flutter analyze # No issues found!
flutter test test/features/runs/actions # 23 passed
flutter test # 52 passed
flutter build web # Built build/web
```
## Honest limits
- Still **not wired into a run-detail screen** on this branch; there is no
browser interaction or rendered capture for this widget. `flutter build web`
proves compilation only.
- Mobile remains unverified: no Android/iOS build, emulator, ADB or device.
- No real server or run was mutated; all evidence uses local fakes.
- No commit, push, deployment or canonical-URL change is claimed here beyond
the candidate commit checked by the manager.
+96
View File
@@ -0,0 +1,96 @@
# R2b — native run cancellation
## What changed
New `lib/features/runs/actions/cancel*` slice plus its tests. No existing source
file was edited.
| File | Lines | Responsibility |
| --- | --- | --- |
| `lib/features/runs/actions/cancel_eligibility.dart` | 31 | Web-exact `canCancelRun`, run-id extraction, numeric export counter |
| `lib/features/runs/actions/cancel_wording.dart` | 23 | Web-verbatim words, dialog title, error text, test keys |
| `lib/features/runs/actions/cancel_dialog.dart` | 145 | Native Material/Cupertino confirmation and inline refusal |
| `lib/features/runs/actions/cancel_run_action.dart` | 101 | `CancelRunAction`, gating, send/refusal/resync orchestration |
| `test/features/runs/actions/cancel_test_support.dart` | 101 | Fake gateway, run fixtures, stateful host, app wrappers |
| `test/features/runs/actions/cancel_action_test.dart` | 192 | Eligibility and both-platform deliberate-confirm flows |
| `test/features/runs/actions/cancel_resilience_test.dart` | 176 | Refusal/resync, resync failure, double submit, disposal, 2x/narrow |
`CancelRunAction` takes the run, the shared `ApiGateway` and an
`onRunChanged` callback. It renders one native `FilledButton` (`Cancel run`) on
Material and one `CupertinoButton.filled` on Cupertino, and nothing at all when
the browser rule says the run is not cancellable. Platform style follows the
enclosing app (`MaterialLocalizations` presence); no extra style parameter or
dependency was added.
## Behaviour
Eligibility is a direct port of `canCancel` in `../web/src/actions.js`:
```
(executing || (status == "waiting" && export_pending_sequence > 0))
&& !cancel_requested && !cleanup_unconfirmed
```
A run with a stale `running` status but `executing == false` is therefore not
cancellable, while a `waiting` run with a pending session export is. A run
without a numeric `id` is not offered because the request cannot be addressed
(the pure eligibility function still matches the web rule exactly).
Opening the prompt sends nothing and `Keep` only closes it. The prompt uses the
web wording (`Cancel run {id}?`, `This asks the server to stop the active run.`,
`Cancel run`, `Keep`). Only the confirm action calls
`RunsRepository.cancelRun(id)`, which sends the exact envelope
`cancel_run {"run_id": id}`.
Both the dialog and the action guard the in-flight state: a second confirm tap
or a `Keep` tap while sending is ignored, and the dialog's actions are disabled
until the reply arrives. A successful reply closes the prompt and passes the
server's returned `run_detail` to `onRunChanged`; no local status is invented.
A refusal keeps the prompt open and shows the server's message verbatim. The
action then calls `RunsRepository.getRun(id)` and passes the refreshed run to
`onRunChanged`, so the owner sees server truth (for example the run finished
before cancellation). If the re-read also fails, the original refusal stays
visible and no synthetic run is delivered. Every asynchronous resume checks
`mounted` before `setState` or `onRunChanged`, so a late reply after disposal is
ignored.
## Checks actually run
```
flutter pub get # dependencies resolved
dart format lib/features/runs/actions/cancel*.dart \
test/features/runs/actions/cancel*.dart # clean
flutter analyze # No issues found!
flutter test test/features/runs/actions # 16 passed
flutter test # 45 passed
flutter build web # Built build/web (15.5s)
```
Focused coverage maps to the requested acceptance:
- eligibility: executing, export-wait, waiting without export, stale `running`
without `executing`, already stopping, cleanup unconfirmed, finished/failed;
plus widget visibility for the same states;
- both platforms: native prompt opens, nothing is sent on open or `Keep`, exact
`cancel_run` envelope, callback receives the returned run, action disappears;
- refusal: cancellation error shown verbatim, `get_run` resync delivered to the
owner, and a failed resync leaves the refusal visible with no callback;
- double submit: two confirm taps produce one `cancel_run`, both actions disable;
- stale disposal: a reply after the tree is replaced causes no exception and no
callback;
- 320x480 at 2x text: both prompts open with no rendering exception.
## Honest limits
- **Not wired into a run-detail screen.** This branch has no run-detail screen
or controller; the manager owns integration. There is therefore no real
browser interaction or capture for this widget. `flutter build web` proves
compilation only, not rendered behavior, and no visible feature is claimed.
- **Mobile unverified.** No Android/iOS build, emulator, ADB or device was used.
Source uses only portable Flutter/Cupertino/Material widgets.
- No real server or run was mutated. Tests use a local fake gateway with no
socket.
- No controller/screen/main/domain/repository/pubspec, `web/`, Go server,
installer or deployment file was changed. Nothing was committed, pushed or
deployed.
+114
View File
@@ -0,0 +1,114 @@
# R2c — native retry / restart action
Small app-only addition, new files only. `RetryRunAction(run, gateway,
onRunChanged)` is the deliberate retry entry point for a stopped failed run; it
does not add a screen or controller and is not wired into the shell.
## What changed
| File | Lines | Responsibility |
| --- | --- | --- |
| `lib/features/runs/actions/retry_action.dart` | 123 | `RetryRunAction`, gating, send/refusal/resync orchestration |
| `lib/features/runs/actions/retry_dialog.dart` | 207 | Native resume/restart confirmation, refusal display, key lifetime |
| `lib/features/runs/actions/retry_eligibility.dart` | 16 | `canRetryRun` mirroring the web `canRetry` |
| `lib/features/runs/actions/retry_intent.dart` | 29 | Mode, confirmed intent and idempotency-key generation |
| `lib/features/runs/actions/retry_wording.dart` | 33 | Web-verbatim words, titles, error wording and test keys |
| `test/.../retry_test_support.dart` | 112 | Fake gateway and Material/Cupertino hosts |
| `test/.../retry_action_test.dart` | 245 | Eligibility, both platforms, modes and key fields |
| `test/.../retry_resilience_test.dart` | 223 | Immediate refusals, recheck outcomes, key retention |
| `test/.../retry_safety_test.dart` | 133 | Double submit, late replies, narrow 2x layout |
No repository, gateway, socket, controller, shell, main, pubspec, web, server or
device file was edited.
## Behavior
Eligibility is exactly the browser's rule: a loaded run that is not executing and
whose status is `failed` (`run != null && !run.executing && status == "failed"`).
A stale `failed` status while execution is still in flight, a running/waiting/
succeeded/canceled run, and a malformed run render nothing.
The button is a Material `FilledButton` or a Cupertino `CupertinoButton.filled`,
labelled `Retry`. Opening the prompt sends nothing, and `Keep` only closes it.
The first confirmation is the browser's retry copy: title `Retry run {id}?`,
message `Only failed runs can be retried. The server starts a new run from the
same input.`, confirm `Retry`, dismiss `Keep`, plus the browser-only secondary
`Restart from start` that leads to a distinct confirmation. That second prompt
uses title `Restart run {id}?`, message `This replays the whole pipeline from the
start instead of resuming the failed stage.` and confirm `Restart from start`;
the resume actions are gone, so the more destructive choice cannot be mistaken
for resume.
Resume calls `RunsRepository.retryRun` with only `run_id` and `request_key`, so
`retry_mode` is omitted and the server's `resume` default applies. Restart sends
`retry_mode: "restart"` with the same two required fields.
A `request_key` is created on the first confirm of an open prompt, not on opening
or `Keep`. It survives a refusal, so pressing confirm again for the same
uncertain request reuses the key and the server can dedupe it. Closing the prompt
and opening it again is a fresh deliberate intent and gets a new key, so a resume
attempt followed by a restart attempt never shares a key. Switching to the
restart confirmation before any send simply confirms restart with that prompt's
first key. Keys are bounded and run-scoped (`app-retry-{runId}-…`, well under the
server's 128-character cap).
A server refusal returns to the prompt immediately: the exact server words are
visible and `Keep`/back are available while the detached `get_run` recheck is
still pending. One bounded re-read is issued per refusal, single-flight through a
retained future, with no retry loop or polling. If server truth says the run is no
longer retryable, confirm is disabled and an attempted tap sends nothing; the
refusal stays visible until dismissal. If the recheck itself fails, truth is
unknown, so confirm is re-enabled and a deliberate retry uses the retained key.
Late retry replies and late rechecks after disposal or navigation are ignored.
Construction, controls and error colour are standard Material/Cupertino defaults;
there is no custom palette, fixed control size or dependency. The narrow layout
relies on the native dialog's own scrolling/wrapping.
## Acceptance checks
Fake-gateway widget tests, both platforms, no socket or real server:
- eligibility table for stopped failed vs executing failed, running, waiting,
succeeded and canceled runs, plus the same visibility table under both apps;
- `Retry` opens the native `AlertDialog`/`CupertinoAlertDialog`, `Keep` closes it
and the recorded gateway calls are still empty;
- resume sends exactly `{run_id, request_key}` and no `retry_mode`; restart sends
exactly `{run_id, request_key, retry_mode: "restart"}`;
- key format is deterministic under an injected clock/entropy, bounded, fresh per
call, retained across an uncertain retry (resume and restart), and different
after a deliberate reopen or mode change;
- refusal message appears while `get_run` is deliberately unresolved, with Keep
enabled, confirm disabled and no callback yet; Keep then closes and the late
recheck still delivers server truth safely;
- ineligible recheck (`succeeded`) blocks a repeat action; failed recheck leaves
the same key and a working deliberate retry;
- two confirm taps while in flight produce one `retry_run`; both the retry reply
and the recheck are safe after disposal;
- 320×480 at 2× text: both resume and restart confirmations render on both apps
with no exception, and Keep sends nothing.
## Checks actually run
```
dart format lib/features/runs/actions test/features/runs/actions # clean
flutter analyze # No issues found!
flutter test test/features/runs/actions # 40 passed
flutter test # 69 passed
flutter build web # Built build/web (14.5s)
```
## Honest limits
- **Not wired into a run-detail screen.** This branch has no runs screen or
controller; the manager owns that integration. There is no browser interaction
or rendered capture for this widget, and `flutter build web` proves compilation
only, not rendered behavior.
- Browser parity is by source/word/request-shape comparison with
`web/src/actions.js` and `web/src/repository.js`; the web client itself was not
changed and no live web retry was performed.
- **Mobile unverified.** No Android/iOS build, emulator, ADB or device was used.
- No real server or run was retried, canceled or otherwise mutated; all evidence
uses local fakes.
- The candidate is committed, not pushed or deployed.
+93
View File
@@ -0,0 +1,93 @@
# R2d — native run title rename
## What changed
New `lib/features/runs/actions/title*` slice plus its tests and this note. No
existing source file was edited.
| File | Lines | Responsibility |
| --- | --- | --- |
| `lib/features/runs/actions/title_wording.dart` | 24 | Web-verbatim words, test keys, refusal wording |
| `lib/features/runs/actions/title_dialog.dart` | 183 | Native Material/Cupertino text-field prompt and inline refusal |
| `lib/features/runs/actions/title_action.dart` | 109 | `RunTitleAction`, stored-title seeding, send/deliver orchestration |
| `test/features/runs/actions/title_test_support.dart` | 110 | Fake gateway, run fixtures, stateful host, app wrappers |
| `test/features/runs/actions/title_action_test.dart` | 244 | Both-platform open/cancel/exact-save and stored-title seeding |
| `test/features/runs/actions/title_resilience_test.dart` | 243 | Refusal retention, double save, disposal, stale owner, 2x/narrow |
`RunTitleAction(run: …, gateway: …, onRunChanged: …)` renders one native
`OutlinedButton` (`Rename`) on Material and one plain `CupertinoButton` on
Cupertino, and nothing for a run without a numeric id. Platform style follows the
enclosing app (`MaterialLocalizations` presence). No style overrides, fixed
component sizes or new dependencies.
## Behaviour and web parity
The prompt is seeded with the run's actual stored title exactly as the browser
reads it, `String(d.title ?? "")` in `web/src/views/runDetail.js`. It is never
derived from `input.prompt`, stage output or a placeholder. A missing title seeds
an empty field.
Typing, opening and the dismiss action send nothing. Only `Save` calls the
existing `RunsRepository.setRunTitle(id, title)`, which sends the exact envelope:
```
set_run_title {"run_id": <numeric run id>, "title": <field text>}
```
The field text is passed through untrimmed, matching `repo.setRunTitle(id,
String(state.renameValue ?? ""))` in `web/src/repository.js`. Leading/trailing
spaces and Unicode are preserved, and a blank title is sent as `""` so the server,
not the client, decides whether it is acceptable. There is no local
`canSubmit` gate on blank text.
A refusal (including a blank-title refusal) is shown verbatim below the field and
the prompt stays open with the typed draft intact. Nothing is updated locally.
Only an accepted reply closes the prompt and passes the server's returned
`run_detail` once through `onRunChanged`; the action never fabricates a run or a
title. A second Save tap while sending is ignored, both dialog actions disable
until the reply, and every asynchronous resume checks `mounted`. A reply for a run
the widget no longer owns is dropped.
## Checks actually run
```
dart format lib/features/runs/actions/title*.dart \
test/features/runs/actions/title*.dart # clean
flutter analyze # No issues found!
flutter test test/features/runs/actions/title_action_test.dart \
test/features/runs/actions/title_resilience_test.dart # 11 passed
flutter test test/features/runs # 45 passed
flutter test # 63 passed
flutter build web # Built build/web (16.2s)
```
Focused acceptance coverage:
- both platforms: native button and dialog, stored title in the field, typing and
Cancel produce zero gateway calls, Save sends exact `set_run_title` fields;
- exact field values: Unicode plus leading/trailing whitespace preserved; blank
title sent as `""` and the server refusal shown with the blank draft retained;
- failed save: server words verbatim, draft retained, dialog open, no callback and
no local title change; transport failure likewise;
- double Save: one request, action buttons disabled while in flight;
- disposal: a late reply after the tree is replaced throws nothing and delivers
nothing; a reply after the widget's run id changes is not delivered;
- 320x480 at 2x text: both prompts open, show a long title and a refusal, and close
with no rendering exception;
- malformed run: no rename button, and the stored-title helper ignores prompts.
## Honest limits
- **Not wired into a run-detail screen.** This branch has no run-detail screen or
controller; the manager owns integration. No real browser interaction or
capture was performed, so rendered feature parity is not claimed. `flutter build
web` proves compilation of the existing entrypoint, not that this widget is
reachable or visible.
- **Mobile unverified.** No Android/iOS build, emulator, ADB or device was used.
Source uses portable Flutter/Cupertino/Material widgets only.
- No real server, operator run or chat was touched. Tests use a local fake gateway
with no socket.
- No repository/domain/controller/shell/main/pubspec, `web/`, Go server,
installer or deployment file was changed.
- Nothing was committed, pushed or deployed; the files above are the candidate in
the working tree, per the stage instruction not to commit.
+94
View File
@@ -0,0 +1,94 @@
# S1a — saved-schedule repository and record
## What changed
New, app-only files (no existing feature, shell, transport, `main` or pubspec
source edited):
| File | Lines | Responsibility |
| --- | --- | --- |
| `lib/features/schedules/data/schedules_repository.dart` | 116 | `list_schedules`, `save_schedule`, `delete_schedule` envelopes and reply checks |
| `lib/features/schedules/domain/saved_schedule.dart` | 87 | typed view over one saved run configuration; exact raw record retained |
| `lib/features/schedules/domain/schedule_rule.dart` | 41 | interval/clock/timezone/weekday fields of `rule` |
| `lib/features/schedules/domain/schedule_json.dart` | 22 | deep JSON copy used by every round trip |
| `test/features/schedules/data/schedules_repository_test.dart` | 132 | list/create/update envelopes, unchanged input, CAS revision |
| `test/features/schedules/data/schedules_delete_test.dart` | 131 | delete envelope, confirmations, refusals, missing/empty replies |
| `test/features/schedules/data/schedules_protocol_bounds_test.dart` | 81 | web-mirrored ID/revision/request-key bounds |
| `test/features/schedules/data/saved_schedule_record_test.dart` | 101 | provenance, unknown fields, deep-copy and absent-field behavior |
| `test/features/schedules/data/schedule_test_support.dart` | 83 | recording fake gateway and server-shaped fixtures |
`app/.gitignore` also gained the missing `!/test/**/data/` exception. The root
`.gitignore` ignores every `data/` directory, so without it these assigned tests
would silently disappear from a fresh checkout. The existing `!/lib/**/data/`
exception is for the same reason.
## Behavior copied from the current web client
Requests are exactly the ones in `web/src/repository.js`:
- `list_schedules` with no field, or `pipeline_id` for one pipeline. A positive
safe integer is required before sending; `{type:"schedules"}` or
`schedules:null` is an empty list, while a reply without `type:"schedules"` is
an error, not "no schedules".
- `save_schedule` with `schedule` unchanged. A non-empty `request_key` (at most
128 characters) is added only for a create retry; updates omit it, as the web
editor does. Creation keeps the web sentinel `id: 0` and no revision. Updates
send the record read from the server, whose `revision` is the server's
compare-and-swap token. The reply is only accepted when it contains
`schedule`.
- `delete_schedule` with exactly `schedule_id` and `expected_revision`; only
`{type:"schedule_deleted", schedule_id:<same id>}` counts as success.
Server refusals are not wrapped or translated. `ApiGateway` already turns an
`error` envelope into `ProtocolError` with the server's text, and the repository
lets that object through unchanged (conflict and unknown-command coverage in
`server refusals and conflicts propagate verbatim`). The repository has no
capability flags, no "not supported" substitution and no local fallback.
Saved schedules are run configurations, never pipeline definitions. `SavedSchedule`
keeps the complete server map, including unknown future nested fields, and
exposes pipeline, version, prompt/input, workspace, rule (every/times/days/
timezone), enabled, model/stage models, notify mode, write paths/tools, title,
output format, due time and timestamps. `toJson()` is a deep copy; `withEnabled`
preserves identity, revision and unknowns. Missing identity/revision stays
`null` rather than becoming a fabricated `0`. There is no timer execution,
polling, rule parsing into due dates or timezone conversion in this slice.
## Checks actually run
```
flutter pub get
dart format lib/features/schedules test/features/schedules # 9 files, 5 changed, then clean
flutter test test/features/schedules/data # 18 passed
flutter analyze # No issues found! (1.4s)
flutter test # 70 passed
```
Focused coverage maps to the requested acceptance:
- exact `list_schedules`/`save_schedule`/`delete_schedule` bodies recorded by a
fake gateway, including `expected_revision` only on delete and no invented
create revision/key;
- untouched caller record on save; deep equality of returned records with the
server reply including unknown top-level/rule/input fields;
- update reuses revision 3, accepts server revision 4 and leaves the stale draft
at 3; a mismatch is the server's refusal, propagated verbatim;
- empty list vs missing/unsupported schedules reply, missing/invalid saved
schedule, and delete confirmation for the wrong id/type;
- preflight bounds match the web client: pipeline id, schedule id, revision and
129-character request keys send nothing; 128 characters is accepted;
- no fabricated identity when a reply contains an empty schedule object.
## Honest limits
- **No UI or wiring.** There is no schedules screen, editor, pause/delete control
or shell registration in this slice; the manager owns later UI integration.
No browser interaction or screenshot applies to this nonvisual item.
- **No live server used.** All checks use local recording fakes; no production
schedule, run or workflow was created, changed or deleted. No polling or
scheduler was touched.
- **Mobile unverified.** Only web-targeted Flutter tests and analysis ran. No
Android/iOS build, emulator, ADB or device was used; the code is pure Dart.
- **Not committed.** The stage instruction for this visit forbids commit, push
and deploy, so the candidate remains in the `flutter/s1-data` worktree for the
manager to inspect and commit. No deployment or preview was performed.
+167
View File
@@ -0,0 +1,167 @@
# S1b — saved-schedules list (read-only)
## What changed
App-only files; no existing feature, shell, `main`, pubspec, data/domain or
server source edited.
| File | Lines | Responsibility |
| --- | --- | --- |
| `lib/features/schedules/screen.dart` | 94 | `SchedulesScreen(gateway, onOpen, pipelineId)` body; owns controller, search text and scroll |
| `lib/features/schedules/ui/list/schedule_list_controller.dart` | 168 | list load, newest-only publish, search/enabled filter, failure classification, cached visible view |
| `lib/features/schedules/ui/list/schedule_list_view.dart` | 188 | adaptive list, loading/empty/error states, stable error-banner slot |
| `lib/features/schedules/ui/list/schedule_list_toolbar.dart` | 179 | native search, all/enabled filter, refresh, count |
| `lib/features/schedules/ui/list/schedule_list_row.dart` | 115 | tappable row with server fields |
| `lib/features/schedules/ui/list/schedule_list_format.dart` | 70 | honest value/date/count wording |
| `test/features/schedules/ui/list/schedules_screen_test.dart` | 171 | search, filter, empty-filter wording, onOpen, states, unsubscribe |
| `test/features/schedules/ui/list/schedules_refresh_test.dart` | 119 | query/scroll preservation across successful and failed refresh |
| `test/features/schedules/ui/list/schedules_layout_test.dart` | 79 | Material + Cupertino at 390px, 1x and 2x text |
| `test/features/schedules/ui/list/schedule_list_controller_test.dart` | 182 | envelopes, empty/unsupported/error wording, ordering, dispose |
| `test/features/schedules/ui/list/schedule_list_filter_test.dart` | 87 | search/filter behavior and cache invalidation |
| `test/features/schedules/ui/list/schedule_list_format_test.dart` | 72 | complete/missing/invalid values and fixed due-time wording |
| `test/features/schedules/ui/list/schedule_list_test_support.dart` | 143 | recorded/immediate and controlled fake gateways |
| `test/features/schedules/ui/list/schedule_screen_harness.dart` | 33 | 390px test app builder |
| `tool/schedules_list_probe_app.dart` | 110 | local-only browser fixture (fake schedules, light/dark) |
| `tool/schedules_list_probe.mjs` | 252 | real Chrome probe, content assertions, five captures |
## Behavior
`SchedulesRepository.listSchedules` and `SavedSchedule` are reused unchanged.
The screen calls only `list_schedules`, with `pipeline_id` when supplied. There
is no add/edit/delete/pause/enable control and no other request type.
- A valid empty reply shows `No schedules yet.` An older/unsupported envelope is
a distinct error (`This server does not support saved schedules…`), and a
transport/repository error keeps its actual text. A failed refresh with rows
already loaded keeps those rows and shows the error above them.
- Older-server detection now matches the web client's wording
(`unknown (message|request|command)` and `unsupported…schedule`, case
insensitive) in addition to the repository's `no schedules response` report,
so a real server refusal receives the same upgrade guidance as the web.
- Search matches schedule name, prompt and the actual pipeline ID (`Pipeline 4`,
including a bare `4`). No pipeline name exists in the saved-schedule record, so
matching names is not possible without another request; none is faked.
- Filter is `All` / `Enabled`. Paused rows remain visible under `All`. When the
search box is empty and only the filter hides every row, the empty state says
`No enabled schedules.`; an entered query still says
`No schedules match this search.`
- Rows show the server's pipeline ID, pinned version, workspace, timer rule,
timezone and `next_due`. Missing values stay `Pipeline unavailable`,
`Version unavailable`, `Workspace unavailable`, `Timer unavailable`; an
omitted/`Local` timezone is `Server timezone`; an absent/invalid due time is
`Not scheduled` / `Next time unavailable`; a paused row shows `Paused`.
Due values are converted to local time and labelled `(your local time)`,
matching the web client's wording.
- Selecting a row passes the exact `SavedSchedule` object from the loaded list to
`onOpen`; it does not re-fetch, copy into a draft or mutate it.
- Query, filter and list are not recreated by refresh, so the search text and
`ScrollController` offset survive. The failed-refresh banner occupies a
permanently present slot above the list, so showing or clearing it does not
change the list's ancestor chain or rebuild its `Scrollable`. Only the newest
refresh generation may publish; stale replies and replies after dispose are
ignored.
- The filtered view is cached in the controller and invalidated on query,
filter and new replies, so one rebuild does not repeat the same O(n) pass for
the body, count and toolbar.
Controls are native defaults: Material `TextField`, `SegmentedButton`,
`IconButton`, `TextButton`, `Divider`, `CircularProgressIndicator`; Cupertino
`CupertinoSearchTextField`, `CupertinoSlidingSegmentedControl`,
`CupertinoButton`, `CupertinoActivityIndicator`. No CSS palette, custom font,
fixed row height or bespoke control was added. Layout is a content-driven column
with wrapping text; a single max-width constraint keeps the filter compact on
wide screens.
## Review findings addressed
- **M1 (must-fix), failed refresh reset the scroll offset.** Reproduced with the
new `schedules_refresh_test.dart` against the previous structure: the test
failed because the `Expanded` child changed from `ListView` to
`Column(banner, Expanded(ListView))`, recreating the `Scrollable`. With the
permanent banner slot the test passes for both the failure transition and the
later recovery/retry, at the unchanged offset. The test was also run against a
temporary local revert of the fix and failed as expected, then restored.
- **Advisory 1**, filter-only empty state: now `No enabled schedules.` unless a
query is active.
- **Advisory 2**, older-server wording: web-parity regex added and tested with
raw `unknown request`, `UNKNOWN COMMAND` and `Unsupported schedules command`
errors; unrelated errors keep their exact text.
- **Advisory 5**, repeated filtering: visible list cached and invalidated.
- **Advisory 6**, test oracle: the layout test now asserts the literal
`Next due: 2026-10-22 09:00 (your local time)` from a zone-less fixture instant;
the duplicated formatter helper was removed from the harness.
- **Advisory 7**, Material dark evidence: the fixture accepts
`?brightness=dark` and the probe captures Material dark at 390px.
Advisory 3 (typed repository reason instead of matching a private message
string) needs a change in the landed `data/schedules_repository.dart`, outside
this list slice; the exact-string mapping is retained and documented. Advisory
4 (formatting in the rule's IANA timezone) still needs a timezone package.
## Checks actually run
```
dart format --set-exit-if-changed lib/features/schedules \
test/features/schedules/ui/list tool/schedules_list_probe_app.dart
# 19 files, 0 changed
flutter test test/features/schedules/ui/list # 29 passed
flutter test # 110 passed
flutter analyze # No issues found!
flutter build web # ✓ Built build/web
flutter build web -t tool/schedules_list_probe_app.dart # ✓ Built build/web
node --check tool/schedules_list_probe.mjs # clean
node tool/schedules_list_probe.mjs --out …/public/s1b-schedules-captures
# 5 captures, content assertions passed
```
The focused suite covers the list envelope (with and without `pipeline_id`),
empty vs unsupported vs transport errors, older-server wording, a failed refresh
retaining rows, out-of-order refresh, disposal safety, search/filter behavior and
cache invalidation, `onOpen` receiving the exact raw record, no mutation calls,
query preservation, a successful and a failed refresh preserving scroll (plus
recovery), filter-only empty wording, both MaterialApp and CupertinoApp at 390px
with 1x and 2x text, and no render overflow.
## Browser evidence
Real headless Chrome served the fixture build on an OS-assigned loopback port,
with explicit MIME types, Flutter semantics enabled, and content assertions
before each capture:
- `/Users/alan/.local/share/pipelines/data/artifacts/58/public/s1b-schedules-captures/s1b-schedules-material-390.png`
- `…/s1b-schedules-material-390-2x.png`
- `…/s1b-schedules-material-390-dark.png`
- `…/s1b-schedules-cupertino-390.png` (platform dark appearance)
- `…/s1b-schedules-material-1100.png`
- `…/manifest.json`
The fixture uses a local fake gateway with four records (enabled, paused, clock
rule, sparse record). It never contacted a Pipelines server, bypassed
authentication or created/changed a real schedule or run.
## Full diff
Every changed path is new and untracked; no pre-existing work was modified,
reset or deleted. The complete patch is saved at:
`/Users/alan/.local/share/pipelines/data/artifacts/58/public/s1b-schedules-list.diff`
## Honest limits
- **Not committed.** This stage forbids commit/push/deploy, so the candidate
remains uncommitted in the `flutter/s1-list` worktree for the manager.
- **Not wired into the shell.** `lib/main.dart`, `lib/shell/` and destination
registration are untouched; the Schedules destination still shows its
placeholder until the separate integration item.
- **No schedule editor.** Create/edit/delete/pause remain separate follow-up
items; no mutation was implemented or exercised.
- **Pipeline-name search unavailable.** The saved-schedule record exposes only
`pipeline_id`; search uses that exact ID rather than inventing a name.
- **Due times use the device timezone.** The absolute `next_due` instant is shown
as `(your local time)` and the rule timezone separately. The web client can
format in the rule's IANA timezone; that needs a timezone package not available
in this slice.
- **Mobile unverified.** No Android/iOS build, emulator, ADB or device was used.
- **Live server unverified.** Browser evidence is fixture-only by design; no
production authentication or schedule data was used.
+140
View File
@@ -0,0 +1,140 @@
# T1a — template catalogue, validate and create-only submit
## What changed
New nonvisual `templates` data/domain slice. One shared file was edited:
`app/.gitignore` re-includes `test/**/data/`, because the repository's runtime
`data/` rule was silently excluding this slice's tests from the candidate. No
other lane's work, `lib/main.dart`, shell, pubspec, `web/`, server or Android
file was touched.
| File | Lines | Responsibility |
| --- | --- | --- |
| `lib/features/templates/domain/template_entry.dart` | 63 | Immutable server template; models key/name/description/source/scheduled and keeps every unknown field in deeply read-only `raw` |
| `lib/features/templates/data/template_repository.dart` | 84 | `TemplateRepository(ApiGateway)`: list, validate, create-only submit |
| `test/features/templates/data/template_test_support.dart` | 47 | Recording/refusing fake gateways, server-refusal error, Unicode source fixture |
| `test/features/templates/data/template_list_test.dart` | 165 | Catalogue request shape, field preservation, deep immutability, missing/malformed catalogue |
| `test/features/templates/data/template_create_test.dart` | 147 | Validate/submit envelopes, blank-name gate, missing payloads, verbatim refusals |
| `app/.gitignore` | +4 | Re-includes `test/**/data/` so test files enter the candidate |
Nothing under `lib/main.dart`, `lib/shell/`, another feature, `pubspec.*`,
`web/`, the Go server or `android/` was changed. No dependency was added.
## Review findings addressed
- **Tests could never land (blocking).** `test/features/templates/data/` was
excluded by the repository root rule `data/`; `app/.gitignore` only re-included
`lib/**/data/`. The same negation now covers `test/**/data/`, so these three
test files are untracked-but-visible to git and `git add -n` succeeds. Fixing
the rule (rather than `git add -f`) also protects later `test/**/data/` lanes
such as S1a. No test was moved, so `test/` still mirrors `lib/`.
- **`raw` was only shallowly immutable (advisory).** `TemplateEntry.fromJson`
now deep-copies nested maps/lists into read-only collections, and the listed
test proves nested mutation throws and that the copy does not alias the reply.
- **Malformed-catalogue branches were untested (advisory).** Added tests for a
non-list `templates` value and a non-object catalogue entry, both rejecting
with explicit messages.
- `_text` still stringifies a non-string protocol value with `'$value'`; the
protocol only sends strings, and this matches how the browser would render
such a value, so the behaviour was left unchanged and is documented here
rather than claimed as strict parity.
## Wire behaviour (mirrors `web/src/repository.js`)
- `listTemplates()` sends exactly `{"type":"list_templates"}` with no fields and
returns the `templates` catalogue. A reply with no `templates` field is the
older server's empty catalogue (`?? []` in the browser), not a fake template.
Each entry keeps `key`, `name`, `description`, `source`, `scheduled` and all
unknown fields in `TemplateEntry.raw`; the reply list/maps are never mutated.
`raw` is a deep unmodifiable copy: nested unknown maps and lists are copied
into read-only collections, so neither the view nor a later caller can mutate
the server reply through it.
- `listTemplates()` rejects a malformed envelope instead of fabricating
entries: a non-list `templates` throws
`"The server returned no template catalogue."` and a non-object entry throws
`"The server returned a template that is not an object."`. The real server
cannot produce either, but a protocol mistake must not look like an empty or
half-populated catalogue.
- `validate(source)` sends exactly `{"type":"validate","source":<source>}` and
returns the reply's `graph`. A reply without a graph throws
`TemplateRepositoryException("The server returned no graph.")` — the browser's
exact words — rather than reporting a valid definition.
- `submit(name, source)` sends exactly
`{"type":"submit","name":<trimmed name>,"source":<source>,"create_only":true}`.
A blank/whitespace-only name is refused locally with
`TemplateRepositoryException("Enter a pipeline name.")` and no gateway call is
made; the accepted name is trimmed. A reply without `detail` throws
`TemplateRepositoryException("The server returned no pipeline detail.")`.
- The source string is never trimmed, normalised or re-encoded: Unicode, tabs,
newlines and significant leading/trailing whitespace arrive unchanged.
- A server refusal is never caught or reworded by the repository. It reaches the
caller as the same gateway error object, so the server's own text is shown.
- The repository exposes only these three operations. It has no publish, run,
schedule or overwrite path, so loading or validating a template cannot start
work or mutate a retained pipeline.
## Checks actually run
```
flutter pub get # Got dependencies
dart format lib/features/templates test/features/templates # clean
flutter analyze # No issues found! (0.9s)
flutter test test/features/templates # 13 passed
flutter test # 76 passed
flutter build web # ✓ Built build/web (15.5s)
git diff --check # clean
git check-ignore / git add -n # tests are no longer ignored
```
Tests are part of the candidate, not merely present on disk:
```
$ git add -n app/test/features/templates/data/template_list_test.dart \
app/test/features/templates/data/template_create_test.dart \
app/test/features/templates/data/template_test_support.dart
add 'app/test/features/templates/data/template_create_test.dart'
add 'app/test/features/templates/data/template_list_test.dart'
add 'app/test/features/templates/data/template_test_support.dart'
exit=0
$ git status --porcelain=v1 -uall
M app/.gitignore
?? app/lib/features/templates/data/template_repository.dart
?? app/lib/features/templates/domain/template_entry.dart
?? app/notes/T1a.md
?? app/test/features/templates/data/template_create_test.dart
?? app/test/features/templates/data/template_list_test.dart
?? app/test/features/templates/data/template_test_support.dart
```
Focused acceptance coverage:
- exact `list_templates` request (no fields, one call) and preservation of
modelled plus unknown fields, including nested unknown data;
- listing does not mutate the reply's template list or entry maps; `raw` and
every nested map/list are read-only, and the copy does not alias the reply;
- missing catalogue -> empty list; malformed catalogue -> explicit refusal;
- blank/whitespace name -> refusal with zero gateway calls;
- Unicode/emoji, tab/newline and leading/trailing source whitespace preserved in
both `validate` and `submit`; submit sends only name, source and
`create_only: true`, with the name trimmed;
- missing `graph` and missing `detail` rejected with the browser's exact
messages, with no fabricated graph/detail;
- validate and submit server refusals surface as the identical error object,
not a wrapper.
## Honest limits
- **Not wired into a screen.** This branch has no templates screen and the task
owns data/domain only; the manager owns integration. No browser capture was
made because there is no rendered change in this slice.
- **Mobile unverified.** No Android/iOS build, emulator, ADB or device was used.
The code is plain Dart with no platform-specific code.
- No live server, template catalogue, validate call or submit/creation was
performed. All tests use local fake gateways with no socket, so no real
pipeline was created or run.
- No export-gate workaround, server change or service operation was made; the
pending export-cap fix remains another lane's scope.
- **Not committed.** The stage instruction says not to commit, push or deploy,
so the candidate above is uncommitted in the working tree even though the run
prompt asks to commit a reviewed candidate. Nothing was pushed or deployed.
+121
View File
@@ -0,0 +1,121 @@
# X1 — Omni-search
## Scope and API
Implemented the `search` feature under `lib/features/search/` with no
`main.dart`, shell, pubspec, server, web or Android edits.
Entry point:
```dart
SearchScreen(
gateway: apiGateway, // required ApiGateway
onOpen: (hit) { ... }, // required ValueChanged<JsonMap>
cupertino: null, // optional; omitted = iOS/macOS Cupertino, else Material
)
```
`onOpen` always receives the server's original result map unchanged, including
its `target`. Unknown/absent payloads and results without a target are
read-only and never call `onOpen`; the client never invents a route or mutates
server state.
Request shape is exact and shared-gateway only:
```json
{"type":"search","search":{"query":"plan","kind":"","limit":0}}
```
`limit` is always `0` (server default cap), never a client-chosen larger value.
## Behaviour
- `t:`/`type:` tokens: unquoted, whitespace-delimited, case-insensitive, last
supported token wins; quoted, escaped, unknown and trailing-punctuation
tokens stay literal. The parser mirrors `web/src/search.js`.
- Kind selector: All kinds / Pipelines / Runs / Steps / Fields / Artifacts /
Versions. Changing it removes recognised type tokens from the field and sends
at once, like the browser's selector.
- Empty text with All kinds clears locally and sends nothing. Blank text with a
valid kind is a kind-only browse, matching the server/browser contract.
- 250 ms debounce; Enter sends at once. Every request carries a monotonically
increasing token, and replies for superseded edits are dropped.
- Loading, searching, retained-results refresh progress, empty (query-specific
and kind-only wording) and error are distinct. A truncated reply with no rows
says the server's scan limit was reached and keeps its truncation/scan bounds
on screen instead of claiming a complete empty; a complete empty has no bounds
line. A reply without `search_results` and an unknown-command rejection use
the server-upgrade sentence; any other failure shows the server's own text.
Error state offers Retry.
- Rows show the kind derived from the server payload (`Unrecognised result` for
an unknown payload), title, snippet (first case-insensitive query occurrence in
bold), and recency. Bounds show result count, cap, scanned steps/bytes, scan
limit and a truncation sentence when the server reports it, including for a
truncated reply with zero rows.
- In-hand results are re-narrowed by the effective kind while a narrowed request
loads, so the list always agrees with the control.
- Standard platform controls only: Material `SearchBar`, dropdown,
`LinearProgressIndicator`, `CircularProgressIndicator`, `ListTile`,
`FilledButton.tonalIcon`; Cupertino `CupertinoSearchTextField`, action-sheet
kind picker, `CupertinoListSection`/`CupertinoListTile`,
`CupertinoActivityIndicator`, `CupertinoButton.filled`. No CSS port, custom
palette, fixed row/bubble dimensions or bespoke buttons. Typography and
colours come from the ambient Material/Cupertino theme; rows and the header
scroll in one `CustomScrollView` so 2× text never clips.
## Automated checks
Run from `app/` with `/Users/alan/development/flutter/bin/flutter`:
- `flutter test test/features/search` — **36 passed** (controller, repository,
query/token parser, row/snippet/routing, Material + Cupertino widget tests).
- `flutter test` — **65 passed** (whole app suite, including existing transport,
runs and shell tests).
- `flutter analyze` — **No issues found**.
- `flutter build web` (default `lib/main.dart`) — **succeeded**.
- `flutter build web -t tool/search_fixture/main.dart` — **succeeded** for the
rendered probe.
- `node --check tool/search_probe.mjs` — passed.
- `git diff --no-index --check /dev/null <file>` on every touched file — no
whitespace errors (all task files are untracked, so plain `git diff --check`
would not see them).
Tests were written before the implementation (initial run failed on missing
symbols). Coverage includes the exact envelope, token parsing, selector token
clearing, no-request empty state, stale success and failure replies,
error/retry, truncation/bounds (including a truncated reply with zero rows),
per-kind row text, snippet spans, read-only hits, `onOpen` targets, and
MaterialApp/CupertinoApp at 390/1000 wide with 2× text.
## Rendered browser evidence
Built the Web-only fixture (`tool/search_fixture/main.dart`) and drove real
headless Chrome through CDP with `tool/search_probe.mjs` on an OS-assigned
loopback port. The probe typed `plan` into the real field, asserted five rows,
the server snippet, recency and truncation/scanned bounds, then clicked the
pipeline row and asserted that the fixture receiver got `pipeline:24`. It also
typed `needle` with no matching fixtures and asserted the Material and Cupertino
truncated-empty copy plus the retained `Results truncated … 0 results … scanned
2000 steps … scan limit 1.0 MiB` line, capturing both.
Captures are in the run's shared artifacts:
- `/Users/alan/.local/share/pipelines/data/artifacts/49/public/x1-search/x1-search-material-phone.png` — 390×844, Material controls, five mixed-kind results with recency/snippet/bounds.
- `/Users/alan/.local/share/pipelines/data/artifacts/49/public/x1-search/x1-search-material-desktop.png` — 1280×800, same results.
- `/Users/alan/.local/share/pipelines/data/artifacts/49/public/x1-search/x1-search-cupertino-phone.png` — 390×844, Cupertino search field/kind picker/grouped rows, dark system theme.
- `/Users/alan/.local/share/pipelines/data/artifacts/49/public/x1-search/x1-search-open-target.png` — the row click landing on `Opened pipeline target: pipeline:24`.
- `/Users/alan/.local/share/pipelines/data/artifacts/49/public/x1-search/x1-search-truncated-empty.png` — 390×844 Material, zero rows with the server's scan-limit sentence and truncation/scan bounds.
- `/Users/alan/.local/share/pipelines/data/artifacts/49/public/x1-search/x1-search-truncated-empty-cupertino.png` — 390×844 Cupertino dark, the same bounded empty state.
The fixture and probe are development-only entry points; they are not imported
by `lib/main.dart` and are not part of the production routing. The browser run
used a static fake gateway, not a live Pipelines server or operator data.
## Not verified / open items
- No shell registration or navigation wiring was added (manager owns
`main.dart`/`shell/`); the screen is exported for that integration.
- No real server, operator chat/run, or production URL was used.
- Mobile targets (Android/iOS) were **not** built, installed or exercised;
only Web was rendered and tested. Source is kept portable.
- No commit, push, deployment or canonical URL change was made.