merge(app): land retry wiring in the native run detail

Conflicts: app/lib/features/runs/ui/run_detail_actions.dart.
Keep main's recorded-artifacts action and the retry branch's spaced,
render-gated Wrap: Rename, Retry, Cancel, then Recorded artifacts.
This commit is contained in:
2026-10-21 22:52:00 +01:00
56 changed files with 8712 additions and 69 deletions
+150
View File
@@ -0,0 +1,150 @@
# A1-wire — native Artifacts action and recorded-group gallery
## What changed
The run detail now offers a standard native **Artifacts** action whenever the
loaded detail carries steps. It pushes a native page that lists the recorded
stage/visit groups from the landed `artifactGroups`/`ArtifactVisitList`.
Selecting a row opens the host's native dialog with the recorded name, MIME and
size, the visit's own capture facts, and — only when the recorded url resolves
through the existing `resolveArtifactUrl` rules — native **Open** and a separate
**Copy link**.
| File | Lines | Responsibility |
| --- | --- | --- |
| `lib/features/artifacts/ui/artifact_gallery_action.dart` | 104 | Action gate, steps snapshot, native button, page push |
| `lib/features/artifacts/ui/artifact_gallery_page.dart` | 194 | The page: summary/empty state, list, selection, Open/Copy link |
| `lib/features/artifacts/ui/artifact_selection_facts.dart` | 71 | Group→step map and the recorded-facts widget |
| `lib/features/artifacts/ui/artifact_external_open.dart` | 14 | `ArtifactExternalOpen` capability + default |
| `lib/features/artifacts/ui/artifact_external_open_web.dart` | 20 | `window.open` through `js_interop` (JS and wasm) |
| `lib/features/artifacts/ui/artifact_external_open_stub.dart` | 6 | Non-web refusal (no launcher dependency in this slice) |
| `lib/features/artifacts/ui/artifact_visit_list.dart` | +28/-25 | Exposes the landed label helpers the page reuses |
| `lib/features/runs/ui/run_detail_actions.dart` | +3 | Composes the action beside Rename/Cancel |
| `test/features/artifacts/ui/artifact_gallery_page_test.dart` | 321 | Page, identity, capture facts, url rules, copy |
| `test/features/runs/ui/run_artifacts_action_test.dart` | 161 | Action gate and wiring on both hosts |
| `tool/artifact_gallery_probe.dart` | 232 | Isolated fixture entry (real `RunDetailView`) |
| `tool/artifact_gallery_probe.mjs` | 421 | Loopback server + headless Chrome driver |
No shell/main, pubspec, `web/`, Go server, `android/` or other feature was
edited. No dependency was added.
## Behaviour
- **Gate.** `showRunArtifactsAction` is true exactly when the loaded detail has
at least one step. A detail with no steps shows no action; the page also has
an explicit `No steps recorded for this run.` state if ever reached.
- **Truthful empty/unavailable.** The page header is the landed
`artifactsHeader`: `Artifacts · N recorded` (`· partial capture` when a visit
excluded/omitted files), `Artifacts · capture pending` while executing,
`No artifacts recorded for this run.` only for a recorded empty capture, and
`Artifacts · capture unavailable` when the field was absent. An unavailable
capture never says nothing was recorded.
- **Selection identity.** `ArtifactVisitList` selection uses
`artifactVisitIdentity`; two visits that both recorded `result.csv` stay two
distinct rows and selections (unit + browser evidence).
- **Facts.** The dialog shows the recorded filename (or `(unnamed artifact)`),
the recorded MIME/size (`type not recorded` when empty), the group's
`stage · visit N`, the visit's `artifactsSummary` and its
`artifactCaptureNotes`. Nothing is inferred from a name.
- **Url rules.** Open/Copy link appear only when `resolveArtifactUrl` returns a
value: absolute http(s) or a server-relative path resolved against the
configured endpoint. Protocol-relative, credentialed, malformed and
non-http(s) urls are rejected and the dialog says
`The recorded artifact URL cannot be opened safely.` A record with no url says
`No artifact URL recorded.` and offers no action. The endpoint comes from the
app's shared `PipelinesClient` when the gateway exposes it; a fixture gateway
leaves it blank, which only disables relative resolution.
- **Open vs copy.** Open calls the injected `ArtifactExternalOpen` with the
resolved `Uri` (web: a new tab via `window.open` reached through
`js_interop`, so it compiles for JS and wasm). Copy link is a separate action
that writes the resolved url to the clipboard. Each reports
`Link opened externally.` / `Could not open the link.` and `Link copied.` /
`Could not copy link.` as an inline live region.
- **Controls.** Material uses `FilledButton.tonalIcon` + `AlertDialog`; Cupertino
uses `CupertinoButton.tinted` + `CupertinoAlertDialog` and the grouped page
background. No fixed row/button sizes, custom font or palette. The Cupertino
action is text-only: the icon variant overflowed by 11 px at 2x text on 390 px
(caught by the existing `run_detail_widget_test`), and dropping the icon keeps
the label whole without clipping.
- **Out of scope, labelled next:** in-app preview/viewer, download, share files,
gallery filters and any network artifact fetch were not written.
## Checks actually run
```
flutter analyze # No issues found
dart format --output=none --set-exit-if-changed ... # 0 changed
flutter test test/features/artifacts test/features/runs # 203 passed
flutter test # 712 passed (whole app)
flutter build web # ✓ Built build/web
flutter build web -t tool/artifact_gallery_probe.dart # ✓ Built build/probe-gallery
node --check tool/artifact_gallery_probe.mjs # ok
node tool/artifact_gallery_probe.mjs ... # 13/13 checks, 16 captures
```
`git status --short --untracked-files=all` lists only the files above;
`pubspec.yaml`/`pubspec.lock` are unchanged. No commit, push or deploy.
## Real browser evidence
`tool/artifact_gallery_probe.dart` renders the real `RunDetailView` over a fake
`get_run` gateway; `tool/artifact_gallery_probe.mjs` serves the build on an
OS-assigned loopback port and drives headless Chrome. Recorded urls point at the
probe's own loopback origin (plus unsafe/no-url/empty/unavailable states). No
server or operator run was touched.
13/13 checks passed; 16 captures in
`/Users/alan/.local/share/pipelines/data/artifacts/81/public/a1-wire/`
(`evidence.json` holds the machine-readable result):
- The run detail offers the native Artifacts action; the page lists the actual
recorded rows (`build.log`, `shot.png`, two `result.csv` visits, group
headings, MIME/size), not nav labels.
- Selecting the lower duplicate `result.csv` selected `reviewer · visit 2` with
its own `Artifacts · 1 recorded · partial capture` and
`2 files excluded from artifact capture.`
- The safe selection offers native **Open** and a separate **Copy link**; a
protocol-relative url offers neither and shows the unsafe wording; a url-less
record shows `No artifact URL recorded.` and no action.
- A recorded empty capture says `No artifacts recorded for this run.`; an
unavailable capture says `Artifacts · capture unavailable` and never the empty
wording.
- Cupertino lists the same rows with its native dialog and actions; dark
Cupertino dialog text samples light (max luminance 1.0).
- Both hosts at 320 px / 2x text keep the recorded rows, facts and actions
whole.
Captures: `a1w-material-{detail,gallery,selected,open,unsafe,nourl,empty,
unavailable}.png`, `a1w-cupertino-{gallery,selected,dark-gallery,
dark-selected}.png`, `a1w-{material,cupertino}-2x-320-{gallery,selected}.png`.
## Not verified / limits
- The actual new-tab open could not be driven in headless Chrome: a synthetic
semantics activation carries no user gesture, so the app reports its honest
`Could not open the link.` refusal path. The browser proves the action is
offered only for a safe resolved url; the widget test proves the exact
`http://127.0.0.1:8081/artifacts/1/1/result.csv` uri handed to the opener and
the clipboard write. A genuine user tap was not captured.
- Non-web external open returns false (no launcher dependency is in scope); the
page reports that refusal. Mobile targets were not built or run, so **mobile
remains unverified**.
- All data is fixture data; no live server or operator run was used.
- Page/viewer/share/download/filters are not part of this slice and are labelled
as next work.
## Manager completion after the Code deadline
The Code visit hit its 30-minute deadline while still active; its session settled
and all edits were retained. No retry was started. The manager confirmed the dirty
paths were exactly this slice, then ran the focused artifacts/UI tests (29 pass),
analysis, and the fixture probe. The probe covers both hosts plus 320px/2x and
produced 16 captures (detail, gallery, selected facts, Open, unsafe url, no url,
empty, unavailable capture). The Cupertino dark selected dialog and the Material
320px/2x selected dialog were inspected: recorded name/MIME/size, the visit's own
capture facts, excluded-file note, and distinct Open / Copy link / Close where a
safe url exists.
Deliberate scope: this slice links to a validated url externally and copies that
link. It performs no in-app preview, download or file sharing, so the artifact
viewer/Share rows in app/PARITY.md remain open.
+103
View File
@@ -0,0 +1,103 @@
# P2 stage: read-only definition pane
The definition graph can now open one stage's authored definition without
reading a run. `StageDefinitionView` receives the graph JsonMap pinned for a
pipeline/version, a stage key and that identity; it performs no request and
shows no visit, status or session data. `openStageDefinition` pushes the
platform's normal page with one navigation bar and its standard back control,
for the manager's graph hook.
## Behaviour
- Fields match `stageDefinitionFields`/`terminalFields` in `web/src/graph.js`:
Type, Prompt, Output, Outcomes (ordered, targets resolved, terminals marked),
configs in sorted order with the web labels, Tools, Max visits, Limit on,
Memory, Notify on/destination/artifacts. Only non-blank fields are emitted.
- `effectiveStageType` keeps the web rule that a blank/absent type reads
`model`; no other default is invented.
- A terminal (`#success`/`#failure`) lists its incoming definition routes and
says explicitly that these are definition targets, not recorded visits. Its
page is titled with the web's display label (`Failure definition` /
`Success definition`, via `nodeDisplayLabel`), never the raw `#failure` key.
- A stage key this version does not declare gets an explicit missing state. No
fields, terminal note or raw JSON are fabricated.
- Every declared stage also shows its exact pretty-printed stage JSON in a
selectable raw section, so unknown/future fields stay available. The raw
value is the only source for those keys; the structured rows only interpret
documented ones.
- Host text roles only: Material `Theme`/`ColorScheme`, Cupertino
`CupertinoTheme`/`CupertinoColors`, system fonts, light/dark and text scale
follow the host. No palette, font family, fixed component size or custom
control clone.
- Selectable body blocks force a strut derived from that same host style.
Without it, a glyph the host font lacks (the outcomes arrow `→`) pulls in a
fallback font with taller metrics and doubles only that block's leading. The
strut is the host's own family/size, not a font override or fixed height, and
selection stays native.
## UI review fixes
- Cupertino `Outcomes` leading: the block's rendered line pitch matched a
fallback font (34 px between outcome lines against 19 px for `Tools` at 1×,
68 px against 30 px at 2×). With the forced host strut the line pitch is
19 px for both blocks at 1× and 37/39 px at 2×, and the semantics block
heights are equal (72/72 at 1×, 123/123 at 2×). The 390×844 / 2× wrap of
`(terminal)` now sits on the same rhythm as the line above it.
- Terminal titles: `#failure definition`/`#success definition` became
`Failure definition`/`Success definition`. The Cupertino widget test now
asserts `Success definition` and the absence of the raw key; a Material
test covers `Failure definition`; the browser probe fails if `#failure`
reappears in the terminal page or if the outcomes/Tools block heights
diverge.
## Integration dependency
`PipelineDetail` still has no `graph` field, so the manager's graph hook must
supply the pinned JsonMap it already draws. This item deliberately does not
change the pipeline repository/model. There is no run-mode latest-visit pane
here; recorded visits remain the separate run-graph/audit work.
## Checks run
- `flutter test test/features/graph` - 140 tests passed (138 before; two new
regression tests for the terminal title and the forced host strut).
- `flutter analyze` - no issues.
- `dart format --set-exit-if-changed` on the five Dart files - 0 changed.
- `flutter build web` (normal app) - succeeded.
- `flutter build web -t tool/stage_definition_probe.dart` - succeeded.
- `node --check tool/stage_definition_probe.mjs`.
- Real Chrome probe, 1280x900: material dark/light 1x, Cupertino dark/light 1x
and Cupertino dark/light 2x. Each case passed 9 checks and produced 5
captures. The probe now compares the `Outcomes` and `Tools` semantics block
heights (equal in every case), fails on any raw `#failure` in the terminal
page, asserts `Failure definition`, and scrolls to the pane bottom so the
raw capture really shows `future_field.kept` and `fallback_error`.
- Real Chrome probe, 390x844: Cupertino dark 2x and Material light 1x. Each
passed 8 checks and produced 5 captures, including the `(terminal)` wrap and
the raw JSON at the narrow width. The accent-free rhythm check is skipped at
this width because the outcomes value wraps to three lines.
- Pixel measurement of the final captures: Cupertino 1x outcomes 19 px vs
Tools 19 px (was 34 vs 19); Cupertino 2x outcomes 37 px vs Tools 39 px (was
68 vs 30); Material 1x outcomes 19 px vs Tools 20 px.
Captures (under the run's shared artifact folder
`public/stage-definition/`): `<host>-<scheme>-<scale>x-{declared,raw,terminal,unknown,closed}.png`
for the six 1280x900 cases, and the same names prefixed with `stage-definition-`
under `narrow-390x844/` for the two 390x844 cases. The raw capture is the real
bottom-scrolled state and its sha1 differs from the declared capture in every
case.
Mobile (Android/iOS) remains unverified; only web was run.
## Manager completion after result-validation failure
Run 77's final Review visit returned no parseable outcome, so the runner retained
its edits and failed the stage without undoing them. No retry was started. The
manager verified the dirty files were the reviewed slice only, ran the focused
domain/view tests (10 pass), and drove the real-browser probe on both hosts:
Material light 1x desktop and Cupertino dark 2x 390x844. Each run passed and
produced five captures (declared, raw, terminal, unknown, closed) under approved
temp/stage-def-browser. The Cupertino dark 2x declared pane was inspected: pinned
identity, wrapping outcome line, native type roles, readable secondary labels.
This remains a definition pane only; run visits and the pipeline graph hook are
separate work.
+62
View File
@@ -0,0 +1,62 @@
# Attention model (pure domain)
The `Needs you` model exists as reusable, widget-free Dart under
`lib/features/attention/domain/`. The list, identity, wording and local-day
window mirror the browser's `src/attention.js`; no UI, storage plugin,
notification permission or API request is added here.
`attention_transitions.dart` is an attention transition ledger, not a port of
`src/notify.js`: notification permission, tray alerts, `notify_mode` suppression
and success alerts are deliberately outside this slice.
- `attention_models.dart` owns the two kinds (`Decision` rank 0, `Failed` rank 1),
qualification, ordered entries, labels/detail wording, `{runId}:{kind}`
identities, dismissal/snapshot bookkeeping and the JSON string-array
serialisation under this app's own `pipelines.next.attention.v1` (deliberately
not the legacy web key, so neither client rewrites the other's local state).
- Only `waiting` and `failed` statuses qualify, after trimming/lowercasing. A
waiting run with a session audit/export handoff (`export_pending_sequence > 0`)
asks no person and is excluded; a failed run stays failed. `resource_wait` is
deliberately not consulted, matching `web/src/attention.js` and `Attention.kt`
(the server retired the field, and a stale value must not hide a decision).
- The surface is today's work: `attentionEntries` accepts an optional `since`
cutoff and drops an entry when its recency parses and is before it, keeping a
blank or unreadable recency, exactly as the browser does. No cutoff (or an
epoch-zero one) shows everything. Callers pass `startOfLocalDay()` to the bell,
the sheet and the Clear-all snapshot, so yesterday's failures become history.
Stored dismissals themselves still never expire.
- `startOfLocalDay({now})` returns local midnight and takes an injectable `now`
so the UI does not re-derive it and tests stay deterministic.
- Ordering is kind rank, then `finished_at` else `created_at` descending using the
server's timestamp text, then run id descending. The label is the trimmed title
else pipeline name; the detail is `Waiting for your decision`, or the trimmed
diagnostic else `Run failed`.
- Entries retain the whole source summary map, so fields this model does not read
(and unknown future fields) are preserved. `AttentionEntry` is constructed only
by `attentionEntryFor`, so its `runId` is always a validated positive id.
- `attention_transitions.dart` is a pure detector: a seed/first-seen run,
duplicate frame, nonqualifying status, export wait, reconnect reseed or a
snapshot bracketed with `beginSeed`/`endSeed` never emits. It emits once when a
known run enters `failed` or a human `waiting`, forgets the key when the run
leaves that state, and keeps the emitted set across `resetForReconnect`/`reseed`
so a gap cannot replay a transition. A reseed keeps the key of a run that still
qualifies (or that is absent from the read) and prunes one whose run no longer
asks. Dismissed identities are marked seen but suppressed.
Focused tests in `test/features/attention/` cover qualification and exclusions,
ordering and tie-breaks, the local-day cutoff (older/newer, unparseable/blank
recency, no cutoff, decisions, dismissal composition), wording/labels, identity,
dismissal filtering, the clear-all snapshot, defensive copying, malformed/blank
storage, unknown-field preservation, and transition dedupe/first-seen/
nonqualifying/reconnect reseed/emitted-key retention.
Verification: `flutter test test/features/attention` passed all 44 tests;
`flutter analyze` reported no issues. No browser capture applies to this
nonvisual domain slice.
Not done here: no `Needs you` screen/sheet, badge, storage write, store/controller
wiring or notification permission was added, and `PARITY.md` remains `Missing`
until those land. The older `orderAttention` helper in
`lib/features/runs/domain/run_models.dart` was left untouched for lane ownership;
the runs UI must delegate to this model when it is wired, so the two authorities
cannot diverge. Mobile is unverified.
+196
View File
@@ -0,0 +1,196 @@
# S1-form — native saved-schedule form
Manager acceptance: merged after inspecting the new-source-only diff. Re-ran all
schedule tests and rebuilt the fixture; the probe passed every step and produced
seven captures. Inspected the Cupertino dark phone form and the 320px/2x Material
form: full wrapping labels, native fields/menus/switches, readable semantic error
colour, no clipped helper copy. The form mutates only the caller-owned draft and
calls the injected submit callback, so no repository/route/scheduler is implied.
Schedule persistence, pause/delete, conflicts and the Schedule-this-run seed are
still separate wiring work; nothing was saved to a real server.
## What changed
New files only. No existing feature, shell, route, `main`, pubspec, server, `web/`,
Android/iOS or deployment source was edited.
| File | Lines | Responsibility |
| --- | ---: | --- |
| `lib/features/schedules/ui/editor/schedule_editor_form.dart` | 234 | state/controllers, submit/validation/refusal, native Cancel/Save actions |
| `lib/features/schedules/ui/editor/schedule_editor_form_body.dart` | 229 | visible column: heading, note, native fields, live error slot |
| `lib/features/schedules/ui/editor/schedule_editor_fields.dart` | 191 | wrapping label shell, native text field/switch, host secondary/error styles |
| `lib/features/schedules/ui/editor/schedule_editor_selectors.dart` | 200 | native timer/notification menus and weekday checkboxes |
| `lib/features/schedules/ui/editor/schedule_editor_wording.dart` | 45 | verbatim browser copy and stable keys |
| `test/features/schedules/ui/editor/schedule_editor_form_test.dart` | 162 | invalid/create/clock/edit record tests |
| `test/features/schedules/ui/editor/schedule_editor_interaction_test.dart` | 164 | refusal, duplicate submit, Cupertino fields/switch/day, Cancel |
| `test/features/schedules/ui/editor/schedule_editor_layout_test.dart` | 80 | 320px/2x wrapping and native dark Cupertino |
| `test/features/schedules/ui/editor/schedule_editor_harness.dart` | 82 | 390/320 Material and Cupertino hosts |
| `tool/schedule_editor_probe_app.dart` | 170 | standalone local fixture with refusing/accepted fake callback |
| `tool/schedule_editor_probe.mjs` | 368 | real Chrome interaction and seven captures |
The original aim was two production files. The landing draft, the form state, the
native control primitives, the selectors and the verbatim copy do not fit under
the working agreement's 250-line aim together, so they are split by
responsibility rather than into arbitrary fragments. No generic form framework,
inherited controller or schema was introduced; every file is specific to saved
schedules.
## Behavior
`ScheduleEditorForm` binds the landed `ScheduleDraft` and nothing else. It opens
with the draft's current values and mutates only the editable fields on submit.
It then calls `draft.build()`:
- invalid draft — the returned field errors are shown under their controls and
the injected callback is **not** called; there is no partial record;
- valid draft — every control is disabled, Save reads `Saving…`, and
`onSubmit(record)` receives the exact non-null `build()` record once;
- async refusal — controls re-enable, typed controller values stay verbatim,
and the form shows `"<server reason> Your draft is preserved. If this schedule
changed elsewhere, reopen it before retrying."` (a blank reason gets `The
schedule was not saved.`). The line is a live-region semantics node, so it is
announced like the browser's `role="alert"`; the browser probe asserts its
visible text after scrolling to it.
After an accepted callback the form re-enables; the integrating caller owns
closing/replacing it, exactly as the web editor closes its modal on success. No
close/route/save logic exists in this slice.
The form reads its draft once, in `initState` (the Material selectors also take
an `initialValue`). A caller that reuses the widget with a different draft must
give it a new key, e.g. by operation or `draft.id`, so the controls reinitialise;
mutating the draft in place without a new key is not reflected in the UI.
Editable in this slice: name, prompt, pinned version, absolute server workspace,
timer mode, interval, clock times, weekdays, timezone, enabled and notification
mode. `draft.source`/`pipelineId` are not editable here. The advanced run options
(`model`, `stage_models`, other input keys, `write_paths`, `allow_tools`, `title`,
`output_format`) are not rendered and are **preserved exactly** because the
landed draft starts every edit from the server snapshot. A create still emits the
web sentinel `id: 0`; an edit keeps its exact `id` and `revision`.
Weekday toggles send one day key per interaction and the form applies them in
server weekday order, so two quick taps cannot lose the first selection. A raw
notification value outside `auto|on|off` stays visible/selectable and is then
rejected by the draft's validation rather than crashing a dropdown assertion.
## Native presentation
- Labels are wrapping text above each control, matching the browser's sibling
label word and avoiding a floating-label ellipsis at 2x text. Helper text and
field errors wrap below the control; no fixed control/row heights.
- Material: `TextField`, `Switch`, `Checkbox`, `DropdownButtonFormField`,
`TextButton`, `FilledButton`.
- Cupertino: `CupertinoTextField`, `CupertinoSwitch`, `CupertinoCheckbox`,
`CupertinoButton` menuing through `CupertinoActionSheet`, plus the same
`CupertinoButton` actions.
- Typography and colours come from `Theme`/`CupertinoTheme` semantic roles and
dynamic label/secondary/error colours. Material helpers use `bodySmall`; the
Cupertino secondary style stays on the theme's text style at the native 14pt
detail size and is still scaled by the text scaler. No bespoke palette or
control clone was added.
- The dark Cupertino fixture is a real `CupertinoApp` with
`CupertinoThemeData(brightness: dark)`; its base page background is the native
`systemBackground` black, while fields, labels, blue actions and the green
switch resolve from the dark Cupertino roles. The widget test also asserts the
dark brightness, dark label colour and that no Material control is present.
## Browser fixture
`tool/schedule_editor_probe_app.dart` is standalone: an in-process
`ScheduleDraft.create` (pipeline 4, version 2, `/srv/research`,
`Europe/London`) and a fake `onSubmit`. The first valid submit is refused after
900 ms; the retry is accepted. The state is published at
`globalThis.scheduleEditorProbe`; the accepted record is rendered on the page.
No socket, server, authentication or real schedule is involved.
## Checks actually run
```
dart format lib/features/schedules/ui/editor test/features/schedules/ui/editor \
tool/schedule_editor_probe_app.dart # clean
flutter analyze # No issues found!
flutter test test/features/schedules # 69 passed
flutter test # 686 before merging main;
# 704 on the merged tree
flutter build web # ✓ Built build/web
flutter build web -t tool/schedule_editor_probe_app.dart \
-o build/schedule_editor_probe_web # ✓ Built
node --check tool/schedule_editor_probe.mjs # clean
OPENCODE_ARTIFACT_DIR=…/78/public/s1-form-captures \
node tool/schedule_editor_probe.mjs # all checks passed
```
After merging the current `main` into `flutter/schedule-form` (conflict-free;
the incoming work was unrelated template and chat-composer state changes), the
same checks were re-run on the merged tree: `flutter analyze` clean, 69 schedules
tests, 704 whole-app tests, `flutter build web`, and all six fixture probe checks
with no page errors.
Browser checks that actually ran in real headless Chrome against the fixture:
- blank submit: 0 callbacks, both field errors exposed;
- first valid submit: pending state, 1 callback, a second click left the count at
1;
- refusal: `lastError = conflict: revision 13 is stale`, `records = 0`, name and
prompt still `Probe schedule` / `Summarise the release notes.`, and the visible
line contains `Your draft is preserved.`;
- retry: exactly one accepted record, deep-equal to
`{id:0, name:"Probe schedule", pipeline_id:4, version:2, enabled:true,
input:{prompt:"Summarise the release notes."}, workspace:"/srv/research",
rule:{every:"24h", timezone:"Europe/London"}, notify_mode:"auto"}`;
- 320px at 2x text: labels/helpers and both actions still present and readable;
- Cupertino dark at 390px: native fields, switch, checkboxes and actions rendered.
Captures (shared artifact):
```
/Users/alan/.local/share/pipelines/data/artifacts/78/public/s1-form-captures/
s1-form-material-390-invalid.png
s1-form-material-390-refusal.png
s1-form-material-390-record.png
s1-form-material-320-2x-top.png
s1-form-material-320-2x-bottom.png
s1-form-cupertino-dark-390-top.png
s1-form-cupertino-dark-390-bottom.png
manifest.json
```
The refusal copy is visible in
`s1-form-material-390-refusal.png`; the exact accepted record is visible in
`s1-form-material-390-record.png`; wrapping at 320/2x is visible in the two
`320-2x` captures.
## Full diff
Every path is new; no existing file is modified. The reviewed patch is committed
as `feat(app): add native saved-schedule editor form` on
`flutter/schedule-form`, followed by a conflict-free merge of `main`. The
reviewed patch snapshot, taken before these landing-state note edits, is saved
at:
`/Users/alan/.local/share/pipelines/data/artifacts/78/public/s1-form.diff`
## Honest limits
- **Committed but not deployed.** The candidate commit is merged with `main` and
checked on `flutter/schedule-form`; no push, deployment or canonical URL
change was performed by this work.
- **Not wired into the normal Schedules screen or shell.** There is no editor
dialog/route, no `screen.dart` integration and no navigation; the Schedules
destination's editor entry is a later integration slice.
- **No save engine, repository, network, create/update/pause/delete.** The form
only calls its injected callback and never opens a socket. The existing draft
and repository were not changed.
- **Advanced run options stay preserved but are not editable** in this slice
(`model`, stage models, other input keys, write paths, allow tools, title,
output format). No control was invented for them.
- **Timezone validity remains the landed draft's structural check.** The UI only
displays the draft's error; Dart still has no IANA database here.
- **Mobile unverified.** Only web-targeted Flutter tests/analyze/build ran. No
Android/iOS build, emulator, ADB or device was used.
- **Live server unverified.** Browser evidence is fixture-only; no production
authentication, schedule or run was created or changed.
- **Refusal prefix is the caller's error text.** The real `ProtocolError` has a
clean `toString()`; the fixture throws a custom refusal so the capture does not
show Dart's `Bad state:` prefix from `StateError`.
+183
View File
@@ -0,0 +1,183 @@
# T1 — reusable native Templates gallery
Manager acceptance: re-ran the templates suite (38 tests) and rebuilt the
in-process fixture. Seven probe checks pass with seven captures under approved
temp/templates-gallery-browser; the selected-template capture was inspected and
shows metadata, the verbatim selectable source and the native create action with
one bar. No real template was created or submitted; every request came from the
fixture gateway. Settings/route registration and a post-create pipelines-list
refresh are still manager wiring, not claimed here.
## Result
`TemplatesScreen` is one reusable gallery over the server's actual template
catalogue. It lists every `list_templates` row, opens the selected template's
metadata and its source byte-for-byte in the host's selectable body, and offers
the browser's one create action. That action calls the already-landed
`showTemplateCreateDialog` unchanged, so validate-then-submit, Cancel,
create-only `submit` and the single accepted `detail` stay in the existing
prompt. The accepted detail is forwarded through the optional `onCreated`
callback.
A refused refresh is reported above whichever body is current, including an open
template, with the host's native Retry; the selection and already-read rows are
kept. The screen's loading state, late-reply guard and single create path are
unchanged.
Nothing is registered in the shell, Settings, routes or application; the
manager owns that next. No pipeline/gallery/create code was rewritten and no
run, schedule, publish, cancel or graph control exists here.
## Files (all new; no tracked file modified)
| File | Lines | Responsibility |
| --- | ---: | --- |
| `lib/features/templates/screen.dart` | 208 | Load/selection/create state, late-reply sequencing, failure banner above either body, embedded flag, system back |
| `lib/features/templates/ui/template_gallery.dart` | 138 | Catalog rows and honest loading/empty/full-failure states |
| `lib/features/templates/ui/template_detail.dart` | 168 | Browser wording, metadata, verbatim selectable source, create action, embedded Back row |
| `lib/features/templates/ui/templates_failure.dart` | 118 | Full failure state and the screen-level failed-refresh banner, each with native Retry |
| `lib/features/templates/ui/templates_frame.dart` | 104 | Native standalone app bar or embedded Refresh row; Back/Refresh controls |
| `test/features/templates/ui/template_gallery_test_support.dart` | 112 | Recording gateway, catalogue fixtures, Material/Cupertino host pump |
| `test/features/templates/ui/template_gallery_screen_test.dart` | 379 | States, retry, refresh, detail-refresh failure (both hosts, embedded), back, embedded, 2x, late/disposed replies |
| `test/features/templates/ui/template_gallery_create_test.dart` | 104 | Cancel sends nothing, verify+submit once, optional callback, Cupertino prompt |
| `tool/templates_gallery_probe.dart` | 178 | Isolated in-process fixture entry; default, empty and detail-refresh-refusal scenarios |
| `tool/templates_gallery_probe.mjs` | 386 | Loopback static server + real headless Chrome driver |
| `notes/T1-gallery.md` | — | This evidence |
`TemplateEntry`, `TemplateRepository`, `TemplateRepositoryException`,
`ApiGateway`, `showTemplateCreateDialog` and its wording/keys are reused
unchanged. `pubspec.*`, `lib/main.dart`, `lib/application/`, `lib/shell/`,
Settings, routes, Pipelines, `web/`, the Go server and `android/` were not
touched.
## Behaviour
- Gallery wording is the browser's: `Loading templates…`, `No templates are
available on this server.`, a blank catalogue name as `(unnamed template)`,
description verbatim, and a blank detail heading falling back to the key.
- Detail shows the description (when non-blank), `Key`, `Includes a schedule`
(when true), `Definition source`, and the server's complete source in
`SelectableText`. The source is never trimmed, re-indented or re-encoded.
- The action is exactly `Create pipeline from this template`. It calls
`showTemplateCreateDialog` with the current repository, the selected entry and
the host's native flag. Opening the prompt, typing, or Cancel sends nothing.
Only the dialog's Create validates and then submits create-only; an accepted
detail reaches `onCreated` exactly once.
- Standalone Material uses `Scaffold`/`AppBar` with a native `BackButton` when a
template is open and a tooltip `Refresh` action; Cupertino uses
`CupertinoPageScaffold`/`CupertinoNavigationBar` with the native back chevron
and refresh icon. Doors are opened on the detail as this screen's own page, so
Android system back also returns to the gallery via `PopScope`.
- `embedded: true` drops the app bar, keeps a Refresh control at the body's
trailing top edge and shows a native Back row inside the detail, matching the
shell-owned-navigation contract used by other feature screens.
- Loading, empty and refusal have their own truthful states. A refusal shows the
server's own text and `Retry`; a refresh failure keeps already-loaded rows and
shows the refusal/`Retry` above them instead of blanking the gallery. The same
banner is rendered above an open template, so pressing Refresh on the detail
never fails silently; Retry re-reads with the template and rows kept.
- Only the newest `list_templates` generation may publish. A gateway change
clears the old server's rows and selection, an older reply is ignored, and a
reply completing after disposal is dropped (no `setState`).
- No stage-count read, stage list, Graph tab or mini graph is included: this
slice deliberately sends no per-card `validate`. The browser's stage count is
therefore not claimed here. The detail's metadata is description, key and
schedule flag; its source is complete.
## Checks actually run
```
cd app
flutter analyze # No issues found
dart format --output=none --set-exit-if-changed \
lib/features/templates test/features/templates/ui/template_gallery_*.dart \
tool/templates_gallery_probe.dart # 0 changed
flutter test test/features/templates # 37 passed
flutter test # 690 passed
flutter build web -o <private>/web-normal # ✓ Built
flutter build web --target=tool/templates_gallery_probe.dart \
-o <private>/probe-web # ✓ Built
```
The focused suite covers: loading then catalogue; empty; refusal + Retry;
failed refresh retaining rows; a failed refresh with the detail open on Material
and Cupertino, including the native Retry control and the template staying
open; the same failure in embedded mode; refresh re-reading without losing
selection; selection showing metadata/source with no validate/submit;
native/system back; embedded framing; Cupertino list/back/detail controls; 2x at
360×640 with no overflow; stale reply ignored after a gateway replacement; late
reply after disposal; Cancel sending nothing; exact `validate`/`submit` payloads;
callback once; optional callback; Cupertino prompt.
## Browser evidence (real headless Chrome, loopback only)
The probe's gateway is in-process; it never opens a socket and never contacts a
real Pipelines server. All runs are dark (`MaterialApp` standard dark theme /
`CupertinoThemeData(brightness: dark)`), with no font, colour or component-size
overrides. Each default run asserts: refusal + Retry; loading; actual rows;
selection metadata + `Definition source`; back; refresh adding
`Added after refresh`; Cancel with zero requests; accepted create with exactly
one validate and submit, exact
`{name: "Probe release", source: <verbatim fixture>, create_only: true}`,
callback once, and Close sending nothing.
- Material dark, 390×844, 1x — `public/t1-gallery/`
(`error`, `loading`, `gallery`, `detail`, `refreshed`, `create-blank`, `created`).
- Material dark, 360×640, 2x text — `public/t1-gallery-2x/` (same seven states).
- Cupertino dark, 390×844, 1x — `public/t1-gallery-cupertino-1x/` (same seven).
- Cupertino dark, 360×640, 2x text — `public/t1-gallery-cupertino/` (same seven).
- Material dark empty catalogue — `public/t1-gallery-empty/t1-gallery-empty-empty.png`.
- Material dark failed refresh with the detail open —
`public/t1-gallery-detail-refresh/` (`detail-refresh-error`,
`detail-refresh-retried`).
- Cupertino dark failed refresh with the detail open —
`public/t1-gallery-detail-refresh-cupertino/` (same two states).
The new scenario loads the catalogue, opens `Release workflow`, presses Refresh
and the fixture read genuinely refuses. The run asserts the refusal and Retry
are present above the still-open definition source, that exactly two
`list_templates` reads and no `validate`/`submit` happened, then presses Retry,
asserts the banner clears, the template stays open and a third read happened.
Inspected both Material and Cupertino captures: the native banner sits above the
detail, then disappears after Retry without losing the template.
Inspected screenshots: the Material dark gallery/detail, the 2x detail with
wrapped action and title, the Cupertino 1x gallery/detail, the 2x Cupertino
gallery (names now wrap to two lines rather than ellipsizing), the error/Retry
state and the created dialog with the exact success line.
## Task diff
```
?? app/lib/features/templates/screen.dart
?? app/lib/features/templates/ui/template_detail.dart
?? app/lib/features/templates/ui/template_gallery.dart
?? app/lib/features/templates/ui/templates_failure.dart
?? app/lib/features/templates/ui/templates_frame.dart
?? app/test/features/templates/ui/template_gallery_create_test.dart
?? app/test/features/templates/ui/template_gallery_screen_test.dart
?? app/test/features/templates/ui/template_gallery_test_support.dart
?? app/tool/templates_gallery_probe.dart
?? app/tool/templates_gallery_probe.mjs
?? app/notes/T1-gallery.md
```
All are additions in the working tree. No tracked file changed, no concurrent
lane or manager commit was modified, and nothing was staged, committed, pushed
or deployed. `git diff --check` is clean.
## Honest limits
- Not wired into the shell/Settings/routes; this is reusable source, not a
normal-app preview entry. The manager owns registration.
- No real Pipelines server, credentials, operator pipeline or create request was
touched. Browser evidence uses the in-process fake gateway.
- Mobile (Android/iOS) is unverified: no Android/iOS build, emulator, device or
ADB. The Cupertino captures are Chrome's rendering of Cupertino widgets, not
iOS; VoiceOver/TalkBack was not run.
- Stage counts, stage lists and the Graph tab are intentionally not implemented
in this slice (no per-card validate), so they are not claimed as parity here.
- Browser captures remain standalone use only; `embedded: true` is covered by
widget tests, not by the headless-Chrome probe.
- `/artifacts`/live authenticated data and the real dark app-shell theme were
not exercised; the probe supplies the standard dark host themes.