merge(app): land native create-from-template prompt
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
# C2 — Chat thread controller
|
||||
|
||||
Manager integration follow-up: exposes subscribed/subscriptionError separately
|
||||
from history errors, so readable stored history cannot hide a refused live watch.
|
||||
Resync marks history loading while retaining the current transcript. A focused
|
||||
regression covers refused subscribe + successful history, then successful resync.
|
||||
The controller does not claim to fold form events; those are a separate UI slice.
|
||||
|
||||
`lib/features/chat/conversation/chat_thread_controller.dart` owns one open
|
||||
conversation without any UI. It is constructed with the shared `ApiGateway` and
|
||||
one `sessionId`, reuses `ChatRepository` for the wire and
|
||||
`domain/chat_transcript.dart` for the fold, and exposes `messages`, `running`,
|
||||
`loaded`, `loading`, `hasMore`, `cursor` and `error` through
|
||||
`ChangeNotifier`.
|
||||
|
||||
Behaviour:
|
||||
|
||||
- `load()` calls `chat_subscribe` with the exact session body, then reads the
|
||||
newest `chat_messages` page with `limit: 200` and an empty cursor. A refused
|
||||
subscribe leaves history usable.
|
||||
- `loadOlder()` is explicit only, requires `hasMore`, passes the server's opaque
|
||||
`next_cursor` back verbatim, and prepends the older page by id.
|
||||
- Only `chat_event` envelopes for this session are folded; replayed/live
|
||||
text, reasoning, tool, step and user frames use the existing domain fold, so
|
||||
unknown message and part fields survive.
|
||||
- `resync()` settles the held turn, re-subscribes, then replaces the transcript,
|
||||
cursor and `hasMore` with the newest authoritative page. Activity replayed
|
||||
while re-attaching (for example a running step) survives the replacement. A
|
||||
pushed `resync` event invokes the same path.
|
||||
- History failures set `error` and keep the held transcript; they are never
|
||||
reported as an empty success. Superseded reads and replies after disposal are
|
||||
ignored.
|
||||
- Disposal cancels only the local stream subscription. There is no
|
||||
`chat_unsubscribe` request.
|
||||
|
||||
Checks (run from `app/`):
|
||||
|
||||
- `flutter test test/features/chat/conversation` — 10 tests passed.
|
||||
- `flutter test test/features/chat` — 43 tests passed.
|
||||
- `flutter analyze lib/features/chat test/features/chat` — no issues.
|
||||
|
||||
Not done: the controller is not yet wired to a screen, so there is no rendered
|
||||
or browser change to capture; mobile builds and device verification were not
|
||||
performed. No shared domain, shell, main, pubspec or server files changed.
|
||||
@@ -0,0 +1,191 @@
|
||||
# D1-wire — native Changes action in the run detail
|
||||
|
||||
## Manager completion after retained stage limit
|
||||
|
||||
The final Code visit completed its fixes, but the runner could not revisit Review
|
||||
again (visit limit3). No implementation was rerun or discarded. Manager checked
|
||||
the retained source, focused changes/wiring tests and analyzer, then rebuilt and
|
||||
drove the real RunDetailView fixture:15 checks/20 captures pass, including both
|
||||
320px/2x native menus and selected Raw patch. Narrow hosts use a standard native
|
||||
sheet, never a custom segmented clone. Manager separated the cohesive form
|
||||
controls into diff_form_control.dart and used the actual host/native label style
|
||||
instead of a hard-coded font measurement. No font/size/palette override remains.
|
||||
Evidence: approved temp/changes-wiring-manager-browser. Actual shell merges and
|
||||
publication are tracked separately in WORK.md; earlier notes below are historical.
|
||||
|
||||
Adds one standard native action to the existing run-detail bodies and reuses the
|
||||
landed `ChangesViewer`. No API call, shell/main or pubspec edit; no commit, push
|
||||
or deploy.
|
||||
|
||||
## Behaviour
|
||||
|
||||
- Material: `FilledButton.tonalIcon` labelled **Changes** beside **Back to
|
||||
list**. It pushes a `MaterialPageRoute` whose only bar is an
|
||||
`AppBar(title: Text('Changes'))` above the viewer.
|
||||
- Cupertino: `CupertinoButton.tinted` labelled **Changes** in the detail's
|
||||
header row. It pushes a `CupertinoPageRoute` whose only bar is a
|
||||
`CupertinoNavigationBar`; native back is automatic.
|
||||
- The action is offered once the run has stopped executing: the server's
|
||||
`executing` flag must be false and the status must not be
|
||||
`queued`/`running`/`waiting`. The opened page snapshots the recorded steps, so
|
||||
an executing run is not given a page that could go stale or miss a later
|
||||
settlement; its evidence belongs to the live visit pane when that slice
|
||||
lands. `showRunChangesAction` holds that check.
|
||||
- The run-wide aggregate is shown only for `succeeded`, matching
|
||||
`web/src/changes.js` `showRunChangesSummary` and PARITY R4. A failed run keeps
|
||||
each visit's own recorded capture (stage, visit number, status, capture
|
||||
counters/scope/diagnostic and file rows) without claiming a settled final
|
||||
state; `ChangesViewer` gained a `showSummary` input for that.
|
||||
- `runDetailChangeSteps` passes the server's `steps` unchanged; the page
|
||||
snapshots the list once.
|
||||
- No capture, visit, partial/missing/unavailable wording or diff rendering is
|
||||
reinterpreted by the wiring; the changes domain still owns all of it.
|
||||
|
||||
## Review findings addressed
|
||||
|
||||
1. **Failed/running runs no longer receive a settled Changes page.** The
|
||||
aggregate and filter are hidden unless the status is `succeeded`; failed
|
||||
runs still open the per-visit evidence. Executing runs get no action at all,
|
||||
which also removes the stale-snapshot case. Covered by failed and running
|
||||
regressions plus browser checks.
|
||||
2. **Cupertino Raw patch no longer asserts.** The raw body moved to
|
||||
`RawPatchView`: Material keeps `SelectionArea`; Cupertino renders the exact
|
||||
recorded bytes in a read-only `CupertinoTextField` (the pattern the run
|
||||
detail already uses), with its intrinsic line width and horizontal scrolling,
|
||||
so no `MaterialLocalizations` are required. A Cupertino Raw regression taps
|
||||
the control and checks the native field, and the browser probe opens it.
|
||||
3. **Dark Cupertino Changes now follows the host.** Both the Cupertino page and
|
||||
the file-diff popup it opens wrap the viewer in `hostTextTheme(context)`
|
||||
(`change_style.dart`): a `Theme` with `CupertinoTheme.brightnessOf(context)`
|
||||
and the host platform. The popup matters because dialogs open on the app
|
||||
Navigator, above the page's own theme, so the first fix alone left the diff
|
||||
header light-theme near-black on the dark popup. Widget regression opens the
|
||||
file from the dark page and asserts the `Modified` header is light; the probe
|
||||
measures the rendered header pixels (luminance 0.87; 0.15 without the fix),
|
||||
and captures cover dark Changes and dark diff.
|
||||
4. **The diff form labels stay whole at 320 px and 2x text.** A two-segment
|
||||
control cannot keep `Rendered` and `Raw patch` on one line there: Material
|
||||
broke `Rendered` mid-word and Cupertino clipped `Raw patch` to `Raw`, with no
|
||||
way to see the rest. `diffFormSegmentsFit` measures the two fixed words at
|
||||
the host's text scale and, when the native segmented control cannot fit both,
|
||||
the viewer uses the host's standard menu instead (a Material bottom sheet or
|
||||
a Cupertino action sheet) with the same two words, one per row. The current
|
||||
mode is highlighted and the menu is titled `Diff form`. The `Copy patch`
|
||||
action keeps its intrinsic width in a horizontal strip rather than breaking
|
||||
its words. Widget regressions on both hosts assert that no label breaks
|
||||
inside a word, is clipped vertically or is clipped horizontally, and that
|
||||
choosing `Raw patch` from the menu shows the recorded raw body. Browser
|
||||
captures cover the 320x2 menu and raw state on both hosts.
|
||||
|
||||
The action gate now also honours the server's `executing` flag (web's
|
||||
`isExecuting`), so a failed run whose step is still active is not offered the
|
||||
snapshot page; the status list remains as the fallback for replies without the
|
||||
flag.
|
||||
|
||||
The earlier comment claiming `runDetailChangeSteps` returns the same list
|
||||
instance was corrected. The browser/system Back advisory is unchanged and
|
||||
unresolved: it needs `AppRouterDelegate.popRoute`/Router work in `lib/shell/`,
|
||||
which this lane must not edit. The probe's Back checks exercise the page's own
|
||||
back control only.
|
||||
|
||||
## Files
|
||||
|
||||
```
|
||||
lib/features/runs/ui/run_changes_action.dart new, 126 lines
|
||||
lib/features/runs/ui/run_detail_material.dart +13/-7
|
||||
lib/features/runs/ui/run_detail_cupertino.dart +8/-2
|
||||
lib/features/changes/changes.dart export hostTextTheme
|
||||
lib/features/changes/domain/run_changes.dart +7
|
||||
lib/features/changes/widgets/change_style.dart +hostTextTheme, fit check, native menu
|
||||
lib/features/changes/widgets/changes_viewer.dart showSummary gate
|
||||
lib/features/changes/widgets/file_diff_viewer.dart raw body, themed dialog, form menu
|
||||
lib/features/changes/widgets/raw_patch_view.dart new, 75 lines
|
||||
test/features/runs/ui/run_changes_action_test.dart new, 177 lines
|
||||
test/features/runs/ui/run_changes_status_test.dart new, 204 lines
|
||||
test/features/changes/diff_presentation_test.dart +2x label regressions
|
||||
test/features/changes/changes_viewer_test.dart 2x control expectation
|
||||
test/features/changes/run_changes_test.dart +9 (status gate)
|
||||
tool/diff_wiring_probe.dart fixture entry, scale=2
|
||||
tool/diff_wiring_probe.mjs browser driver, pixel probe, 2x/320
|
||||
```
|
||||
|
||||
## Checks (actual results)
|
||||
|
||||
- `flutter test test/features/changes test/features/runs` — **159 tests passed**.
|
||||
- `flutter test test/features/runs/ui/run_changes_action_test.dart
|
||||
test/features/runs/ui/run_changes_status_test.dart
|
||||
test/features/runs/ui/run_detail_widget_test.dart test/features/changes` —
|
||||
**67 tests passed**.
|
||||
- `flutter analyze` — **No issues found**.
|
||||
- `dart format --output=none --set-exit-if-changed` on every touched Dart file —
|
||||
clean (0 changed).
|
||||
- `node --check tool/diff_wiring_probe.mjs` — passed.
|
||||
- `flutter build web --target tool/diff_wiring_probe.dart --output
|
||||
build/probe-wire` — built.
|
||||
- `flutter build web --output build/web-wire-check` — built.
|
||||
|
||||
Widget regressions cover both hosts: the happy path (recorded filename, stat,
|
||||
per-stage Visit 1, rendered diff, Close diff, Back), unavailable capture
|
||||
wording, a failed run without the aggregate but with its visit capture, an
|
||||
executing run with no action, the dark host text colour on both the Changes page
|
||||
and the opened diff header, the Cupertino Raw native field, and the 320x720 2x
|
||||
labels: no mid-word break, no vertical or horizontal clipping, the native menu
|
||||
labels and choosing `Raw patch` in it, and the unchanged segmented control on a
|
||||
wide host.
|
||||
|
||||
## Real browser evidence
|
||||
|
||||
`tool/diff_wiring_probe.dart` renders the real `RunDetailView` over a fake
|
||||
`get_run` gateway; `tool/diff_wiring_probe.mjs` serves it on an OS-assigned
|
||||
loopback port and drives headless Chrome. Query parameters select the fixture:
|
||||
`?run=failed`, `?run=running`, `?capture=unavailable`,
|
||||
`?platform=cupertino&theme=light|dark` and `?scale=2` for the 2x text states.
|
||||
No server or operator run was touched.
|
||||
|
||||
All **15/15 checks** passed (`d1-wire/d1-wire-probe.json`), 20 captures:
|
||||
|
||||
- Material run detail shows the native Changes action; it opens the recorded
|
||||
`lib/features/runs/ui/run_changes_action.dart` with `1 file changed · +2 -1`
|
||||
and its implementer visit section.
|
||||
- The recorded file opens its actual diff (`- const label = "Old";`,
|
||||
`+ const recorded = true;`) with Rendered/Raw patch/Copy patch/Close diff;
|
||||
Close diff and Back return.
|
||||
- `?capture=unavailable` shows `Changes · capture unavailable` and the server
|
||||
diagnostic, never "No changes observed".
|
||||
- `?run=failed` keeps the visit capture and shows no run-wide `file changed`
|
||||
summary.
|
||||
- `?run=running` offers no Changes action.
|
||||
- Cupertino shows the tinted Changes button, one bar, the recorded file and
|
||||
diff; Raw patch renders in the native field with the other actions intact;
|
||||
Close diff and Back return.
|
||||
- Cupertino dark renders the summary and the recorded diff with light text; the
|
||||
diff header is sampled from the rendered capture (max luminance 0.87, above
|
||||
the 0.5 readable-text gate) instead of only checking that the words exist.
|
||||
- `?scale=2` at 320x720 opens the same diff on both hosts, shows the `Diff form`
|
||||
menu with `Rendered` and `Raw patch` whole, and renders the recorded raw body
|
||||
after choosing `Raw patch`.
|
||||
|
||||
Captures in the shared `d1-wire/` folder (390x844, plus the 320x720 2x states):
|
||||
|
||||
```
|
||||
d1-wire-material-detail.png d1-wire-material-changes.png
|
||||
d1-wire-material-diff.png d1-wire-material-back.png
|
||||
d1-wire-material-unavailable.png d1-wire-material-failed.png
|
||||
d1-wire-material-running.png d1-wire-cupertino-detail.png
|
||||
d1-wire-cupertino-changes.png d1-wire-cupertino-diff.png
|
||||
d1-wire-cupertino-raw.png d1-wire-cupertino-back.png
|
||||
d1-wire-cupertino-dark-changes.png d1-wire-cupertino-dark-diff.png
|
||||
d1-wire-material-2x-320-diff.png d1-wire-material-2x-320-menu.png
|
||||
d1-wire-material-2x-320-raw.png d1-wire-cupertino-2x-320-diff.png
|
||||
d1-wire-cupertino-2x-320-menu.png d1-wire-cupertino-2x-320-raw.png
|
||||
```
|
||||
|
||||
## Not verified / remaining
|
||||
|
||||
- Browser and Android system Back on the pushed page are unverified; the
|
||||
advisory Router integration was not changed.
|
||||
- Active-run per-visit changes are not shown anywhere yet; that belongs to the
|
||||
live run visit pane, not this snapshot page.
|
||||
- Mobile targets were not built, installed or run; Cupertino is verified through
|
||||
widget tests and browser rendering only, so **mobile remains unverified**.
|
||||
- All data is fixture data; no live server or operator run was used.
|
||||
@@ -0,0 +1,174 @@
|
||||
# P1 wire — Pipelines destination on the shared session
|
||||
|
||||
## Implemented
|
||||
|
||||
- `lib/application/pipelines_destination.dart` registers the landed
|
||||
`PipelinesScreen` on the existing `/pipelines` route through `AppSession`.
|
||||
It reuses the session's single socket and gateway; no second connection,
|
||||
fake rows or hidden request path was added.
|
||||
- Before the first accepted connection the destination mounts no screen and
|
||||
sends no `list_pipelines`, `list_runs` or `get_pipeline`. The full gate says
|
||||
`Connecting to Pipelines…` or `Pipelines server unavailable`, with an
|
||||
explicit native `Retry` and the existing missing-endpoint explanation.
|
||||
- After the first connection the screen stays mounted through drops. A
|
||||
status banner reports `Reconnecting to Pipelines…`; a reconnect advances
|
||||
`syncToken`, and `PipelinesScreen.didUpdateWidget` calls the existing
|
||||
`controller.load()` so the list and the selected detail refresh in place.
|
||||
Selection (pipeline id and requested version) is preserved; there is no
|
||||
remount and no return to the empty list.
|
||||
- `PipelinesScreen` gained `embedded` and `syncToken`. Embedded mode skips its
|
||||
own Material `Scaffold`/`AppBar` or Cupertino `CupertinoPageScaffold`/
|
||||
`CupertinoNavigationBar`, because the shell already owns the single bar.
|
||||
A native refresh action stays in the content (`IconButton`/`CupertinoButton`
|
||||
with the same `Refresh` wording), using the real host selection.
|
||||
- The connection gate and banner moved verbatim from `runs_destination.dart`
|
||||
to `lib/application/connection_status.dart`, so Runs and Pipelines share one
|
||||
implementation and one wording. Runs behavior is unchanged.
|
||||
- Registration is a tiny entry in the existing `destinationBodies` map in
|
||||
`lib/application/pipelines_app.dart`.
|
||||
- No graph rendering, actions, templates, schedules, route expansion, native
|
||||
control replacement, fixed component size/font/colour override, server,
|
||||
web, legacy, Android or pubspec change was made. Graph still shows
|
||||
`Graph rendering is pending (P2).`
|
||||
|
||||
## Files
|
||||
|
||||
Production:
|
||||
|
||||
- `lib/application/connection_status.dart` (new, moved shared chrome)
|
||||
- `lib/application/pipelines_destination.dart` (new)
|
||||
- `lib/application/pipelines_app.dart` (registration and import)
|
||||
- `lib/application/runs_destination.dart` (uses the shared chrome)
|
||||
- `lib/features/pipelines/screen.dart` (embedded framing, content refresh,
|
||||
reconnect sync token)
|
||||
|
||||
Tests:
|
||||
|
||||
- `test/application/pipelines_destination_test.dart` (new)
|
||||
- `test/application/pipelines_registration_test.dart` (new)
|
||||
- `test/application/pipelines_replies.dart` (new serialized reply helper)
|
||||
- `test/application/pipelines_app_test.dart` (route now renders the real list)
|
||||
- `test/application/settings_registration_test.dart` (answers the mounted
|
||||
Pipelines reads before visiting Settings)
|
||||
- `test/features/pipelines/pipelines_screen_test.dart` (embedded framing and
|
||||
content refresh)
|
||||
|
||||
Browser tooling (isolated, pure loopback fixtures):
|
||||
|
||||
- `tool/pipelines_wiring_probe_entry.dart` — exact `runPipelinesApp()`
|
||||
composition
|
||||
- `tool/pipelines_wiring_probe_server.mjs` — static bundle plus loopback
|
||||
websocket fixture with drop/refuse/accept/state endpoints
|
||||
- `tool/pipelines_wiring_probe.mjs` — real Chrome DevTools probe
|
||||
|
||||
## Checks actually run
|
||||
|
||||
| Check | Result |
|
||||
| --- | --- |
|
||||
| `flutter analyze` | `No issues found!` |
|
||||
| `flutter test` | **595 passed** |
|
||||
| `flutter test test/application` | **33 passed** |
|
||||
| `flutter test test/features/pipelines` | **49 passed** |
|
||||
| `flutter test test/features/pipelines/pipelines_screen_test.dart` | **6 passed** |
|
||||
| `dart format --output=none --set-exit-if-changed lib test tool/pipelines_wiring_probe_entry.dart` | 273 files, 0 changed |
|
||||
| `node --check` on both probe scripts | passed |
|
||||
| `flutter build web` (default `lib/main.dart`) | `✓ Built build/web` |
|
||||
| `flutter build web -t tool/pipelines_wiring_probe_entry.dart` | `✓ Built` |
|
||||
| `node tool/pipelines_wiring_probe.mjs <build> <captures>` | exit 0, 25 checks, 9 captures, `probe.json` has no error |
|
||||
|
||||
Coverage added:
|
||||
|
||||
- missing native endpoint never opens a socket;
|
||||
- connecting gate sends no list request; the screen mounts only after the
|
||||
shared socket accepts;
|
||||
- refused first connection is friendly, names no transport exception and
|
||||
offers Retry;
|
||||
- a drop retains the loaded rows and detail, then reconnect re-reads list and
|
||||
the open detail without losing the selected row;
|
||||
- the registered `/pipelines` route renders real rows, detail content hash and
|
||||
source with exactly one Material or Cupertino bar, one socket;
|
||||
- Cupertino host builds no `Material` widget;
|
||||
- embedded framing adds no second bar and keeps a working content Refresh.
|
||||
|
||||
## Browser evidence (real Chrome, normal composition)
|
||||
|
||||
Directory: `/Users/alan/.local/share/pipelines/data/artifacts/69/public/p1-wire-captures`
|
||||
|
||||
- `01-gate-refused-material.png` — first connection refused: honest gate,
|
||||
`Retry`, shell nav present, zero list requests recorded by the fixture.
|
||||
- `02-list-material.png` — Material shell below its single bar with the real
|
||||
`Release verification` / `Nightly documentation` rows.
|
||||
- `03-detail-material.png` — selected pipeline Summary with
|
||||
`sha256:fixture-3-v3`, versions and metadata.
|
||||
- `04-source-material.png` — Source tab with the real fixture source text.
|
||||
- `05-drop-detail-retained-material.png` — socket dropped: `Reconnecting to
|
||||
Pipelines…` banner while the open detail stays visible at `/pipelines`.
|
||||
- `06-reconnect-detail-refreshed-material.png` — after Retry: banner gone,
|
||||
list and open detail re-read (fixture counters advanced for `list_pipelines`
|
||||
and `get_pipeline`), same selection.
|
||||
- `07-list-cupertino-dark.png` — macOS/dark host: Cupertino global bar and tab
|
||||
bar, inset grouped rows, `Release verification` present.
|
||||
- `08-detail-cupertino-dark.png` — Cupertino dark detail with content hash,
|
||||
versions and native segmented tabs.
|
||||
- `09-source-cupertino-dark.png` — Cupertino dark Source with source text.
|
||||
- `probe.json` — fixture URL, 25 checks, captures and final counters.
|
||||
|
||||
The probe starts the fixture with websocket upgrades refused, asserts the gate
|
||||
and that `listPipelines`, `listRuns` and `getPipeline` are all 0, then accepts
|
||||
and drives the normal app. Hosts are selected through the browser platform
|
||||
user agent (Linux for Material, macOS for Cupertino), which is what the normal
|
||||
composition reads. OCR asserts the real row, content hash and source; the
|
||||
captures were inspected to confirm one bar and Cupertino dark styling.
|
||||
|
||||
Reproduce:
|
||||
|
||||
```sh
|
||||
flutter build web -t tool/pipelines_wiring_probe_entry.dart -o <build>
|
||||
node tool/pipelines_wiring_probe.mjs <build> <capture-dir>
|
||||
```
|
||||
|
||||
## Explicitly not done / unverified
|
||||
|
||||
- Graph rendering and graph nodes/edges remain P2; the existing pending notice
|
||||
is unchanged.
|
||||
- No action, template, schedule, route expansion or navigation redesign.
|
||||
- No production server, real operator chat/run or authenticated preview was
|
||||
touched; all browser data comes from the isolated loopback fixture.
|
||||
- Android and iOS were not built, installed or run; mobile remains unverified.
|
||||
- No push, deployment or preview-service change was made. The Land stage
|
||||
committed the reviewed candidate on `flutter/p1-wire` and merged `main`
|
||||
into it (see Landing below).
|
||||
- No Material/Cupertino fixed sizes, palette or font overrides were added.
|
||||
The only fixed breakpoint remains the existing `kPipelinesWideBreakpoint`.
|
||||
|
||||
## Diff
|
||||
|
||||
Tracked changes (`git diff --numstat`):
|
||||
|
||||
```
|
||||
3 0 app/lib/application/pipelines_app.dart
|
||||
4 184 app/lib/application/runs_destination.dart
|
||||
57 16 app/lib/features/pipelines/screen.dart
|
||||
26 5 app/test/application/pipelines_app_test.dart
|
||||
3 0 app/test/application/settings_registration_test.dart
|
||||
26 0 app/test/features/pipelines/pipelines_screen_test.dart
|
||||
```
|
||||
|
||||
New files: `connection_status.dart` (195), `pipelines_destination.dart` (61),
|
||||
three test files and three probe files. Net production change is ~120 added
|
||||
lines after moving the shared chrome out of `runs_destination.dart`.
|
||||
|
||||
## Landing
|
||||
|
||||
- Committed the reviewed work as `8476cfd7 feat(app): wire the native
|
||||
pipelines browser on the shared session` (15 paths, no unrelated files).
|
||||
- Merged local `main` (`7be4456f`) into `flutter/p1-wire` with no conflicts;
|
||||
the merge brought in the native run rename work only (`app/WORK.md`,
|
||||
`lib/features/runs/**`, `notes/R2-title-wire.md`, its tests and probe).
|
||||
- Post-merge checks on the merged candidate: `flutter analyze` clean,
|
||||
`flutter test` **599 passed**, `dart format` 274 files 0 changed,
|
||||
`node --check` on both probe scripts, `flutter build web` built, and the
|
||||
Chrome wiring probe again reported **25 checks, 9 captures**, no error,
|
||||
final `{subscribed:3, listPipelines:3, listRuns:3, getPipeline:3,
|
||||
dropped:1, connections:1}`. The 595 in the table above is the pre-merge
|
||||
branch count; the extra 4 tests are the merged rename coverage.
|
||||
@@ -0,0 +1,23 @@
|
||||
# Cancel from the actual run detail
|
||||
|
||||
The loaded detail's native action row reuses CancelRunAction alongside Rename.
|
||||
No new confirmation or protocol implementation: Keep sends nothing, only Confirm
|
||||
sends the exact run_id, and no canceled state appears before server acceptance.
|
||||
The accepted run detail now folds lifecycle fields into the held list row as well
|
||||
as the detail (the previous title-only update was insufficient for Cancel).
|
||||
Detail-only payloads are not duplicated into the summary list; pending old detail
|
||||
refreshes are invalidated after acceptance. Foreign run replies cannot replace
|
||||
the open detail. Native controls still own sizing and appearance.
|
||||
|
||||
## Actual checks
|
||||
|
||||
- New normal-screen Material/Cupertino tests failed before registration, then
|
||||
passed: Keep/no request, Confirm exact id, delayed accepted canceled state,
|
||||
action disappears, Back shows canceled list row.
|
||||
- 601 integrated tests pass; analyzer and normal web build pass.
|
||||
- Normal-app real Chrome fixture probe passes23 captures, including Cupertino
|
||||
confirm/Keep, Material confirm and accepted detail/list. The fixture records
|
||||
exactly one cancel_run for its own synthetic run4. No real run was canceled.
|
||||
- Fresh Cupertino-confirm and Material-accepted PNGs inspected in approved
|
||||
temp/cancel-wired-browser. Existing history/reconnect/Settings checks pass too.
|
||||
- Mobile and authenticated production mutations remain unverified.
|
||||
@@ -0,0 +1,19 @@
|
||||
# Recorded human decisions in run detail
|
||||
|
||||
RunDecisionNotice reuses pendingDecision and HumanDecisionAction. A standard
|
||||
Material card or Cupertino section names the recorded checkpoint and offers
|
||||
Decide. The existing native prompt owns option/feedback/confirmation/refusal
|
||||
semantics; export/resource waits do not become invented human checkpoints.
|
||||
Accepted server detail flows through the same lifecycle/list update as Cancel.
|
||||
|
||||
New actual-screen tests failed before wiring and now pass on both hosts: recorded
|
||||
instructions, selection sends nothing, exact run/stage/option and trimmed feedback
|
||||
only on confirmation, accepted result removes the card. Integrated614 tests pass;
|
||||
analysis and normal web build are clean.
|
||||
|
||||
Real normal-app browser fixture passes28 captures, including actual Cupertino
|
||||
waiting card and prompt, Material card/prompt/accepted result, Cancel/Keep and
|
||||
the existing history/reconnect/Settings checks. The fixture records one exact
|
||||
decide_run for its synthetic run5; opening/Cancel send nothing. Card and prompt
|
||||
PNGs inspected in approved temp/decision-wired-browser. No production decision
|
||||
was answered; mobile and live authenticated mutations remain unverified.
|
||||
@@ -0,0 +1,140 @@
|
||||
# S1-draft — pure saved-schedule editor draft and validation
|
||||
|
||||
Manager integration guard: invalid pipeline IDs and edited records without a
|
||||
positive exact server identity/revision cannot build save payloads. This prevents
|
||||
a malformed/historical edit from becoming a create or bypassing CAS. Three new
|
||||
regressions failed against the original draft and pass after the fail-closed
|
||||
guard. The original snapshot remains unchanged; no production save was tested.
|
||||
|
||||
## What changed
|
||||
|
||||
New files only; no existing feature, shell, transport, `main` or pubspec source
|
||||
edited:
|
||||
|
||||
| File | Lines | Responsibility |
|
||||
| --- | --- | --- |
|
||||
| `lib/features/schedules/domain/editor/schedule_draft.dart` | 210 | mutable editor draft over `SavedSchedule`/`ScheduleRule`, web-mirrored validation, `save_schedule` record assembly |
|
||||
| `test/features/schedules/domain/editor/draft_fixtures.dart` | 42 | shared server-record fixture and deep-copy helper |
|
||||
| `test/features/schedules/domain/editor/schedule_draft_test.dart` | 134 | create/edit record assembly, CAS, unknown fields, workspace, source immutability |
|
||||
| `test/features/schedules/domain/editor/schedule_draft_validation_test.dart` | 130 | timer/day/timezone/core field validation and invalid-field behavior |
|
||||
|
||||
The production file is one cohesive file (below the 220-line slice budget) and
|
||||
keeps the existing domain pattern: `SavedSchedule` and `ScheduleRule` are
|
||||
read-only views, `ScheduleDraft` is the separate editable state. Tests are split
|
||||
by responsibility (record assembly vs. validation) so neither file exceeds the
|
||||
working agreement's ~250-line aim.
|
||||
|
||||
## Review fix — workspace is now written into the record
|
||||
|
||||
Review visit 1 found that `build()` validated `workspace` but never wrote it, so
|
||||
creates were refused by `save_schedule` and workspace edits were dropped. The
|
||||
fix writes `record['workspace'] = workspace;` beside `name`/`version`/`enabled`,
|
||||
untrimmed to match `workspace: draft.workspace` in `web/src/schedules.js`
|
||||
(validation also runs on the untrimmed value). Direct probe against the real
|
||||
classes:
|
||||
|
||||
```
|
||||
create keys: enabled, id, input, name, notify_mode, pipeline_id, rule, version, workspace
|
||||
create: {"id":0,...,"workspace":"/srv","rule":{"every":"24h","timezone":"UTC"},"notify_mode":"auto"}
|
||||
edit workspace: /new (source /old)
|
||||
edit revision: 13
|
||||
```
|
||||
|
||||
New assertions cover the create record, an unchanged edit, a changed edit and
|
||||
the untrimmed value.
|
||||
|
||||
## Behavior copied from `web/src/schedules.js`
|
||||
|
||||
`ScheduleDraft.build()` returns `ScheduleSaveResult(null, errors)` while any
|
||||
field is invalid, so an invalid draft cannot yield a save payload. Errors are a
|
||||
field-name → message map using the web editor's exact words:
|
||||
|
||||
- name `Enter a schedule name.` (stored trimmed, as the web record is)
|
||||
- prompt `Enter a prompt.` (stored untrimmed)
|
||||
- pinned version: digits only, safe integer, at least 1 — `Choose a positive
|
||||
pinned version, not latest (0).`
|
||||
- workspace must start with `/` and contain no NUL/CR/LF — `Enter an absolute
|
||||
workspace path on the server.`
|
||||
- interval is Go-style compound duration (`24h`, `1h30m`, `.5h`, `1.5m`) whose
|
||||
matched text covers the whole value and totals at least one minute —
|
||||
`Interval must be at least 1m (for example 24h or 1h30m).`
|
||||
- clock times are comma-separated, trimmed, distinct `HH:mm` in 00:00–23:59 —
|
||||
`Enter distinct 24-hour times, such as 09:00, 17:30.`
|
||||
- weekday keys must be distinct values from `scheduleDays` —
|
||||
`Choose valid, distinct weekdays.`
|
||||
- notification mode is `auto`, `on` or `off` — `Choose a notification mode.`
|
||||
- timezone is blank, `Local`, a known single-zone alias or a well-formed
|
||||
`Area/Location` — `Enter a valid IANA timezone.`
|
||||
|
||||
Rule assembly mirrors the web editor: the prior rule is copied, `every`,
|
||||
`times`, `days` and `timezone` are removed, then only the selected timer shape
|
||||
is written. Empty weekdays mean every day (the key stays absent). A weekday set
|
||||
that is unchanged keeps the server's original order (the web editor does this
|
||||
so editing only a prompt does not reorder days). A blank timezone is omitted.
|
||||
|
||||
## Losslessness and CAS
|
||||
|
||||
- Edits start from `SavedSchedule.toJson()` (a deep copy): unknown top-level,
|
||||
`input`, `rule` and run-option fields (`model`, `stage_models`, `write_paths`,
|
||||
`allow_tools`, `title`, `output_format`, `next_due`, timestamps, future
|
||||
fields) survive untouched.
|
||||
- `input` keeps every unknown key and replaces only `prompt`.
|
||||
- **Every build starts from a fresh copy**, so the source snapshot and the
|
||||
draft are not mutated or aliased by a returned payload.
|
||||
- The edit record keeps the exact server `revision`; it is never incremented,
|
||||
invented or defaulted. An edit never rewrites `id`.
|
||||
- A create has no source: it emits the web sentinel `id: 0`, no `revision`, no
|
||||
unknown/run-option leftovers, `pipeline_id` from the caller, `enabled`,
|
||||
`input: {prompt}`, `rule`, and `notify_mode`.
|
||||
- `notify_mode` and `enabled` default the same way as the web draft when absent
|
||||
from a malformed older record, but an existing non-default string/boolean is
|
||||
preserved and validated rather than silently replaced.
|
||||
|
||||
## Checks actually run
|
||||
|
||||
```
|
||||
flutter pub get
|
||||
dart format lib/features/schedules/domain/editor test/features/schedules/domain/editor
|
||||
flutter analyze # No issues found! (1.1s)
|
||||
flutter test test/features/schedules/domain/editor # 9 passed
|
||||
flutter test test/features/schedules # 56 passed
|
||||
```
|
||||
|
||||
Focused coverage maps to the requested acceptance:
|
||||
|
||||
- create: sentinel `id: 0`, no revision, pipeline/version/prompt/workspace/rule;
|
||||
- lossless edit: id 9/revision 13, unknown record/input/rule/run options,
|
||||
workspace from the source, original map and `SavedSchedule` snapshot
|
||||
unchanged, returned payload not aliased;
|
||||
- changed workspace is written untrimmed, matching the web serializer;
|
||||
- prompt-only edit keeps the server weekday order and clock rule;
|
||||
- clock ↔ interval switching removes the other timer key and keeps unknown
|
||||
rule fields;
|
||||
- invalid timers (`59s`, `NaN`, `-1h`, `1.1x`, `Infinityh`, mixed text) and
|
||||
valid parity cases (`.5h`, `1h30m`, `24h`);
|
||||
- invalid clock times, duplicate weekdays, bad notification mode, invalid
|
||||
timezones, bad name/prompt/version/workspace;
|
||||
- invalid draft mutates nothing and has no record.
|
||||
|
||||
## Honest limits
|
||||
|
||||
- **Scope is the core editor slice.** Name, prompt, pinned version, workspace,
|
||||
timer mode/every/times, weekdays, timezone, enabled and notification mode are
|
||||
editable. Advanced JSON run options (`otherInput`, `stage models`, write
|
||||
paths, model, title, output format) and tools are **preserved exactly but not
|
||||
editable in this slice**; no control or parser for them was invented here.
|
||||
- **Timezone is structural.** Dart ships no IANA database, so the check accepts
|
||||
blank/`Local`, known single-zone aliases and a known area plus a well-formed
|
||||
location (e.g. `Europe/London`, `Etc/GMT+5`). It rejects clearly malformed
|
||||
values such as `Nowhere/Invalid` and `Europe/`, but cannot prove that every
|
||||
location in an accepted area exists. The server remains the final validator.
|
||||
This is documented at the function.
|
||||
- **No UI, network, CRUD, run dispatch, polling or scheduling engine.** The
|
||||
draft only assembles a record; the existing repository owns `save_schedule`,
|
||||
and no server was contacted.
|
||||
- **No browser capture applies.** This is a nonvisual pure domain item; there
|
||||
is no rendered change, so no fixture or screenshot was produced.
|
||||
- **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.** This stage forbids commit, push and deploy, so the
|
||||
candidate remains in the `flutter/schedule-draft` worktree for the manager.
|
||||
Reference in New Issue
Block a user