189 lines
9.8 KiB
Markdown
189 lines
9.8 KiB
Markdown
# S1-wire — pipeline Summary schedules
|
||
|
||
## Result
|
||
|
||
The pipeline Summary now carries a native Schedules section for the selected
|
||
pipeline. It lists the server's saved schedules and wires the landed draft/form
|
||
to `SchedulesRepository`: create, edit, pause/enable and confirmed delete. Every
|
||
accepted mutation re-reads `list_schedules`; a refused mutation stays visible
|
||
with the server's own words. No workflow is published, validated or run and no
|
||
run is started.
|
||
|
||
Candidate commit: the tip of `flutter/schedule-wire` (see `git log -1`). Not
|
||
merged, not pushed, not deployed.
|
||
|
||
## Changed paths
|
||
|
||
New source (all under `lib/features/schedules/ui/pipeline/`):
|
||
|
||
| File | Lines | Responsibility |
|
||
| --- | ---: | --- |
|
||
| `schedule_pipeline_section.dart` | 165 | state/actions: list ownership, create/edit drafts, pause, delete, workspace seed |
|
||
| `schedule_pipeline_list_body.dart` | 152 | one frame of the visible section: heading/count, note, loading/empty/failure, rows |
|
||
| `schedule_pipeline_row.dart` | 114 | one schedule row: name, state, pinned version + timer words, due, actions, row refusal |
|
||
| `schedule_pipeline_controller.dart` | 101 | `list_schedules`, save + refresh, enabled-only update, exact delete |
|
||
| `schedule_pipeline_editor.dart` | 93 | native full-screen form route, create request key, close-on-accepted |
|
||
| `schedule_delete_dialog.dart` | 143 | one native delete confirmation with a refusal slot |
|
||
| `schedule_pipeline_styles.dart` | 71 | host text roles, standard text buttons, separators |
|
||
| `schedule_pipeline_wording.dart` | 42 | browser words and stable keys |
|
||
|
||
Modified app files:
|
||
|
||
- `lib/features/pipelines/widgets/pipeline_summary_view.dart` — inserts the
|
||
section between the facts and Versions; takes the gateway.
|
||
- `lib/features/pipelines/widgets/pipeline_detail_panel.dart` — passes the
|
||
gateway through to Summary.
|
||
- `lib/features/pipelines/screen.dart` — supplies its existing gateway.
|
||
- `lib/features/schedules/ui/editor/schedule_editor_form.dart` and
|
||
`..._form_body.dart` — optional `showHeading` (default true) so the hosting
|
||
page's navigation bar is the single title.
|
||
- `lib/features/schedules/ui/list/schedule_list_format.dart` — adds the web's
|
||
one-line rule summary and the pinned-version value.
|
||
|
||
Tests and fixture:
|
||
|
||
- `test/features/schedules/ui/pipeline/schedule_pipeline_section_test.dart` (402)
|
||
- `test/features/schedules/ui/pipeline/schedule_pipeline_test_support.dart` (143)
|
||
- `test/features/pipelines/pipeline_summary_schedules_test.dart` (84)
|
||
- `test/features/pipelines/test_helpers.dart` — the pipeline fixture now answers
|
||
`list_schedules` with an explicit empty list.
|
||
- `test/features/pipelines/pipelines_adaptive_test.dart` — supplies the gateway
|
||
to the directly constructed detail panel.
|
||
- `tool/schedule_pipeline_probe_app.dart` (208) and
|
||
`tool/schedule_pipeline_probe.mjs` (407) — isolated in-memory fixture and real
|
||
Chrome interaction.
|
||
|
||
## Behavior and request shapes
|
||
|
||
- **List**: `list_schedules` with `{pipeline_id: <detail id>}`. A failed refresh
|
||
keeps the rows already shown and adds the failure line; an explicit empty reply
|
||
is `Schedules (0)` and `No schedules yet. Add one for each topic or recurring
|
||
task.` An unsupported/older reply reuses the existing upgrade guidance.
|
||
- **Create**: `Add schedule` opens the landed form over
|
||
`ScheduleDraft.create(pipelineId, version: detail.resolvedVersion,
|
||
workspace: <persisted server workspace>)`. The key is minted once when the
|
||
editor opens and reused by every retry in that editor. The exact create record
|
||
sends `id: 0`, the pinned resolved version, absolute workspace, and
|
||
`request_key`; a second Add gets a new key.
|
||
- **Edit**: `Edit` starts from the exact `SavedSchedule` loaded from the server.
|
||
The form's landed draft/guard preserves `id`, `revision`, unknown record,
|
||
input, rule and run-option fields. No `request_key` is sent, matching web.
|
||
- **Save outcome**: only `save_schedule` is called. An accepted save is followed
|
||
by `list_schedules`; the row is never written locally first. A server refusal
|
||
(including a stale revision) keeps the editor open, every typed value intact,
|
||
and shows `"<server reason> Your draft is preserved. …"`.
|
||
- **Pause/Enable**: sends the exact loaded record with only `enabled` toggled,
|
||
keeping identity, revision and every unknown field. No create key.
|
||
- **Delete**: one native confirmation (`Delete <name>?`, future runs only).
|
||
`Keep schedule` sends nothing; `Delete schedule` sends
|
||
`delete_schedule {schedule_id, expected_revision}` from the loaded row, then
|
||
refreshes. A refusal stays in the prompt; a later refresh failure is reported
|
||
separately.
|
||
- No `run_pipeline`, `validate`, `submit` or publish request exists in this
|
||
slice. Graph, Source, filters and the existing pipeline actions are untouched
|
||
except for passing the gateway through.
|
||
|
||
## Verification actually run
|
||
|
||
```
|
||
dart format lib/features/schedules/ui/pipeline lib/features/schedules/ui/editor \
|
||
lib/features/schedules/ui/list/schedule_list_format.dart \
|
||
lib/features/pipelines lib/features/pipelines/widgets \
|
||
test/features/schedules/ui/pipeline test/features/pipelines \
|
||
tool/schedule_pipeline_probe_app.dart # clean
|
||
flutter analyze # No issues found!
|
||
flutter test test/features/schedules test/features/pipelines # 141 passed
|
||
flutter test # 956 passed
|
||
flutter build web # ✓ Built build/web
|
||
flutter build web -t tool/schedule_pipeline_probe_app.dart \
|
||
-o build/schedule_pipeline_probe_web # ✓ Built
|
||
node --check tool/schedule_pipeline_probe.mjs # clean
|
||
OPENCODE_ARTIFACT_DIR=…/93/public/s1-wire-captures \
|
||
PROBE_WEB_ROOT=build/schedule_pipeline_probe_web \
|
||
node tool/schedule_pipeline_probe.mjs # 15 checks passed
|
||
git diff --check # clean
|
||
```
|
||
|
||
Widget coverage includes: exact create record with one key and pinned version;
|
||
edit preserving revision/unknown fields; conflict keeping the draft and server
|
||
words; pause changing only `enabled`; delete confirmation sending id + revision;
|
||
server-truth refresh after save; list/pause/delete refusals; 320px/2x Material
|
||
and dark Cupertino. The integration test opens the real `PipelinesScreen` and
|
||
checks the section plus a Source/Graph/Summary round trip.
|
||
|
||
## Browser evidence
|
||
|
||
Real headless Chrome against the isolated in-memory fixture, no Pipelines server
|
||
or authentication. Both native hosts ran list → new → invalid fields → valid
|
||
save → list refresh → conflict → accepted retry → pause → delete:
|
||
|
||
- Material 390×844: list, editor, invalid errors, created refresh, conflict.
|
||
- Cupertino dark 390×844: the same flow and captures.
|
||
- Material 320×844 at 2x text: list and editor top/bottom.
|
||
|
||
Captured facts include the create record
|
||
`{id:0, name:"Probe schedule", pipeline_id:4, version:3, enabled:true,
|
||
input:{prompt:"Summarise the release notes."}, workspace:"/srv/research",
|
||
rule:{every:"24h"}, notify_mode:"auto"}`, a non-empty stable request key, the
|
||
stale-revision conflict text with the typed name retained, a pause payload whose
|
||
only change is `enabled:false` at the loaded revision, and
|
||
`delete_schedule {schedule_id:8, expected_revision:5}`.
|
||
|
||
Captures and manifest:
|
||
|
||
```
|
||
/Users/alan/.local/share/pipelines/data/artifacts/93/public/s1-wire-captures/
|
||
s1w-material-390-list.png
|
||
s1w-material-390-editor.png
|
||
s1w-material-390-invalid.png
|
||
s1w-material-390-created.png
|
||
s1w-material-390-conflict.png
|
||
s1w-cupertino-dark-390-list.png
|
||
s1w-cupertino-dark-390-editor.png
|
||
s1w-cupertino-dark-390-invalid.png
|
||
s1w-cupertino-dark-390-created.png
|
||
s1w-cupertino-dark-390-conflict.png
|
||
s1w-material-320-2x-list.png
|
||
s1w-material-320-2x-editor-top.png
|
||
s1w-material-320-2x-editor-bottom.png
|
||
manifest.json
|
||
```
|
||
|
||
Inspected: Material list/invalid/created/conflict, Cupertino dark
|
||
list/editor/invalid/conflict, and both 320/2x captures. The list shows names,
|
||
`Enabled`/`Paused`, pinned version, timer words and due; the invalid capture
|
||
shows both field errors and the prefilled `3`/`/srv/research`; the conflict
|
||
capture shows the server reason and preservation copy in the host's error colour.
|
||
|
||
The fixture caught a real web defect: `Random().nextInt(1 << 32)` throws on the
|
||
web because JS shifts are 32-bit, so the key range is now `1 << 30`. This was
|
||
only visible in the browser run, not in VM widget tests.
|
||
|
||
## Full diff
|
||
|
||
The complete candidate patch is at
|
||
`/Users/alan/.local/share/pipelines/data/artifacts/93/public/s1-wire.diff`
|
||
(`git show` of the candidate commit).
|
||
|
||
## Honest limits
|
||
|
||
- **Source candidate, not merged/pushed/deployed.** No main merge, canonical URL
|
||
change or service restart.
|
||
- **No live authenticated schedule mutation.** All mutation evidence is the
|
||
isolated fixture; no real operator schedule was created, paused or deleted.
|
||
- **Mobile unverified.** Only web-targeted Flutter tests, analysis and build ran.
|
||
No Android/iOS build, emulator, ADB or device was used.
|
||
- **Advanced run options are preserved but not editable** in the landed form
|
||
(`model`, stage models, other input keys, write paths, allow tools, title,
|
||
output format). Edit keeps them because the draft starts from the exact record.
|
||
- **Create seeds the persisted server workspace when one exists**, matching the
|
||
web's configured workspace; when the preference is empty the form requires the
|
||
operator to enter an absolute path. Create timezone stays blank (server
|
||
timezone), rather than guessing an IANA zone from the browser.
|
||
- **No separate Schedules route entry.** This slice is the pipeline Summary
|
||
section; shell/navigation entry and "Schedule this run" seeding remain
|
||
separate items.
|
||
- **Schedule count provenance on the pipeline list is unchanged.** The section
|
||
does not update the list's `schedule_count`; it refreshes only its own
|
||
`list_schedules` rows.
|