Merge branch 'main' into flutter/x1-search
This commit is contained in:
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
@@ -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.
|
||||
Reference in New Issue
Block a user