Merge branch 'main' into flutter/p1-pipelines
This commit is contained in:
@@ -0,0 +1,150 @@
|
||||
# A1-list — read-only artifact visit list with selection
|
||||
|
||||
## What changed
|
||||
|
||||
All files are new; no existing file was edited. Nothing under `lib/main.dart`,
|
||||
`lib/shell/`, another feature, `pubspec.*`, `web/`, the Go server or `android/`
|
||||
was touched. No dependency was added and no network, url, preview, share,
|
||||
download, filter or gallery code was written.
|
||||
|
||||
| File | Lines | Responsibility |
|
||||
| --- | --- | --- |
|
||||
| `lib/features/artifacts/ui/artifact_visit_list.dart` | 231 | One public read-only widget, its selection callback, and the visit-scoped identity helper |
|
||||
| `test/features/artifacts/ui/artifact_visit_list_fixture.dart` | 85 | Shared recorded fixtures and the native host composition used by the tests |
|
||||
| `test/features/artifacts/ui/artifact_visit_list_test.dart` | 230 | Identity, Material/Cupertino rows, duplicate filename selection, 2x wrapping, honest fallbacks, empty wording |
|
||||
| `test/features/artifacts/ui/artifact_visit_list_semantics_test.dart` | 165 | Header semantics, heading/row separation, read-only rows, selected state |
|
||||
| `tool/artifact_list_probe.dart` | 194 | Isolated fixture entry for browser captures; never changes `main.dart` or the shell |
|
||||
|
||||
## API
|
||||
|
||||
```dart
|
||||
typedef ArtifactSelected =
|
||||
void Function(ArtifactGroup group, ArtifactRecord artifact);
|
||||
|
||||
String artifactVisitIdentity(ArtifactGroup group, ArtifactRecord artifact);
|
||||
|
||||
ArtifactVisitList({
|
||||
required List<ArtifactGroup> groups,
|
||||
String? selectedIdentity,
|
||||
ArtifactSelected? onSelected,
|
||||
})
|
||||
```
|
||||
|
||||
`artifactVisitIdentity` combines the recorded stage key, the group's recorded
|
||||
display visit and the record's recorded url (or its name when no url was
|
||||
recorded). A filename alone is never an identity, so `result.csv` from visit 1
|
||||
and visit 2 remain distinct even when both records carry the same url. The
|
||||
callback returns the exact `ArtifactGroup` and `ArtifactRecord` that was tapped.
|
||||
|
||||
## Behaviour
|
||||
|
||||
- Each group heading is the web client's vocabulary: `stage · visit N`, taken
|
||||
from the existing `ArtifactGroup` (`displayVisit` already owns the number).
|
||||
- Each row shows the recorded filename, the recorded MIME (parameters trimmed)
|
||||
and the recorded size via the existing `humanBytes`. An empty name renders
|
||||
`(unnamed artifact)` and an empty content type renders `type not recorded`;
|
||||
nothing is inferred from the extension, and no url is displayed or resolved.
|
||||
- The size value and unit are joined by a non-breaking space, so `120.6 KiB`
|
||||
never splits across lines at narrow widths.
|
||||
- Material hosts get `ListTile` rows (title = name, subtitle = facts); Cupertino
|
||||
hosts get `CupertinoListSection.insetGrouped` with a native `CupertinoButton`
|
||||
row so the name can wrap (the stock `CupertinoListTile` title is forced to one
|
||||
line). Name uses the theme text style and facts use the platform
|
||||
`secondaryLabel` colour, so the recorded name leads the hierarchy. No custom
|
||||
font, palette or fixed row/button dimensions are declared; rows grow with
|
||||
content and text scale.
|
||||
- Cupertino rows set `hasLeading: false`, so the inter-row divider aligns with
|
||||
the text instead of an absent leading column.
|
||||
- Both hosts expose every group heading as its own header semantics node, and
|
||||
every Cupertino row as its own node. A heading can neither be read as part of
|
||||
a row nor activate one (see the regression tests).
|
||||
- A row without `onSelected` is read-only: Material has no tap action, and the
|
||||
Cupertino row is a plain padded row rather than a disabled `CupertinoButton`
|
||||
(which still exposes a button role). It never renders as a button; the
|
||||
semantics regression asserts both no tap action and no button role.
|
||||
- Empty input says `No stage artifacts recorded.`, the web client's wording.
|
||||
- The only action is `onSelected`. No capture/visit facts are invented or masked.
|
||||
|
||||
## Fixes from UI review visit 1
|
||||
|
||||
1. **Cupertino heading semantics.** `CupertinoListSection` does not create
|
||||
semantics for its header. The header is now wrapped in
|
||||
`Semantics(container: true, header: true, …)` and each Cupertino row is its
|
||||
own `Semantics(container: true, …)` node. Browser check: three
|
||||
`<h2 role="heading">` nodes now exist, the `review · visit 2` heading rect is
|
||||
`[20, 482.5, 118.2, 23]` and its row `[20, 511.5, 350, 72]`; the row label is
|
||||
`result.csv / text/csv · 4.0 KiB` without the heading. Clicking the heading
|
||||
centre leaves the selection at `Selected: none`.
|
||||
2. **Cupertino grouped background seam.** The probe composition now sets
|
||||
`CupertinoPageScaffold(backgroundColor: CupertinoColors.systemGroupedBackground)`.
|
||||
At logical x=10 the whole 390×844 viewport is uniformly `rgb(242,242,247)`
|
||||
in light mode, before and after selection; no white band below the last
|
||||
section. **Requirement for the future gallery:** the composing page must set
|
||||
the same background, or paint the grouped background behind the list.
|
||||
|
||||
Advisories from both earlier reviews were addressed where they touch this
|
||||
slice: dangling `selectedIdentity` doc link, divider inset, name/metadata
|
||||
hierarchy, value/unit wrapping and read-only rows. Unit coverage now uses a
|
||||
record the server actually sent without a url, so the identity fallback to the
|
||||
recorded name is exercised directly, alongside the unnamed and
|
||||
missing-content-type fallbacks. The 2x wrap regression asserts a multi-line
|
||||
height rather than a single-line threshold.
|
||||
|
||||
## Real browser evidence
|
||||
|
||||
Built with `flutter build web -t tool/artifact_list_probe.dart` and driven in an
|
||||
isolated headless Chrome (Chrome 155, DevTools protocol, `prefers-color-scheme:
|
||||
light`, 390×844 at DPR 2) against a loopback static server on an OS-assigned
|
||||
port. No production server, no real run data. The probe fixture contains two
|
||||
same-named `result.csv` records in different visits.
|
||||
|
||||
- Initial: `Selected: none`; three heading nodes `build · visit 1`,
|
||||
`review · visit 1`, `review · visit 2`.
|
||||
- Heading `review · visit 2` clicked: status stays `Selected: none`; no
|
||||
`aria-current` row.
|
||||
- Row `review · visit 2` clicked: `Selected: review · visit 2 · result.csv`;
|
||||
only that row has `aria-current="true"`.
|
||||
- Material host still exposes three `<h2>` headings and the same four rows.
|
||||
|
||||
Shared evidence:
|
||||
|
||||
- `/Users/alan/.local/share/pipelines/data/artifacts/65/public/a1-code-cupertino-390-initial.png`
|
||||
- `/Users/alan/.local/share/pipelines/data/artifacts/65/public/a1-code-cupertino-390-visit2.png`
|
||||
- `/Users/alan/.local/share/pipelines/data/artifacts/65/public/a1-code-material-390.png`
|
||||
- `/Users/alan/.local/share/pipelines/data/artifacts/65/public/a1-code-manifest.json`
|
||||
|
||||
The capture driver is stage-private (`04-Code/private/capture_a1_fix.mjs`);
|
||||
Chrome and its temporary profile were removed after the run.
|
||||
|
||||
## Checks actually run
|
||||
|
||||
On the branch after merging `main` (fast-forward, no conflicts):
|
||||
|
||||
```
|
||||
flutter test test/features/artifacts/ui # 11 passed
|
||||
flutter test test/features/artifacts # 71 passed
|
||||
flutter test # 524 passed (whole app)
|
||||
flutter analyze # No issues found! (1.4s)
|
||||
dart format --set-exit-if-changed # 5 files, 0 changed
|
||||
flutter build web -t tool/artifact_list_probe.dart # ✓ Built build/web (15.9s)
|
||||
```
|
||||
|
||||
`git status --short --untracked-files=all` lists only the six new files above;
|
||||
`pubspec.yaml`/`pubspec.lock` are unchanged. The branch merges current `main`
|
||||
with no conflicts and nothing is pushed or deployed.
|
||||
|
||||
## Honest limits
|
||||
|
||||
- No gallery screen, shell registration, preview, viewer, share or download is
|
||||
part of this slice; the widget is ready for the manager to compose.
|
||||
- The list is scrollable and requires bounded height (a `ListView`); composition
|
||||
into the run detail is a later slice. The gallery must supply the grouped page
|
||||
background noted above.
|
||||
- The browser pass covered Cupertino light 390 (initial and visit 2) and a
|
||||
Material heading/row check; large-text Cupertino and dark-mode recaptures were
|
||||
not repeated this visit. The 2x wrapping regression runs in the widget tests.
|
||||
Full rendered acceptance belongs to the UI review stage.
|
||||
- Mobile is unverified: only web was built and captured; no Android/iOS build,
|
||||
emulator, ADB or device was used.
|
||||
- Handed to landing: committed on `flutter/a1-visit-list` after merging `main`;
|
||||
the manager owns integration into `main` and delivery.
|
||||
@@ -0,0 +1,101 @@
|
||||
# A1a — artifact records, capture facts, grouping, kinds and safe urls
|
||||
|
||||
## What changed
|
||||
|
||||
New nonvisual `artifacts` domain slice. Every file is new; no existing file was
|
||||
edited. Nothing under `lib/main.dart`, `lib/shell/`, another feature, `pubspec.*`,
|
||||
`web/`, the Go server or `android/` was touched. No dependency was added and no
|
||||
network/transport code was written.
|
||||
|
||||
| File | Lines | Responsibility |
|
||||
| --- | --- | --- |
|
||||
| `lib/features/artifacts/domain/artifact_record.dart` | 85 | One recorded artifact: name, url, content type, size and deeply read-only `raw`; retired `session.md` and system names |
|
||||
| `lib/features/artifacts/domain/artifact_capture.dart` | 63 | Per-step capture availability (`unavailable`/`recorded`), recorded files, skipped and truncated counts |
|
||||
| `lib/features/artifacts/domain/artifact_selection.dart` | 67 | Record parsing, retired/system/repair filtering (`presented`, `stage`, `system`) |
|
||||
| `lib/features/artifacts/domain/artifact_groups.dart` | 109 | Group stage artifacts by stage and recorded visit; shared `public/` attribution; per-visit list |
|
||||
| `lib/features/artifacts/domain/artifact_kind.dart` | 225 | MIME/extension kind vocabulary, labels, markdown/viewer predicates, `humanBytes` |
|
||||
| `lib/features/artifacts/domain/artifact_summary.dart` | 78 | Run/visit summary and empty wording, partial-capture flag and notes |
|
||||
| `lib/features/artifacts/domain/gallery_navigation.dart` | 76 | Filtered viewer page order, stable identities, previous/next clamp, position label |
|
||||
| `lib/features/artifacts/domain/artifact_url.dart` | 78 | Safe http(s) resolution against the configured endpoint and cross-origin marking |
|
||||
| `test/features/artifacts/domain/artifact_fixtures.dart` | 44 | Local step/artifact fixtures; no fake gateway or socket |
|
||||
| `test/features/artifacts/domain/artifact_capture_test.dart` | 241 | Unavailable/null/empty/partial capture facts and exact wording |
|
||||
| `test/features/artifacts/domain/artifact_groups_test.dart` | 308 | Visits, identity, retired/utility files, public attribution, empty states |
|
||||
| `test/features/artifacts/domain/artifact_selection_test.dart` | 154 | Field preservation, deep immutability, filtering, duplicates |
|
||||
| `test/features/artifacts/domain/artifact_kind_test.dart` | 110 | Known/unknown MIME and extension classification, markdown/viewer gates, bytes |
|
||||
| `test/features/artifacts/domain/gallery_navigation_test.dart` | 197 | Filtered order, duplicate urls/names, url-less identities, paging clamp, label |
|
||||
| `test/features/artifacts/domain/artifact_url_test.dart` | 148 | Relative/absolute urls, wss/https, IPv6, encoded path/query, schemes, credentials, cross-origin |
|
||||
|
||||
## Behaviour (from `web/src/artifacts.js` and `artifactNavigation.js`)
|
||||
|
||||
- **Record facts are verbatim.** `ArtifactRecord.fromJson` reads `name`, `url`,
|
||||
`content_type`, `size_bytes` and keeps every other server field in a deep
|
||||
unmodifiable `raw`. A missing url stays `''`; nothing is derived from the name.
|
||||
Two records with the same name stay distinct because identity is the recorded
|
||||
url (or a visit-scoped fallback in the viewer).
|
||||
- **Capture availability is a recorded fact.** An absent, null or non-list
|
||||
`artifacts` field is `unavailable`; an explicit empty list is a recorded empty
|
||||
capture. `artifacts_skipped`/`artifacts_truncated` are preserved as counts and
|
||||
mark a partial capture. Unavailable capture never degrades to "no artifacts"
|
||||
or "not recorded": the run header says `Artifacts · capture unavailable`
|
||||
instead of `No artifacts recorded for this run.`, which is the task's explicit
|
||||
requirement and the one deliberate wording extension beyond the web client.
|
||||
- **Grouping and identity.** `artifactGroups` keeps first-appearance stage order,
|
||||
orders each stage's visits by sequence (recorded order on ties), and uses
|
||||
`displayVisit` from the existing graph domain (`control.visit` when positive,
|
||||
else position + 1). A step with no presented stage artifact yields no group, so
|
||||
unavailable/empty captures and utility-only visits never fabricate a visit.
|
||||
Shared `public/` files are attributed to the first recorded visit; repeated
|
||||
non-public names in later visits remain separate artifacts.
|
||||
- **Retired and utility files.** `session.md` is hidden everywhere; `session.html`,
|
||||
`input.md`, `memory.md`, `output.md` remain system evidence and are excluded
|
||||
from stage output. Repaired session exports named by `session_export_repairs`
|
||||
are system evidence too.
|
||||
- **Kinds.** Image/video come from the content type; audio, PDF, JSON, archive,
|
||||
spreadsheet, log, code, document then match normalised MIME or extension;
|
||||
unknown values are `other`/`File`. `isMarkdownArtifact`/`isViewerArtifact` keep
|
||||
logs, source, CSV and HTML out of the in-app viewer while images, videos and
|
||||
md/markdown/txt pages enter it.
|
||||
- **Navigation.** `pagedArtifacts` filters group by group in recorded order;
|
||||
`viewerIndexByUrl` maps the first occurrence of each url; url-less pages use a
|
||||
visit-scoped identity; `pagedIndex` clamps with no wrap; the position label
|
||||
trims content-type parameters and falls back to `artifact`.
|
||||
- **Safe urls.** Server-relative paths resolve against the configured endpoint's
|
||||
http(s) origin (endpoint path/query dropped, `wss` → `https`, IPv6 brackets and
|
||||
percent-encoding kept). Absolute http(s) urls are preserved. Output is always
|
||||
http(s): blank, protocol-relative, backslash-relative, hostless, credentialed,
|
||||
malformed and non-http(s) urls return null. A url whose origin differs from the
|
||||
configured origin is marked `external`, so a future authenticated fetch can
|
||||
refuse to send cookies or headers; a same-origin url stays internal.
|
||||
|
||||
## Review and quality fixes in this visit
|
||||
|
||||
- `flutter analyze` reported four infos in this slice; all fixed: block braces in
|
||||
`artifact_summary.dart` and null-aware map entries (`'key': ?value`) in the
|
||||
test fixtures. Analyze is now clean for the whole app.
|
||||
- `dart format` found one unformatted test file; all 15 files are now formatted.
|
||||
- Semantics were re-read against `web/src/artifacts.js` (`presentedArtifacts`,
|
||||
`stageArtifacts`, `systemArtifacts`, `artifactKind`, `pagedArtifacts`,
|
||||
`viewerIndexByUrl`, `pagedIndex`, `displayVisit`) and `artifactNavigation.js`.
|
||||
No other concrete deviation was found, so no behaviour was rewritten.
|
||||
|
||||
## Checks actually run
|
||||
|
||||
```
|
||||
flutter test test/features/artifacts/domain # 60 passed
|
||||
flutter test test/features/graph/domain # 41 passed (stage_visits reuse)
|
||||
flutter analyze # No issues found! (0.9s)
|
||||
dart format lib/features/artifacts test/features/artifacts # clean, 15 files
|
||||
grep trailing whitespace # none
|
||||
```
|
||||
|
||||
## Honest limits
|
||||
|
||||
- No gallery screen, viewer, sharing, fetching or transport helper exists in this
|
||||
slice, so there is no rendered change and no browser capture. The gallery and
|
||||
viewer are separate future slices.
|
||||
- No live server, socket, artifact download or real run data was used; tests are
|
||||
local fixtures and pure functions only.
|
||||
- Mobile is unverified: no Android/iOS build, emulator, ADB or device was used.
|
||||
- **Committed by the Land stage** as `ff0f812` on `flutter/a1-data` and merged
|
||||
with `main` in `a303368`; the checks above were re-run on the merged candidate.
|
||||
This stage did not merge into `main`, push or deploy.
|
||||
@@ -0,0 +1,5 @@
|
||||
# C1 — Chat sessions and repository adapter
|
||||
|
||||
The sessions browser now requests server directory and backend catalogs before showing the create dialog, exposes both selectors and model-default guidance, and reports unavailable catalog capabilities instead of silently substituting values. Catalog envelope regressions are covered. Closed starred rows no longer appear twice; directory headings appear only when grouping multiple directories; empty and search-no-match states are distinct.
|
||||
|
||||
Verification: focused chat tests, `flutter analyze`, fixture `flutter build web -t tool/chat_sessions_probe_entry.dart`, `git diff --check`, and an isolated Chrome DevTools probe passed. Captures: `/private/var/folders/jp/q0qvjyg54fl_c5vhhk1ylz2m0000gn/T/opencode/chat-sessions-capture/chat-sessions-phone.png` and `chat-sessions-create-dialog.png` (plus desktop). The probe enabled semantics, matched the exact “New chat” label, and verified the rendered body changed to show server catalog controls. Cupertino-specific controls, controller/row/dialog decomposition under 250 lines, and wider out-of-order reply UI regression coverage remain incomplete; this is not a parity-complete delivery. Mobile builds were not performed. The fixture entry point is `tool/chat_sessions_probe_entry.dart`.
|
||||
@@ -0,0 +1,163 @@
|
||||
# C1b — Chat session browser completion
|
||||
|
||||
The 406-line sessions screen is split into a controller, adaptive primitives,
|
||||
session groups/rows, action dialogs, a rename dialog and a create dialog. The
|
||||
server directory and backend catalogs, the instructions field, the closed/star
|
||||
grouping and the distinct empty/no-match states are retained. No repository,
|
||||
domain, shell or pubspec file changed.
|
||||
|
||||
The UI review's must-fix is addressed: Cupertino no-match, empty and error
|
||||
messages are no longer forced through `CupertinoListTile`'s one-line title. They
|
||||
use a wrapping grouped card with `Clear search`/`Retry` as separate buttons. The
|
||||
same turn also fixed the related behavioural findings: a failed initial load no
|
||||
longer also shows the empty-server message, creating a chat opens it without
|
||||
waiting for the list refresh, blank rename disables Save, and row action labels
|
||||
name their session (adding the id when titles repeat).
|
||||
|
||||
The second UI review's must-fixes are also addressed:
|
||||
|
||||
- `ChatCupertinoMessage` now sets `DefaultTextStyle.merge` from
|
||||
`CupertinoTheme.of(context).textTheme.textStyle`. Mounted under a bare
|
||||
`MaterialApp` (the screen's iOS/macOS path, no `Material` ancestor), its text
|
||||
previously inherited MaterialApp's intentional "missing Material" fallback
|
||||
style (48px red monospace with a double yellow underline). The card now
|
||||
renders as ordinary Cupertino body text in that configuration.
|
||||
- The Material rename dialog sets `helperMaxLines: 2`, so "This name is shared
|
||||
with every device." wraps instead of being ellipsised at 2.0x text scale.
|
||||
|
||||
## Source layout
|
||||
|
||||
All paths under `lib/features/chat/ui/sessions/` (1,584 lines total):
|
||||
|
||||
| File | Lines | Responsibility |
|
||||
| --- | ---: | --- |
|
||||
| `chat_sessions_screen.dart` | 176 | Screen composition, toolbar/FAB, controller wiring |
|
||||
| `chat_sessions_controller.dart` | 111 | List state, generation-guarded refresh, row actions, create |
|
||||
| `chat_sessions_body.dart` | 97 | Filtering, starred/open/closed sections, duplicate titles |
|
||||
| `session_list_material.dart` | 140 | Material list sections and rows |
|
||||
| `session_list_cupertino.dart` | 134 | Cupertino list sections and rows |
|
||||
| `session_row_style.dart` | 51 | Shared subtitle, icons and action labels |
|
||||
| `session_actions.dart` | 161 | Star control, actions menu/sheet, close confirmation |
|
||||
| `rename_chat_dialog.dart` | 107 | Rename dialog and its blank-name guard |
|
||||
| `create_chat_dialog.dart` | 222 | Create state, draft fields, submit |
|
||||
| `chat_create_fields.dart` | 185 | Catalog loading/error/retry and directory/backend pickers |
|
||||
| `chat_adaptive.dart` | 200 | Style detection, bar actions, search, wrapping message card, loading |
|
||||
|
||||
`chatControlsStyleOf` chooses Cupertino for a Cupertino app (no `MaterialApp`
|
||||
ancestor) and for iOS/macOS Material themes; Material otherwise. The Cupertino
|
||||
branch uses only Cupertino controls (`CupertinoPageScaffold`,
|
||||
`CupertinoNavigationBar`, `CupertinoSearchTextField`, `CupertinoListSection`/
|
||||
`CupertinoListTile`, `CupertinoAlertDialog`, `CupertinoActionSheet`,
|
||||
`CupertinoTextField`, `CupertinoActivityIndicator`). It therefore has no
|
||||
Material ancestor dependency. The `SafeArea` in that branch keeps the search
|
||||
field below the translucent navigation bar (the first browser capture caught
|
||||
this overlap).
|
||||
|
||||
Behavior:
|
||||
|
||||
- `chat_sessions`, `chat_directories`, `chat_backends` and `chat_create` use the
|
||||
existing repository envelopes; no fallback directory or backend is invented.
|
||||
- A catalog failure keeps the dialog open, shows the server reason with Retry,
|
||||
and retains the typed name and instructions.
|
||||
- Closed starred rows appear once, only under Closed.
|
||||
- Directory headings appear only when a section has more than one directory.
|
||||
- Empty and search-no-match states stay distinct; "Clear search" restores the
|
||||
list. In the Cupertino branch the message and its action are a wrapping
|
||||
`ChatCupertinoMessage` card, and a failed load uses the same card for the
|
||||
server reason with Retry. The failed initial load no longer also renders the
|
||||
empty-server message. The card supplies a Cupertino text style, so it renders
|
||||
normally when the Cupertino branch is mounted under the app's bare
|
||||
`MaterialApp` root instead of a `Material`/`CupertinoApp`.
|
||||
- Creating a chat opens it as soon as `chat_create` replies; the list refresh
|
||||
continues in the background, so a slow listing cannot look like a failed
|
||||
create.
|
||||
- Star, rename, close (with the web's confirmation wording), reopen and row
|
||||
opening keep their existing request shapes. Save is disabled while the
|
||||
rename name is blank, matching the web dialog.
|
||||
- Row action labels are `Chat actions for {title}`, adding `({id})` when two
|
||||
visible sessions share a title, matching the web's accessible label.
|
||||
|
||||
## Checks (actual)
|
||||
|
||||
- `flutter test test/features/chat/ui/sessions`: 24 widget tests, all passed.
|
||||
They cover Material and Cupertino list branches, both create branches, the
|
||||
delayed catalog failure with draft retention and Retry, rename/close/reopen/
|
||||
star, blank-name Save disabling in both branches, the close confirmation,
|
||||
catalog-empty state, stale refresh ordering, dispose while a reply is
|
||||
pending, opening a created chat before the refresh completes, Cupertino
|
||||
no-match/error wrapping (including 2x text scale), separate Clear search
|
||||
semantics, duplicate-title action labels, the Cupertino message card under a
|
||||
bare `MaterialApp` iOS theme (empty, no-match, long error style), and the
|
||||
Material rename helper at 2x text scale. The three MaterialApp-hosted tests
|
||||
fail when the `DefaultTextStyle` merge is removed (verified).
|
||||
- `flutter test`: 46 tests passed.
|
||||
- `flutter analyze`: no issues.
|
||||
- `flutter build web`: built `lib/main.dart` successfully.
|
||||
- Fixture probe built for both variants and run in real headless Chrome through
|
||||
the local loopback server in `tool/chat_sessions_probe.mjs`. Each run loaded
|
||||
the list, opened the create dialog, confirmed the rendered catalog controls,
|
||||
opened a row action menu/sheet, and captured PNGs. The probe now clicks the
|
||||
per-session action label and requires `Rename…` in the action labels instead
|
||||
of accepting the dismiss barrier. Material and Cupertino PNGs were inspected.
|
||||
|
||||
Captures from this turn's fix (shared with later stages under
|
||||
`public/c1b-fix/`):
|
||||
|
||||
- `/Users/alan/.local/share/pipelines/data/artifacts/42/public/c1b-fix/cupertino-fix-search-no-match.png` — light, 390x844, long query wraps in full with Clear search on its own line.
|
||||
- `.../cupertino-fix-search-no-match-dark.png` — same state in dark appearance.
|
||||
- `.../cupertino-fix-load-error.png` — long server reason wraps; Retry is separate and the empty-server message is absent.
|
||||
- `.../cupertino-fix-list-phone.png` and `.../material-fix-actions.png` — probe list and actions after the label change.
|
||||
|
||||
Probe commands (run from `app/`):
|
||||
|
||||
```sh
|
||||
flutter build web -t tool/chat_sessions_probe_entry.dart \
|
||||
--dart-define=CHAT_PROBE_STYLE=material --output build/probe-material-fix
|
||||
PROBE_WEB_ROOT="$PWD/build/probe-material-fix" PROBE_VARIANT=material \
|
||||
OPENCODE_ARTIFACT_DIR=/private/var/folders/jp/q0qvjyg54fl_c5vhhk1ylz2m0000gn/T/opencode/chat-sessions-capture \
|
||||
node tool/chat_sessions_probe.mjs
|
||||
# repeat with CHAT_PROBE_STYLE=cupertino and build/probe-cupertino-fix
|
||||
```
|
||||
|
||||
Captures for the second review's fixes (same `public/c1b-fix/` folder, real
|
||||
headless Chrome at 390x844 through a temporary fixture entry that was deleted
|
||||
afterwards; the shipped probe entry was not changed):
|
||||
|
||||
- `platform-default-empty-phone.png` — `MaterialApp` default theme (macOS →
|
||||
Cupertino branch), empty server. The message is ordinary body text.
|
||||
- `platform-default-search-no-match-phone.png` — long query; message wraps and
|
||||
`Clear search` is a separate control.
|
||||
- `platform-default-error-phone.png` — long server reason wraps; `Retry` is
|
||||
separate and no empty-server message appears.
|
||||
- `material-scale2-rename-phone.png` — Material rename dialog at 2.0x text
|
||||
scale; the helper sentence wraps onto two lines in full.
|
||||
|
||||
## Not changed in this turn
|
||||
|
||||
These review notes remain advisory and were left alone because they predate
|
||||
C1b or are native behaviour:
|
||||
|
||||
- The Material FAB can still cover the last row's star/actions when the list
|
||||
exactly fills a phone viewport. Same as the base screen.
|
||||
- Raw exception text (`Bad state: …`, `Exception: …`) is still shown to the
|
||||
operator; wording belongs to a separate error-presentation change.
|
||||
- Cupertino row titles/subtitles still truncate to one line (standard
|
||||
`CupertinoListTile` behaviour). The no-match/error messages no longer do.
|
||||
- The Cupertino-under-MaterialApp probe still takes its accent from the ambient
|
||||
`ThemeData`. No theme override was added.
|
||||
|
||||
## Remaining gaps
|
||||
|
||||
- Mobile is unverified: no Android/iOS builds, devices or installs were run.
|
||||
Source is portable but only web was exercised.
|
||||
- Browser evidence uses the fixture gateway, not an authenticated live server.
|
||||
No real chat was created, renamed, closed or starred in the browser; those
|
||||
request paths are covered by widget tests.
|
||||
- The Cupertino list/actions probes use the local Chrome dark appearance; the
|
||||
no-match fix was captured in both light and dark. The long-error capture came
|
||||
from a temporary private fixture entry that was deleted afterwards.
|
||||
- The create dialog still omits the web's default instruction text and its
|
||||
backend segmented control; it preserves the existing name/directory/backend/
|
||||
instructions request fields.
|
||||
- This stage did not commit. The changes remain an uncommitted working-tree
|
||||
candidate for the next stage.
|
||||
+323
@@ -0,0 +1,323 @@
|
||||
# D1 — run changes and the file diff viewer
|
||||
|
||||
New feature under `lib/features/changes/`; no server, legacy web/Android or
|
||||
pubspec changes remain after manager acceptance corrections.
|
||||
|
||||
## Current manager acceptance (supersedes earlier presentation evidence below)
|
||||
|
||||
The pipeline's bundled font and fixed green/red palette were rejected against
|
||||
the user's native-defaults requirement. Manager removed both and the font assets
|
||||
without changing raw patch, capture or visit semantics. Typography inherits the
|
||||
host; colours use native semantic roles and no row tint. The original candidate
|
||||
and its review evidence remain referenced at15cca17; later font/palette evidence
|
||||
in this note is historical, NOT evidence for the final native-defaults patch.
|
||||
|
||||
Updated regressions failed against the original overrides, then all47 focused
|
||||
tests passed after correction; analyzer clean. Fresh fixture web build and
|
||||
changes_probe passed (including absence of custom font), producing18 new captures
|
||||
under approved temp/native-diff-manager-captures. Manager inspected both native
|
||||
phone2x rendered views. Preview/shell integration and mobile remain unverified.
|
||||
|
||||
## Public API
|
||||
|
||||
Import the barrel:
|
||||
|
||||
```dart
|
||||
import 'package:pipelines_app/features/changes/changes.dart';
|
||||
```
|
||||
|
||||
Integration widgets:
|
||||
|
||||
- `ChangesViewer({Key? key, required List<JsonMap> steps})`
|
||||
- The run detail's `steps` exactly as returned by `get_run`. Pass the same
|
||||
list instance until the server reply changes: captures and the summary are
|
||||
derived once per list identity, not on every rebuild or filter keystroke.
|
||||
- It fills the available height, so place it in a bounded parent (Scaffold
|
||||
body, tab body or `Expanded`). It does not open a socket or request data.
|
||||
- `FileDiffViewer({Key? key, required FileChange file, VoidCallback? onClose})`
|
||||
- The reusable viewer for one recorded file. Without `onClose` it pops the
|
||||
enclosing route.
|
||||
- `Future<void> showFileDiffViewer(BuildContext context, FileChange file)`
|
||||
- Opens the platform modal: `showDialog` with a Material `Dialog` on
|
||||
Android/desktop/web, `showCupertinoDialog` with `CupertinoPopupSurface` on
|
||||
iOS/macOS.
|
||||
|
||||
Data and pure helpers exported for integration/tests:
|
||||
|
||||
- `FileChange` — `path`, `kind`, `patch` (server bytes or null), `binary`,
|
||||
`truncated`, `beforeMode`, `afterMode`, `steps`; `FileChange.fromJson(JsonMap)`,
|
||||
`FileChange.tryParse(dynamic)`.
|
||||
- `ChangeCapture` — `status`, `scope`, `files`, `skipped`, `omitted`,
|
||||
`diagnostic`; `ChangeCapture.fromJson(JsonMap)`.
|
||||
- `StageCapture` / `StageCapture.fromStep(JsonMap)` / `stageCaptures(steps)` —
|
||||
one stage visit per step, ordered by numeric sequence, including steps with no
|
||||
capture. `sequence` is the run-wide step ordinal (ordering and keys); `visit`
|
||||
is the display visit number within the stage.
|
||||
- `RunChanges` / `runChanges(steps)` / `runChangesFor(captures)` — final-state
|
||||
aggregate (last recorded visit wins per path; each path counted once) with the
|
||||
same fields. `runChangesFor` avoids re-deriving captures a caller already has.
|
||||
- `parseUnifiedPatch`, `PatchHunk`, `PatchLine`, `ChangeLineKind`, `gutterWidth`,
|
||||
`gutterText`, `changeStat`, `changeKind`, `changeKindLabel`, `changeKindTitle`.
|
||||
- Wording: `runChangesHeader`, `runChangesNote`, `changesListSummary`,
|
||||
`noChangeDetail`, `patchUnavailableReason`, `changeEntryTags`, `changeRowMeta`,
|
||||
`changeFileMeta`, `fileChangesSummary`, `filterFileChanges`,
|
||||
`changePositionLabel`, `binaryDiffMessage`, `truncatedPatchNote`,
|
||||
`noLineChangesMessage`, `missingCaptureDetail`, `unavailableCaptureDetail`,
|
||||
`malformedCaptureDetail`, `emptyCaptureDetail`, `partialCaptureDetail`.
|
||||
|
||||
Example integration:
|
||||
|
||||
```dart
|
||||
final steps = (detail['steps'] as List).cast<JsonMap>();
|
||||
// ...
|
||||
ChangesViewer(steps: steps)
|
||||
```
|
||||
|
||||
The manager owns shell/run-detail registration; this item does not edit them.
|
||||
|
||||
## Recorded-evidence semantics (matches `web/src/changes.js`)
|
||||
|
||||
- `file_changes == null` is **missing evidence**, not “no changes”. A
|
||||
running/waiting step is “pending”; any other missing capture is counted and
|
||||
named. The UI says the capture is unavailable and explicitly says that does not
|
||||
mean the workspace was unchanged.
|
||||
- `status: "unavailable"` means the snapshots could not be compared. No change
|
||||
list is fabricated; the server diagnostic is shown. A non-null `file_changes`
|
||||
value that is not an object is also unreadable evidence, so it is treated as
|
||||
unavailable with `malformedCaptureDetail`; it never becomes an empty capture.
|
||||
- A present complete capture with `files: []` is the only “no changes observed”
|
||||
state (“the captured snapshots were identical”).
|
||||
- `status: "partial"`, any per-file `truncated`, or any `omitted` count makes the
|
||||
run partial; `skipped`, `omitted`, truncated-file count and the diagnostic are
|
||||
shown. `scope` is shown per stage capture.
|
||||
- Files are grouped by stage/visit. The visit label is the recorded
|
||||
`control.visit` when it is positive (a resumed run), otherwise the visit's
|
||||
1-based position among the steps of its own stage, ordered by sequence and
|
||||
stable for ties. This mirrors the web client's `displayVisit`; the run-wide
|
||||
step `sequence` is only the ordering/key, never shown as a visit number.
|
||||
- Kinds are `added`, `modified`, `deleted` and the safe `changed` fallback.
|
||||
Binary, truncated and mode-only entries carry labels; a mode-only entry has no
|
||||
text diff and says so.
|
||||
- The run summary is final-state: a path recorded by several visits is one row,
|
||||
keeping first-seen order and the last visit's kind/patch/stat/flags/modes, with
|
||||
the stage names that touched it. Per-stage sections still show each visit's own
|
||||
capture.
|
||||
- Filtering matches changed filenames case-insensitively (substring) and keeps
|
||||
missing/unavailable evidence sections visible. The counter names **paths**,
|
||||
matching the summary's unit; the sections below still list one row per visit.
|
||||
- A changed-file row's semantics label names the action, path, kind and visible
|
||||
meta (`+N -M`, binary/truncated/mode), so the excluded icon and subtitle are
|
||||
still announced.
|
||||
|
||||
## Diff rendering
|
||||
|
||||
- Only patch content is custom-drawn: `@@` hunk headers, old/new gutter numbers,
|
||||
the shared `+`/`-`/space language, context and `\ No newline` markers.
|
||||
- The recorded `---`/`+++` file headers stay in the Raw view, matching the web
|
||||
rendered view; rendered content is the stat line and the hunks. Long lines
|
||||
scroll horizontally; vertical content scrolls inside the dialog. The Raw view
|
||||
keeps each recorded line on one line and scrolls sideways, like the web's
|
||||
`white-space: pre` pane, so a wrapped continuation can never be mistaken for a
|
||||
new patch line.
|
||||
- Patch/path text inherits the native host typography without a font-family,
|
||||
size or weight override. Manager removed the candidate's bundled code font:
|
||||
a previous visual review requested it, but that contradicts the user's
|
||||
explicit native-defaults requirement, which also applies to diffs. The web
|
||||
default may be proportional; no monospace guarantee is claimed. Raw patch
|
||||
bytes are unchanged. No bundled font or pubspec change remains.
|
||||
- Rendered/Raw is a native Material `SegmentedButton` or Cupertino
|
||||
`CupertinoSlidingSegmentedControl`. Copy patch and Close are native Material
|
||||
buttons/icon button or Cupertino buttons with exact labels.
|
||||
- Copy patch writes the recorded `patch` string byte-for-byte (trailing newline
|
||||
and truncated final line included). Copy is disabled when no readable patch
|
||||
exists.
|
||||
- Binary uses the honest binary message; truncated-with-patch shows the note plus
|
||||
the retained text; truncated-without-patch and mode-only show the recorded
|
||||
reason, never an invented empty diff.
|
||||
- Add/remove markers and stats use native semantic colours (Material primary/
|
||||
error; Cupertino systemGreen/destructiveRed), with no bespoke palette or added
|
||||
tint. +/- and recorded gutter numbers distinguish changes without colour.
|
||||
Rows share the hunk width, at least the dialog width.
|
||||
- A Cupertino list row lets its recorded path wrap instead of inheriting the
|
||||
tile's single ellipsized line, and the Cupertino dialog surface is inset from
|
||||
the window edge (16 on phones, 40 on wide windows) so its native rounded
|
||||
corners are visible.
|
||||
|
||||
## Files
|
||||
|
||||
```
|
||||
lib/features/changes/changes.dart
|
||||
lib/features/changes/domain/change_capture.dart
|
||||
lib/features/changes/domain/change_kind.dart
|
||||
lib/features/changes/domain/change_wording.dart
|
||||
lib/features/changes/domain/file_change.dart
|
||||
lib/features/changes/domain/patch_models.dart
|
||||
lib/features/changes/domain/run_changes.dart
|
||||
lib/features/changes/domain/unified_patch.dart
|
||||
lib/features/changes/widgets/change_style.dart
|
||||
lib/features/changes/widgets/changes_viewer.dart
|
||||
lib/features/changes/widgets/capture_section.dart
|
||||
lib/features/changes/widgets/file_diff_viewer.dart
|
||||
lib/features/changes/widgets/patch_view.dart
|
||||
assets/fonts/RobotoMono.ttf
|
||||
assets/fonts/OFL.txt
|
||||
pubspec.yaml (fonts + assets declaration)
|
||||
test/features/changes/fixtures.dart
|
||||
test/features/changes/widget_hosts.dart
|
||||
test/features/changes/unified_patch_test.dart
|
||||
test/features/changes/run_changes_test.dart
|
||||
test/features/changes/changes_viewer_test.dart
|
||||
test/features/changes/diff_presentation_test.dart
|
||||
tool/changes_probe_entry.dart
|
||||
tool/changes_probe.mjs
|
||||
```
|
||||
|
||||
Every path above is new except `pubspec.yaml`, which gains only the
|
||||
`RobotoMono` family and the font licence asset declaration.
|
||||
|
||||
## Checks
|
||||
|
||||
Presentation revision (bundled code face, diff colours/tints, Cupertino rows and
|
||||
dialog inset) re-ran the full set:
|
||||
|
||||
- `/Users/alan/development/flutter/bin/flutter test` — **76 tests passed**.
|
||||
- `/Users/alan/development/flutter/bin/flutter test test/features/changes` —
|
||||
**47 tests passed**.
|
||||
- `/Users/alan/development/flutter/bin/flutter analyze` — **No issues found**.
|
||||
- `/Users/alan/development/flutter/bin/dart format --output=none
|
||||
--set-exit-if-changed lib/features/changes test/features/changes
|
||||
tool/changes_probe_entry.dart` — 20 files, 0 changed.
|
||||
- `/Users/alan/development/flutter/bin/flutter build web` — **built
|
||||
`build/web`** successfully.
|
||||
- `node --check tool/changes_probe.mjs` — passed.
|
||||
- `/Users/alan/development/flutter/bin/flutter build web --target
|
||||
tool/changes_probe_entry.dart --output build/probe-web-fix` — built.
|
||||
- `node tool/changes_probe.mjs --root build/probe-web-fix --out <public>/d1` —
|
||||
passed every check (11 checks, below).
|
||||
|
||||
`flutter pub get` resolved the existing lock; `pubspec.lock` is unchanged.
|
||||
|
||||
## Real browser evidence
|
||||
|
||||
Fixture entry `tool/changes_probe_entry.dart`, driven by `tool/changes_probe.mjs`
|
||||
(loopback, OS-assigned port, headless Chrome, Flutter semantics enabled). The
|
||||
fixture uses server-shaped captures for partial, complete, missing, unavailable
|
||||
and empty states, plus binary, truncated, mode-only, deleted, added and
|
||||
multi-hunk patches. `/?visits=1` is a compact second fixture that repeats stages
|
||||
and records one explicit `control.visit`. It is rendering data only; no server or
|
||||
operator run touched.
|
||||
|
||||
Captures (in the run's public artifacts `d1/`):
|
||||
|
||||
- `d1-changes-phone-list.png` (390×844, dark)
|
||||
- `d1-changes-phone-diff.png`
|
||||
- `d1-changes-phone-raw.png`
|
||||
- `d1-changes-phone-copied.png`
|
||||
- `d1-changes-phone-filtered.png`
|
||||
- `d1-changes-phone-visits.png` (390×844, repeated-stage visit labels)
|
||||
- `d1-changes-phone-light-list.png`, `d1-changes-phone-light-diff.png`,
|
||||
`d1-changes-phone-light-diff-2x.png`, `d1-changes-phone-light-raw.png`
|
||||
(light theme, 2x where glyphs and tints are inspected)
|
||||
- `d1-changes-desktop-diff.png` (1280×800)
|
||||
- `d1-changes-desktop-list.png`
|
||||
- `d1-changes-desktop-light-list.png`, `d1-changes-desktop-light-diff.png`
|
||||
- `d1-changes-cupertino-diff.png` (1280×800, Cupertino fixture)
|
||||
- `d1-changes-cupertino-light-list.png` (390×844, wrapped paths),
|
||||
`d1-changes-cupertino-light-diff.png`, `d1-changes-cupertino-light-diff-2x.png`
|
||||
(390×844, inset popup)
|
||||
|
||||
Observed checks from `d1-probe.json`:
|
||||
|
||||
- Root `/` served `text/html; charset=utf-8`.
|
||||
- `assets/FontManifest.json` lists a `RobotoMono` family and
|
||||
`assets/fonts/RobotoMono.ttf` is served as `font/ttf` (183,700 bytes), so the
|
||||
web build carries a real code face.
|
||||
- The body showed `Changes probe` and `Capture unavailable`, and a file row whose
|
||||
semantics label starts with
|
||||
`Open diff for lib/features/changes/domain/unified_patch.dart` (the label now
|
||||
also announces kind and meta).
|
||||
- Opening the diff changed `document.body.innerText`; `Rendered`, `Raw patch`,
|
||||
`Copy patch` and `Close diff` labels appeared.
|
||||
- `Raw patch` changed the body and produced a different PNG from the rendered
|
||||
capture; the raw semantics value contains the recorded `---`/`+++` header.
|
||||
- Clipboard readback after `Copy patch` started with
|
||||
`--- "a/lib/features/changes/domain/unified_patch.dart"` (540 bytes).
|
||||
- Filtering `unified` left both matching visit rows (`unifiedRows: 2`) and hid
|
||||
`assets/pipelines-mark.png` (`binaryRows: 0`); the counter read
|
||||
`1 of 6 changed paths match`.
|
||||
- The visits fixture rendered `implementer` with `Visit 1` and `Visit 2`, and
|
||||
`reviewer` with `Visit 1` and the recorded `control.visit` `Visit 6`; the probe
|
||||
fails if either list differs.
|
||||
- `Close diff` returned to the list; the desktop and Cupertino viewers opened.
|
||||
|
||||
Measured from `d1-changes-phone-light-diff-2x.png` (Pillow): the light add tint is
|
||||
`#E3F3E7` and the remove tint `#FBE7E5` (ΔR 24); every changed line paints a
|
||||
618 px (309 logical px) band — the full dialog content width — and the two added
|
||||
lines and one removed line are each 92/46 device px tall. Previously the tints
|
||||
were `#FFD8E4`/`#F9DEDC` (Δ 6,6,8) and only as wide as each line's text. Dark
|
||||
captures measure `#394643` (green) and `#4D3C42` (red) tints.
|
||||
|
||||
The screenshots show real Material and Cupertino controls, light and dark themes,
|
||||
phone and desktop widths, wrapped Cupertino paths and an inset Cupertino popup.
|
||||
Mobile targets were not built, installed or run.
|
||||
|
||||
## Review revision
|
||||
|
||||
- **B1 (blocking, visit labels):** `StageCapture.visit` is derived from positive
|
||||
`control.visit` else the stage position; sections render it instead of the
|
||||
run-wide `sequence`. Unit/widget tests cover repeated stages, a resumed visit
|
||||
and sequence ties; the browser visits fixture and capture above show the result.
|
||||
- **A1 (malformed capture):** a non-object `file_changes` is now unavailable with
|
||||
`malformedCaptureDetail`, never an empty “no changes” capture.
|
||||
- **A2 (rendered headers):** rendered view shows hunks only, matching the web
|
||||
rendered view; the exact headers remain in Raw and Copy.
|
||||
- **A3 (re-derivation):** `ChangesViewer` derives captures/aggregate on init and
|
||||
when the steps list changes, not on filter keystrokes; `runChangesFor` reuses
|
||||
those captures, and `FileChange.withSteps` reuses the parsed patch.
|
||||
- **A4 (test fixtures):** the run-changes test helpers now delegate to
|
||||
`test/features/changes/fixtures.dart`.
|
||||
- **A5 (row semantics):** the row label includes kind and visible meta.
|
||||
- **A6 (filter counter):** counts and names changed **paths**, matching the
|
||||
summary; the list remains per visit.
|
||||
- **A7 (paging):** unchanged; the one-file viewer API is the documented limit.
|
||||
|
||||
## Presentation revision (UI review)
|
||||
|
||||
- **M1 (monospace):** `pubspec.yaml` declares the bundled `RobotoMono` family
|
||||
(`assets/fonts/RobotoMono.ttf`, SIL OFL 1.1, licence in `assets/fonts/OFL.txt`)
|
||||
and `monospaceText` uses it on every platform. The browser build's
|
||||
`FontManifest.json` and font response are checked by the probe, and the 2x
|
||||
captures show even advances and aligned gutters.
|
||||
- **M2 (add/remove colours and tints):** the diff no longer uses Material
|
||||
`tertiaryContainer`/`errorContainer`. `diffLineColors` supplies theme-aware
|
||||
green/red pairs (light `#116B33` on `#E3F3E7`, `#B3261E` on `#FBE7E5`; dark
|
||||
`#7FE0A8`/`#FF9E9E` on a 16% wash), the `+N`/`-M` stat is split into those two
|
||||
hues, and every line tint spans the full hunk width (at least the dialog width)
|
||||
via `IntrinsicWidth` inside a width-bounded scroll view.
|
||||
- **M3 (Cupertino):** list rows clear `CupertinoListTile`'s inherited single-line
|
||||
cap so the recorded path wraps, and the Cupertino dialog is inset (16 on
|
||||
phones, 40 on wide windows) so its rounded corners are visible.
|
||||
- **Nonblocking raw wrap:** the Raw view now keeps one recorded line per line and
|
||||
scrolls horizontally (`SelectionArea` over a `Text` with `softWrap: false`),
|
||||
matching the web's `pre` pane.
|
||||
- **Left as-is (nonblocking):** list-row stat strings stay neutral (Android/web
|
||||
colour them), the unavailable diagnostic still appears in both the section meta
|
||||
and the note (web parity), and the one-file viewer has no paging.
|
||||
|
||||
## Deliberate limits
|
||||
|
||||
- One file per `FileDiffViewer`; the browser viewer's previous/next gallery
|
||||
paging is not implemented here. The task asked for a reusable one-file viewer.
|
||||
- The shell/run-detail screen is not wired; that remains the manager's
|
||||
integration step (feature lanes do not edit shell/main).
|
||||
- Run status gating (`showRunChangesSummary`, succeeded-only in the browser) is
|
||||
the caller's choice; `ChangesViewer` renders whatever steps it is given.
|
||||
- The bundled font is Latin/Greek/Cyrillic: a patch containing CJK or symbol
|
||||
glyphs outside that coverage falls back for those glyphs, so their advance may
|
||||
not be monospaced. Copy and Raw bytes are unaffected.
|
||||
- Android and iOS were not built, installed or run in this revision; the
|
||||
Cupertino path is verified only through the fixture's browser rendering and
|
||||
widget tests, so **mobile remains unverified**.
|
||||
- No backend capability is missing for this item: `file_changes` already carries
|
||||
status, scope, files, skipped, omitted, diagnostic, binary/truncated flags,
|
||||
modes and patches.
|
||||
@@ -0,0 +1,21 @@
|
||||
# F1 transport
|
||||
|
||||
`PipelinesClient` implements the shared `ApiGateway` contract using one
|
||||
`web_socket_channel` connection, correlated JSON replies, timeout handling,
|
||||
unsolicited envelope broadcast, and reconnect with capped exponential backoff.
|
||||
The URL helper validates ws/wss endpoints and resolves artifact URLs.
|
||||
|
||||
Manager integration import: `package:pipelines_app/core/transport/pipelines_client.dart`;
|
||||
endpoint helper: `package:pipelines_app/core/transport/server_url.dart`.
|
||||
|
||||
The client accepts an injected `ChannelFactory` for deterministic tests. No live
|
||||
server was used. Browser and mobile target verification should be reported
|
||||
separately from these unit tests.
|
||||
|
||||
## Manager verification
|
||||
Expanded to 12 focused tests, including serialized requests, queue recovery
|
||||
after protocol errors/timeouts, late replies, replacement of queued requests,
|
||||
send-only subscriptions, concurrent connects, reconnect and disposal. Corrected
|
||||
generation races and socket cleanup; URI construction now retains bracketed
|
||||
IPv6 hosts and encoded artifact query strings. Analyze passes after formatting.
|
||||
These are unit checks, not browser/live-server acceptance or mobile verification.
|
||||
@@ -0,0 +1,33 @@
|
||||
# F2 — Adaptive shell
|
||||
|
||||
## Manager browser acceptance
|
||||
The initial capture attempt failed because the fixture served its index with
|
||||
binary MIME. Corrected the fixture MIME and navigation assertions; the real
|
||||
Chrome run now passes actual Pipelines → Runs → Chat → Settings → Pipelines
|
||||
navigation, checking the selected destination body (not only navigation labels).
|
||||
Captured and inspected at 390×844 and 1280×800:
|
||||
`/private/var/folders/jp/q0qvjyg54fl_c5vhhk1ylz2m0000gn/T/opencode/f2-shell-{phone,phone-runs,phone-settings,desktop}.png`.
|
||||
These show the native Cupertino shell on a macOS browser with explicitly labelled
|
||||
unimplemented feature bodies. They do not prove feature parity or mobile behavior.
|
||||
Reproduce from app/ using `OPENCODE_ARTIFACT_DIR=<directory> node tool/shell_probe.mjs`
|
||||
after `flutter build web`. Earlier missing-capture statements below are historical.
|
||||
|
||||
Implemented standard adaptive navigation for Pipelines, Runs, Chat and Settings.
|
||||
Material uses a bottom `NavigationBar` below 600 logical pixels and a labeled
|
||||
`NavigationRail` at wider widths. Cupertino uses the native navigation bar and
|
||||
tab bar. `MyApp` chooses Cupertino on iOS/macOS, leaves Material system light/dark
|
||||
themes active elsewhere, and accepts injectable `WidgetBuilder` bodies through
|
||||
`AdaptiveShell`; unregistered destinations are explicitly marked Not implemented.
|
||||
|
||||
## Verification
|
||||
|
||||
- `flutter test test/widget_test.dart`: passed (narrow/wide, 2x text scale,
|
||||
Cupertino controls and injected destination body).
|
||||
- `flutter analyze`: passed, no issues.
|
||||
- Follow-up verification: widget tests now cover state retention across tab
|
||||
switches and Cupertino safe-area insets. `flutter build web` succeeds.
|
||||
- Browser interaction/capture remains unverified: the local Chrome DevTools
|
||||
probe did not complete, so no rendered evidence is claimed. Mobile targets
|
||||
are unverified.
|
||||
|
||||
No API capabilities are asserted or mocked. No dependencies were added.
|
||||
@@ -0,0 +1,22 @@
|
||||
# F3 run foundation
|
||||
|
||||
Public API: `run_models.dart` provides run identity/state/filter/sort helpers,
|
||||
status wording, `RunListResult`, decision draft/option values, and attention
|
||||
ordering/identity. `run_decisions.dart` resolves recorded human options and
|
||||
prompt evidence with graph fallback. `run_events.dart` and
|
||||
`run_step_evidence.dart` provide monotonic list/detail folds, immutable schedule
|
||||
origin, graph evidence, and `runDetailNeedsFullSync`. `data/runs_repository.dart`
|
||||
provides list/get/cancel/retry/decide/title/start calls through the shared gateway.
|
||||
|
||||
Focused tests cover stale and terminal lifecycle deltas, resource-wait clearing,
|
||||
sparse step preservation, sticky cancel/cleanup flags, schedule provenance,
|
||||
export gating, pending-decision evidence, list/detail agreement, filters/sorts,
|
||||
exact request fields and server refusals. The repository file is deliberately
|
||||
tracked despite the repository's `data/` ignore rule. This is a nonvisual
|
||||
foundation; browser UI captures were not applicable. Mobile targets are
|
||||
unverified.
|
||||
|
||||
This is not total web parity: date filtering uses Dart local-time conversion
|
||||
rather than web's explicit IANA-zone/locale helpers; the complete attention
|
||||
dismissal/persistence surface, retry key generation, and repository methods for
|
||||
export repair/request-key reconciliation are not included in this foundation.
|
||||
@@ -0,0 +1,17 @@
|
||||
# F4 chat foundation
|
||||
|
||||
Non-visual chat foundations for the UI lane, using the shared `ApiGateway` and no socket ownership.
|
||||
|
||||
## Imports and API
|
||||
|
||||
- `package:pipelines_app/features/chat/domain/chat_sessions.dart`: `chatSessionTitle`, `filterChatSessions`, `groupChatSessions`, `chatSessionActivity`, and `chatUsageSnapshot`.
|
||||
- `package:pipelines_app/features/chat/domain/chat_transcript.dart`: `mergeChatHistory`, `transcriptRows`, `reconcileChatUser`, `applyChatEvent`, `QueuedChatSend`, and `ChatSendQueue`.
|
||||
- `package:pipelines_app/features/chat/data/chat_repository.dart`: `ChatRepository(gateway)`; exposes sessions, directories, history, subscribe, create/rename/star/close/reopen, prompt/interrupt, form answer, permission reply, models/shells and model selection. `gateway.frames` remains the UI/controller's unsolicited event source.
|
||||
|
||||
History uses `chat_history.next_cursor` verbatim, falls back to legacy `chat_messages`, and replaces duplicate authoritative messages while preserving order. `transcriptRows` preserves unknown part maps. Live fold supports user echoes, text/reasoning deltas, tool state snapshots, and step activity; UI should retain its richer thread/timing state as needed. Queue operation IDs are stable across retry objects and deduplicated within each session. Usage values remain unavailable unless reported and valid.
|
||||
|
||||
Wire envelopes are asserted in `test/features/chat/chat_foundation_test.dart`. Current backend has no `chat_forms` or `chat_permissions` list command; forms and permissions arrive as live events and are answered through `chat_answer` / `chat_reply`.
|
||||
|
||||
## Verification
|
||||
|
||||
`/Users/alan/development/flutter/bin/flutter test test/features/chat` passed. Nonvisual foundation: UI/browser review and captures are not applicable at this stage. Web is the only permitted target; Android/iOS remain unverified.
|
||||
@@ -0,0 +1,26 @@
|
||||
# F5 preview server candidate review
|
||||
|
||||
Manager reran all 6 fixture tests and added an idle-websocket regression past the
|
||||
five-second establishment deadline. Healthy idle sockets now keep their session;
|
||||
auth-check listeners are removed when finished. Default preview port is 8096,
|
||||
separate from the raw API at 8080. HTTPS certificate paths remain untested.
|
||||
|
||||
Candidate `e3a82b0`'s static preview route was retained, with stricter decoded
|
||||
path validation and canonical-path checks for files and SPA fallback. The proxy
|
||||
now uses `http.request` / `https.request` streams so Range, HEAD, content-encoding,
|
||||
and exact response bytes are preserved. Authentication checks fail closed after
|
||||
five seconds and discard their response bodies. Unauthenticated document GETs
|
||||
are redirected to the authenticated proxy's `/login?next=...`; assets remain
|
||||
401. Login, logout, and artifact proxying still use the browser's upstream cookie.
|
||||
|
||||
WebSocket upgrades validate `/connect` and a same-origin browser Origin before
|
||||
authentication or upstream connection. After authentication, both Host and
|
||||
Origin map to the configured HTTP(S) upstream origin; cookies and upgrade headers
|
||||
are retained. Upgraded sockets are tracked and destroyed during `close()`. HTTPS
|
||||
uses Node TLS verification (no certificate bypass). Bind to loopback by default.
|
||||
|
||||
Verification: `node --test test/tool/preview.test.mjs`, `node --check` on server
|
||||
and test, and `git diff --check`. Tests use only local fixtures and cover login
|
||||
redirect, denied auth, exact compressed Range/HEAD bytes, origin rejection,
|
||||
authenticated bidirectional WebSocket bytes, timeout, shutdown, and traversal / symlink
|
||||
protection. No browser run, Flutter build, production access, or deployment was done.
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
# I1 — live Runs destination, routes and resilient connection
|
||||
|
||||
## Change
|
||||
|
||||
- `lib/application/` composes the real app separately from `main.dart`:
|
||||
`bootstrap.dart` resolves the endpoint and starts the composition,
|
||||
`pipelines_app.dart` owns one `AppSession` and one `Router`,
|
||||
`runs_destination.dart` frames the Runs destination, and `app.dart` keeps the
|
||||
injectable `MyApp` shell for existing widget tests. `main.dart` exports `MyApp`
|
||||
and calls `runPipelinesApp()`.
|
||||
- Web endpoint: the page origin from `Uri.base` over `ws(s)` at `/connect`, so
|
||||
the same server that served the bundle is the live server. Native builds use
|
||||
only the explicit `--dart-define=PIPELINES_SERVER_URL=ws://host:port/connect`
|
||||
value; there is no baked host or fallback endpoint.
|
||||
- **Routes/deep links (I1's second half):** the app now uses Flutter's `Router`
|
||||
with a total `AppRoute` parser (`/pipelines`, `/runs`, `/runs/:id`, `/chat`,
|
||||
`/settings`) and the path URL strategy (`flutter_web_plugins` declared as a
|
||||
direct dependency). `/runs/1` opens that run directly, tab and run selection
|
||||
push browser history, Back/Forward move between them, and a malformed or
|
||||
unknown path renders Pipelines and is corrected to `/pipelines`. Non-web
|
||||
platforms keep the same routes through the Router without an address bar.
|
||||
A single-page `Navigator` inside the Router delegate supplies the Overlay
|
||||
native controls need while keeping the shell state across route changes.
|
||||
- **Reconnects keep the destination:** before the first successful connection
|
||||
the destination is a full connection screen. After that the loaded Runs screen
|
||||
stays mounted through drops: a compact status banner reports `Reconnecting to
|
||||
Pipelines…` or `Not live — Pipelines server unavailable.` with a Retry action,
|
||||
and `connectionEpoch` triggers an in-place list/detail refresh. The open run,
|
||||
its scroll position and Back all survive the reconnect; the screen is not
|
||||
remounted and the selection is not reset.
|
||||
- **Honest connection copy:** the full gate no longer prints a raw transport
|
||||
exception. A failed first attempt stays `Pipelines server unavailable` with
|
||||
`Retrying automatically…` while the client retries instead of flickering to
|
||||
`Connecting…` on every attempt. Only the first attempt shows `Connecting to
|
||||
Pipelines…`.
|
||||
- **Live-watch status:** `AppSession` now observes the send-only `subscribe`
|
||||
ack/error. A server refusal is reported as `Not live — run updates are
|
||||
unavailable.` with the server's own refusal reason and a Retry that repeats the
|
||||
watch; silence (servers that never ack, like the fixture) is left pending
|
||||
rather than guessed as "not live".
|
||||
- `AppSession` owns the single shared `PipelinesClient` and its state stream. It
|
||||
sends `subscribe` with `{workspace: ''}` on every connected transition and
|
||||
`unsubscribe` on stop/dispose.
|
||||
- `RunsScreen` consumes `controller.selectedRunId` as the only selection source;
|
||||
a route change, an initial run, a pending/failed detail and Back all navigate
|
||||
the same path. Removed the nested `CupertinoPageScaffold`/`CupertinoNavigationBar`;
|
||||
the shell owns the single native bar.
|
||||
- `RunDetailView` keeps Back available while the detail is pending as well as on
|
||||
failure. The detail's back row and the pending/error action now read
|
||||
`Back to list` (Cupertino's compact row reads `Back`), matching web's
|
||||
accessible name instead of the ambiguous `Runs`.
|
||||
- Cupertino-host detection is centralized in `lib/ui/adaptive/host.dart` and used
|
||||
by the destination, detail and runs list instead of three different checks.
|
||||
- Inherited web build defect: `run_models.dart` used `0x7fffffffffffffff`
|
||||
sentinels, which dart2js cannot represent. Replaced them with the `DateTime`
|
||||
maximum millisecond value (`8640000000000000`), also an exact JavaScript
|
||||
number; sort behavior is unchanged.
|
||||
|
||||
## Checks
|
||||
|
||||
- `flutter test`: **86 passed** (12 new since the previous visit; the prior suite
|
||||
plus route, reconnect-retention, subscribe-status and composition coverage).
|
||||
- `flutter analyze`: **no issues**.
|
||||
- `flutter build web` (normal `lib/main.dart`): **succeeded**.
|
||||
- `dart format --output=none --set-exit-if-changed lib test tool`: clean.
|
||||
- `git diff --check`: clean.
|
||||
|
||||
## Browser acceptance
|
||||
|
||||
`tool/runs_probe.mjs` ran real headless Chrome against the isolated loopback
|
||||
fixture (`tool/runs_probe_server.mjs`) with a same-origin `/connect` WebSocket.
|
||||
HTML MIME is checked before launch; body assertions use Flutter semantics and
|
||||
Tesseract OCR of canvas-rendered text. The probe now also drives:
|
||||
|
||||
- `Runs` tab → URL `/runs`; run row → `/runs/1`; browser Back → list at
|
||||
`/runs`; browser Forward → detail at `/runs/1`.
|
||||
- a direct `/runs/1` load opens the detail and leaves the address bar there.
|
||||
- `/fixture/refuse` drops the socket and rejects upgrades: the open detail stays
|
||||
visible, the banner reads `Reconnecting to Pipelines…`, no raw
|
||||
`WebSocketException`/`Failed to connect` text is rendered, and the URL stays
|
||||
`/runs/1`.
|
||||
- accepting again plus Retry restores the same detail without a remount
|
||||
(`subscribed`, `listRuns` and `getRun` all increase on the fixture).
|
||||
- a fresh load while upgrades are refused shows the friendly
|
||||
`Pipelines server unavailable` gate with no raw exception and does not flicker
|
||||
back to `Connecting…`; Retry recovers the list.
|
||||
|
||||
Probe result: `ok: true`, `subscribed: 4`, `listRuns: 5`, `getRun: 7`,
|
||||
`dropped: 2`, `live: true`. Captures are in
|
||||
`/Users/alan/.local/share/pipelines/data/artifacts/50/public/i1-fixes/`
|
||||
(18 PNGs), including:
|
||||
|
||||
- `i1-runs-phone-browser-back-list.png`
|
||||
- `i1-runs-phone-browser-forward-detail.png`
|
||||
- `i1-deeplink-run-1-phone.png`
|
||||
- `i1-reconnect-detail-retained-phone.png`
|
||||
- `i1-reconnect-detail-restored-phone.png`
|
||||
- `i1-gate-unavailable-friendly-phone.png`
|
||||
- `i1-gate-recovered-list-phone.png`
|
||||
- `i1-material-deeplink-run-1-phone.png` — a Linux user-agent override selects
|
||||
the Material host; the same deep link renders Material controls with the
|
||||
`Back to list` action.
|
||||
|
||||
The existing list/detail/pending/error/input/output/metrics captures were also
|
||||
regenerated. No page exceptions were logged in the final probe run.
|
||||
|
||||
## Limits
|
||||
|
||||
- Read-only live authenticated smoke through the manager preview was not
|
||||
performed: `http://127.0.0.1:8096/` requires auth. No credentials were
|
||||
available without reading secrets. The preview was not restarted or replaced.
|
||||
- Mobile builds/devices were not run; mobile is unverified. The shared Router
|
||||
and single-page Navigator are used on all targets but only web was exercised.
|
||||
- The fixture does not ack `subscribe` (by design), so the "live" ack path is
|
||||
covered by widget tests; the refusal banner is covered by tests and the gate
|
||||
by browser evidence.
|
||||
- No real run was modified. No commit, push or deployment was made.
|
||||
- Adding `flutter_web_plugins` to `pubspec.yaml` is the one dependency change;
|
||||
it is required for path-style routes on web.
|
||||
@@ -0,0 +1,27 @@
|
||||
# Settings registered in the normal app
|
||||
|
||||
- `/settings` mounts the landed SettingsScreen with the app-owned client, not a
|
||||
second socket. Embedded mode leaves the single native bar to the shell.
|
||||
- Destinations are initialized on first visit and kept mounted thereafter; an
|
||||
unvisited Settings screen issues no hidden ping or preference read.
|
||||
- Session Retry uses the transport's current validated endpoint, including one
|
||||
selected in Settings, rather than reverting to the bootstrap server. A native
|
||||
missing-endpoint gate can be cleared by a successful Settings configuration.
|
||||
- Real CupertinoApp dark-host capture exposed Material fallback text colours.
|
||||
Settings now resolves typography/semantic colours from its actual native host.
|
||||
The new dark-label regression failed before this correction and passes after.
|
||||
No fixed font, palette or component dimensions were added.
|
||||
|
||||
## Verification
|
||||
|
||||
- 516 integrated Flutter tests pass; analyzer clean; normal-entry web build pass.
|
||||
- Widget coverage mounts real Material and dark Cupertino app composition,
|
||||
asserts one bar, no background Settings ping before visiting, shared socket,
|
||||
and resolved server build after ping. Endpoint-change Retry has a regression.
|
||||
- Extended normal-entry Runs CDP fixture answers real ping and drives Settings
|
||||
in both hosts. Probe passes all existing history/drop/reconnect checks plus
|
||||
Settings navigation and single-socket checks:20 captures. Both registered
|
||||
phone screenshots inspected; dark Cupertino labels are readable after fix.
|
||||
- Evidence in approved temp/settings-wired-browser and corresponding logs.
|
||||
- Authenticated production-data interaction and Android/iOS remain unverified.
|
||||
No real server endpoint/workspace preferences were changed by the fixtures.
|
||||
+130
@@ -0,0 +1,130 @@
|
||||
# N1 Settings
|
||||
|
||||
The Settings destination for the Flutter client: server connection and the
|
||||
server-side workspace, in native Material controls and Cupertino controls on iOS.
|
||||
|
||||
## Files
|
||||
|
||||
- `lib/features/settings/settings_screen.dart` — `SettingsScreen`.
|
||||
- `lib/features/settings/settings_controller.dart` — draft/validation, shared
|
||||
client actions, ping-on-connected, workspace persistence, dispose ownership.
|
||||
- `lib/features/settings/settings_store.dart` — `SettingsStore`,
|
||||
`SharedPreferencesSettingsStore`, `MemorySettingsStore`.
|
||||
- `lib/features/settings/settings_copy.dart` — the web/Android words, workspace
|
||||
validation, connection-card lines.
|
||||
- `lib/features/settings/default_endpoint.dart` — same-origin web default.
|
||||
- `lib/features/settings/settings_controls.dart`, `settings_sections.dart`,
|
||||
`settings_trust_warning.dart`, `settings_layout.dart`, `settings_keys.dart`.
|
||||
- `lib/features/settings/settings.dart` — public barrel for manager registration.
|
||||
- `test/features/settings/*` — copy, persistence, controller and widget tests.
|
||||
- `tool/settings_probe.dart`, `tool/settings_probe_server.dart`,
|
||||
`tool/settings_probe_capture.dart` — isolated browser fixture/capture entry.
|
||||
|
||||
## Manager registration
|
||||
|
||||
```dart
|
||||
import 'package:pipelines_app/features/settings/settings.dart';
|
||||
|
||||
SettingsScreen(client: sharedPipelinesClient)
|
||||
// optional: initialEndpoint: Uri?, store: SettingsStore?, ping: PingCallback?
|
||||
```
|
||||
|
||||
`SettingsScreen` takes the shell's single `PipelinesClient`. It subscribes to
|
||||
`client.states`, sends `ping` once per connected transition (plus once when the
|
||||
screen opens against an already-connected client), and offers Connect /
|
||||
Disconnect / Reconnect. It never calls `client.dispose()` and never opens a
|
||||
connection on construction, so registering/rebuilding the screen cannot start a
|
||||
second socket or tear down another feature's connection.
|
||||
|
||||
While connected it shows `Server build {version} ({commit})` and
|
||||
`Server time {time}` from the ping reply. Until that reply arrives the card says
|
||||
`Loading server details…`, so a request in flight is never reported as an
|
||||
unavailable value. Only a completed reply that omits a field renders `Server
|
||||
build unavailable` / `Server time unavailable`; a failed ping renders one
|
||||
explicit `Server details unavailable: …` line instead of repeating both
|
||||
"unavailable" lines. No zero or stale value is substituted. Disconnect and
|
||||
reconnect clear the previous server's details.
|
||||
|
||||
Connection card copy and state lines follow `web/src/settings.js` and
|
||||
`SettingsScreen.kt`: `Not connected`, `Connecting (attempt N)…`, `Connected`,
|
||||
`Disconnected` + reason + `Retrying with backoff…`, plus the trusted-LAN/VPN
|
||||
warning. A dropped socket's attempt/backoff state comes from the transport.
|
||||
|
||||
Workspace validation is the web rule: blank is untouched (no error), a relative
|
||||
path is rejected, Save is enabled only for a trimmed absolute path. The saved
|
||||
line is `Saved workspace: /path` or `Saved workspace: (none)`, and the helper
|
||||
states that the path is an absolute directory on the execution server, not the
|
||||
phone's storage. Save failures keep the previous saved value and say so.
|
||||
|
||||
## Persistence
|
||||
|
||||
`shared_preferences` keys are owned by this feature:
|
||||
|
||||
- `pipelines.next.serverUrl.v1`
|
||||
- `pipelines.next.workspace.v1`
|
||||
|
||||
No legacy Android/web key (`server_url`, `workspace`,
|
||||
`pipelines.web.serverUrl.v2`, `pipelines.web.workspace.v1`, notification keys)
|
||||
is read, migrated or written. The endpoint is validated and persisted before
|
||||
`client.connect` is attempted, matching the web's write-before-connect
|
||||
behaviour; a value that fails to connect stays stored. When the store write
|
||||
itself fails, the screen still connects and says the value applies to this
|
||||
session only. Credentials in a URL are rejected before any write or socket.
|
||||
Only those two strings are stored; nothing else.
|
||||
|
||||
The web `shared_preferences` implementation may namespace its keys internally;
|
||||
the logical keys above are the independent feature keys and tests assert the
|
||||
legacy keys stay untouched.
|
||||
|
||||
## Web default endpoint
|
||||
|
||||
`defaultServerUrl()` returns `''` on native builds. On web it derives
|
||||
`ws(s)://<page host[:port]>/connect` from `Uri.base` (`kIsWeb`, no `dart:html`),
|
||||
so the screen starts from the configurable same-origin proxy and no server host
|
||||
or production endpoint is baked into the app. The field remains editable and
|
||||
only the validated value is persisted.
|
||||
|
||||
## Verification
|
||||
|
||||
- `flutter test test/features/settings` — 39 tests pass (copy/default endpoint,
|
||||
persistence keys/legacy isolation, controller connect/validation/ping/
|
||||
disconnect/reconnect/backoff/dispose ownership/workspace errors, Material and
|
||||
Cupertino widgets, invalid URL, pending vs completed-empty ping, failed-ping
|
||||
single line, field labels in semantics, narrow + 2× text with full labels and
|
||||
helper copy, unmount ownership).
|
||||
- `flutter test` (full app) — 52 tests pass.
|
||||
- `flutter analyze` — no issues; `dart format --set-exit-if-changed` clean on the
|
||||
19 Dart settings/test/tool files.
|
||||
- `flutter build web` (main) and `flutter build web -t tool/settings_probe.dart`
|
||||
— both built.
|
||||
- Real browser evidence from an isolated loopback probe server (`/connect`
|
||||
answers `ping` with `probe-1.2.3`/`abc1234`/time), headless Chrome over CDP:
|
||||
`settings-idle`, `settings-connected`, `settings-validation` (clicked Connect
|
||||
after an `http://` draft), `settings-workspace` (typed `/srv/pipelines`,
|
||||
clicked Save), `settings-dark`, `settings-ios`, `settings-narrow` (390×844,
|
||||
1.6× text). See `public/settings-captures/manifest.md`.
|
||||
- Fix verification with a 6 s delayed pong: at 1.5 s the card shows
|
||||
`Connected` + `Loading server details…` (no "unavailable"), and after the pong
|
||||
it shows the real build/time. At 320×700/2× and 390×844/2× the full
|
||||
`Server URL`/`Workspace path (on the server)` labels and the complete helper
|
||||
and error sentences render (no ellipsis or line cap). See
|
||||
`public/settings-fix-captures/manifest.md`.
|
||||
- The 20 candidate paths are new and currently **untracked** (`??`, none
|
||||
ignored); landing must `git add` them. The candidate is left uncommitted per
|
||||
the stage instruction.
|
||||
|
||||
## Gaps / not done
|
||||
|
||||
- Notifications are not part of this screen yet. The queue item names them, but
|
||||
the task scope here was connection/workspace and the project has no
|
||||
notification plugin; adding one needs a dependency decision.
|
||||
- No Templates card: navigation into the templates feature is shell/feature
|
||||
registration work owned elsewhere.
|
||||
- No protocol-mismatch warning (the web page shows one); it needs a shared
|
||||
protocol-version constant not present in the app yet.
|
||||
- Mobile builds/devices and the real production server were not used. The
|
||||
Cupertino rendering is shown through the web probe with an iOS platform theme,
|
||||
not on an actual iOS device.
|
||||
- The probe's `connected` capture is an automatic fixture connect; validation
|
||||
and workspace-save captures use actual browser clicks/typing. The main web
|
||||
entry (`lib/main.dart`) is still the scaffold and was not modified.
|
||||
@@ -0,0 +1,119 @@
|
||||
# P2-edge — passive edge layer over landed routing
|
||||
|
||||
## What changed
|
||||
|
||||
App-only, new files. No existing routing, layout, domain, shell, `main.dart`,
|
||||
pubspec, server, web client or platform source was edited. The Land stage
|
||||
committed the candidate on `flutter/p2-edge-layer` and merged `main`.
|
||||
|
||||
| File | Lines | Responsibility |
|
||||
| --- | --- | --- |
|
||||
| `lib/features/graph/painting/graph_edge_layer.dart` | 160 | `GraphEdgeLayer` widget + `GraphEdgePainter` path/arrow painting |
|
||||
| `test/features/graph/painting/edge_layer_fixtures.dart` | 41 | hand-built routes and arrival helper for the tests |
|
||||
| `test/features/graph/painting/graph_edge_geometry_test.dart` | 240 | path and arrow geometry, routed forward/self-loop/cycle edges, a hand-built backward route and an off-port tip case |
|
||||
| `test/features/graph/painting/graph_edge_layer_test.dart` | 190 | draw calls, clip, hit-test transparency, style colors, repaint rules, widget size |
|
||||
| `tool/graph_edge_probe.dart` | 182 | isolated browser-capture entry (not wired into the app) |
|
||||
|
||||
## Public API
|
||||
|
||||
```dart
|
||||
GraphEdgeLayer(
|
||||
routes: List<EdgeRoute>, // from routing/route_models.dart
|
||||
canvasSize: Size, // graph-space canvas supplied by the caller
|
||||
color: Color, // caller's native outline color
|
||||
strokeWidth: double, // caller's native stroke width
|
||||
)
|
||||
```
|
||||
|
||||
`GraphEdgePainter` is public so a compositor and its tests share the exact
|
||||
geometry through `linePath(route)` and `arrowPath(route)`.
|
||||
|
||||
## Behavior
|
||||
|
||||
- **Passive and hit-test transparent:** a single `CustomPaint`; no child,
|
||||
gesture, focus, semantics or label text. `GraphEdgePainter.hitTest` returns
|
||||
`false` for every point, so the layer never becomes a full-canvas hit sink and
|
||||
siblings below it keep their taps, including with `routes: const []` and on a
|
||||
painted stroke. Default `CustomPainter.hitTest` returns `null`, which
|
||||
`RenderCustomPaint.hitTestSelf` treats as a hit; the explicit `false` is the
|
||||
fix and the regression covers it. Node boxes and measured extents are
|
||||
caller-owned and are never read or changed here.
|
||||
- **Same coordinates:** every `RoutePoint` is used verbatim. A route with fewer
|
||||
than two points draws nothing. Painting clips to the `CustomPaint` size.
|
||||
- **Orthogonal paths:** consecutive points are joined with straight segments,
|
||||
so the landed orthogonal routes keep every bend; no smoothing or re-routing.
|
||||
- **Direction arrows:** one filled triangle per route, tip exactly at
|
||||
`targetPort.point`. The router guarantees `points.last == targetPort.point`;
|
||||
`paint` asserts that invariant, while `arrowPath` reads the tip from the port
|
||||
so a caller-supplied mismatch cannot move the arrow off the port. Direction is
|
||||
the route's last non-degenerate segment, so forward, backward, same-rank and
|
||||
self-loop edges keep their real arrival direction; a degenerate tail falls
|
||||
back to the target port's inward normal.
|
||||
- **Theme-owned style:** the caller supplies color and stroke width; the arrow
|
||||
length is 6x and its half base 2x that stroke width, so it scales with the
|
||||
caller's native thickness. No absolute palette, font or dimension is
|
||||
hard-coded.
|
||||
- **Repaint:** `shouldRepaint` compares color, stroke width and routes by value
|
||||
(`listEquals` over `EdgeRoute ==`), so equal rebuilt lists do not repaint while
|
||||
a moved route, color or stroke change does.
|
||||
|
||||
## Checks actually run
|
||||
|
||||
```
|
||||
dart format lib/features/graph/painting test/features/graph/painting tool/graph_edge_probe.dart
|
||||
flutter test test/features/graph/painting # 18 passed
|
||||
flutter test test/features/graph/painting test/features/graph/routing # 38 passed
|
||||
flutter test # 466 passed
|
||||
flutter analyze # No issues found!
|
||||
flutter build web -t tool/graph_edge_probe.dart -o build/graph_edge_probe
|
||||
flutter build web # ✓ Built build/web
|
||||
```
|
||||
|
||||
The hit-test regression was confirmed to fail (`taps` stayed `0`) when
|
||||
`hitTest` returned `true`, and pass with the shipped `false`.
|
||||
|
||||
`public/P2-edge.patch` is the reviewed new-file diff. `public/P2-edge-land.patch`
|
||||
is the landed `git diff main..HEAD`, which also carries the landing caption
|
||||
correction and the 160-line trim; it reverse-applies cleanly to the merged tree.
|
||||
|
||||
## Rendered evidence
|
||||
|
||||
Three real Chrome captures of the isolated probe build, served from a temporary
|
||||
loopback server on an OS-assigned port with a throwaway profile. No Pipelines
|
||||
server, authentication, production data, device or preview service was touched.
|
||||
|
||||
| File | Bytes | Shows |
|
||||
| --- | --- | --- |
|
||||
| `public/graph-edge-layer-web.png` | 90,739 | light theme: three measured cards, Success/Failure terminals, same-rank cycle edges, forward terminal edges and a self-loop |
|
||||
| `public/graph-edge-layer-web-dark.png` | 85,431 | the same graph in the native dark theme |
|
||||
| `public/graph-edge-layer-web-same-rank.png` | 69,601 | `?case=same-rank`: a two-node cycle, both edges same-rank between distinct nodes |
|
||||
|
||||
All are 2700x2700 (900x900 CSS at 3x). Arrow tips land on target ports; the
|
||||
layer uses `colorScheme.outline` and `dividerTheme.thickness`.
|
||||
|
||||
The caption wording was corrected at landing to name the actual routes
|
||||
(same-rank cycle edges, forward terminal edges and a self-loop). Fresh captures
|
||||
of the rebuilt probe are `public/land-edge-light.png`,
|
||||
`public/land-edge-dark.png` and `public/land-edge-same-rank.png`. The earlier
|
||||
`public/graph-edge-layer-*.png` and `public/ui-review-edge-*.png` captures
|
||||
predate that text-only correction; their geometry is unchanged and remains valid
|
||||
evidence for the rendered layout.
|
||||
|
||||
## Honest limits
|
||||
|
||||
- **No labels or nodes.** Edge labels are deliberately excluded for later
|
||||
native widget composition (the router already returns measured
|
||||
`EdgeLabelBox`es); this slice paints no text. The probe's cards are fixture-only,
|
||||
not a node widget and not shell registration.
|
||||
- **One style per layer.** `color`/`strokeWidth` are single values; the web run
|
||||
graph's per-outcome colors and dashed/dotted not-executed/fallback styles are
|
||||
not expressible yet. A run-graph compositor will need a per-route style input
|
||||
or several layers.
|
||||
- **No interaction.** Selection, focus, hover and semantics belong to callers.
|
||||
If per-wire hover is added later it needs stroke-only hit testing, not a
|
||||
canvas-wide sink.
|
||||
- **Browser capture only on web.** The probe ran in Chrome; mobile was not
|
||||
built, installed or verified.
|
||||
- **Committed, not delivered.** The candidate is committed locally on
|
||||
`flutter/p2-edge-layer` with `main` merged. Nothing was pushed, deployed or
|
||||
installed.
|
||||
@@ -0,0 +1,188 @@
|
||||
# P2-node — native content-sized stage-node control
|
||||
|
||||
## This visit: both UI-review must-fixes
|
||||
|
||||
| Finding | Change |
|
||||
| --- | --- |
|
||||
| Material stadium outline cut into a wrapped 2x label | Material no longer uses a stock **button**. It is a stock **card** body: `Card.outlined` when unselected, `Card.filled` when selected, wrapped in an `InkWell` with a 16 px content inset and the framework's `kMinInteractiveDimension` tap target. A card's painted shape is a rounded rectangle, so a long wrapped label stays inside the visible boundary at 1x and 2x. |
|
||||
| Cupertino unselected stages and terminals were bare tinted text | Unselected Cupertino nodes are `CupertinoButton.tinted`, so every node has a visible native surface; selected stays `CupertinoButton.filled`. |
|
||||
|
||||
Both fixes use stock widgets and stock variants only: no shape override, no
|
||||
font, size, padding on a button, palette value or CSS token was added.
|
||||
|
||||
| File | Lines | Responsibility |
|
||||
| --- | ---: | --- |
|
||||
| `lib/features/graph/widgets/graph_stage_node.dart` | 126 | one content-sized node as a native Material card or Cupertino button |
|
||||
| `test/features/graph/widgets/graph_stage_node_test.dart` | 235 | key identity, semantics, keyboard, focus retention, wrap and terminal honesty |
|
||||
| `test/features/graph/widgets/graph_stage_node_render_test.dart` | 210 | painted-boundary and painted-surface checks on real render objects/pixels |
|
||||
| `tool/graph_node_probe.dart` | 90 | isolated browser fixture with stock light/dark themes, 1x and 2x narrow cases |
|
||||
| `tool/graph_node_probe.mjs` | 151 | headless-Chrome runner: labels, click identity, `aria-current`, captures |
|
||||
| `notes/P2-node.md` | this page | facts for review/landing |
|
||||
|
||||
No existing app source, domain, layout, routing, shell, `main.dart`, pubspec,
|
||||
server, web client or platform file was modified.
|
||||
|
||||
## Public API
|
||||
|
||||
```dart
|
||||
GraphStageNode({
|
||||
required GraphNode node,
|
||||
String? recordedStatus,
|
||||
bool selected = false,
|
||||
required ValueChanged<String> onSelected,
|
||||
})
|
||||
```
|
||||
|
||||
Unchanged from the reviewed candidate. `onSelected` reports `node.key` verbatim,
|
||||
including `#success` / `#failure`; the display label is never used as identity.
|
||||
|
||||
## Native mapping
|
||||
|
||||
| State | Material | Cupertino |
|
||||
| --- | --- | --- |
|
||||
| unselected | `Card.outlined` + `InkWell` | `CupertinoButton.tinted` |
|
||||
| selected | `Card.filled` + `InkWell` | `CupertinoButton.filled` |
|
||||
|
||||
- The host is chosen with the existing `usesCupertinoHost` helper.
|
||||
- Material content sits in a `Padding` of 16 logical px inside the card, so
|
||||
wrapped glyphs stay clear of the rounded corners; the control is still
|
||||
content-sized (no fixed width or height) and grows with its label.
|
||||
- `MergeSemantics` + `Semantics(button: true, selected: …, label: …)` keep one
|
||||
accessibility node per stage: button role, tap action, exact label/status and
|
||||
selected state. The painted content stays `ExcludeSemantics`.
|
||||
- Selection keeps the same widget type on both hosts (`Card` / `CupertinoButton`),
|
||||
so keyboard focus survives activation; the previous Material
|
||||
`OutlinedButton` → `FilledButton` swap replaced the focus node (review note 1).
|
||||
- **Break-anywhere parity.** The web node uses `overflow-wrap: anywhere`; the
|
||||
painted lines get invisible U+200B break opportunities. The accessible label
|
||||
stays exact, with no invisible characters.
|
||||
- **Recorded status only.** `recordedStatus` is shown verbatim on a second line
|
||||
when non-blank; blank or whitespace-only status adds no line. Nothing is
|
||||
derived from `terminal`, `stageIndex` or the label, so a terminal reads only
|
||||
`Success` / `Failure` unless the caller supplies real run evidence.
|
||||
|
||||
## Rendered checks (new)
|
||||
|
||||
`graph_stage_node_render_test.dart` closes the gap the previous 2x test had
|
||||
(line metrics versus paragraph width, not glyphs versus the painted boundary):
|
||||
|
||||
- **Painted-boundary containment.** Reads the actual `Material.shape` and render
|
||||
rect of the Material control, builds its outer `Path`, converts every laid-out
|
||||
line box of the label to card-local coordinates with
|
||||
`RenderParagraph.localToGlobal`, and requires all four corners of every line
|
||||
box to be inside the painted path — at 1x and 2x in a 150 logical px box.
|
||||
A rounded rectangle is convex, so corner containment means the whole line box
|
||||
is inside; no padding/shape override can hide a crossing.
|
||||
- **The check has teeth.** Running the same test against the identical widget
|
||||
while a `StadiumBorder` is temporarily set on the card fails with
|
||||
`at 1.0x a glyph box corner at Offset(16.1, 19.0) escapes the painted control
|
||||
boundary`. The shape assertion (`material node paints a rounded surface, not a
|
||||
stadium`) fails too. The override was reverted before this page was written.
|
||||
- **Cupertino container.** Renders the unselected node over an opaque page,
|
||||
reads pixels back from a real `RepaintBoundary.toImage`, and requires the point
|
||||
just inside the control's left edge to differ from the page background by more
|
||||
than 24/255. Reverting to plain `CupertinoButton` fails this test.
|
||||
- **Visible selection.** The same pixel path requires the painted surface to
|
||||
change between unselected and selected in both hosts.
|
||||
- **Focus retention.** Tab + Enter on the Material node, then the primary focus
|
||||
must still be a descendant of the node's `Card`.
|
||||
|
||||
## Checks actually run (landing, after merging main)
|
||||
|
||||
```
|
||||
dart format --output=none --set-exit-if-changed lib/features/graph/widgets \
|
||||
test/features/graph/widgets tool/graph_node_probe.dart # 0 changed, exit 0
|
||||
flutter pub get # dependencies resolved
|
||||
flutter test test/features/graph/widgets # 13 passed
|
||||
flutter test test/features/graph # 113 passed
|
||||
flutter test # 526 passed
|
||||
flutter analyze # No issues found!
|
||||
flutter build web -t tool/graph_node_probe.dart --release # ✓ Built build/web
|
||||
PROBE_VARIANT=material PROBE_SCHEME=dark node tool/graph_node_probe.mjs # passed, 6 captures
|
||||
PROBE_VARIANT=material PROBE_SCHEME=light node tool/graph_node_probe.mjs # passed, 6 captures
|
||||
PROBE_VARIANT=cupertino PROBE_SCHEME=dark node tool/graph_node_probe.mjs # passed, 6 captures
|
||||
PROBE_VARIANT=cupertino PROBE_SCHEME=light node tool/graph_node_probe.mjs # passed, 6 captures
|
||||
flutter build web --release # ✓ app bundle restored
|
||||
```
|
||||
|
||||
The whole-suite count is 526 after `main` brought in the changes viewer and
|
||||
routed-edge tests; the earlier figure of 460 was measured before that merge.
|
||||
|
||||
The runner asserts the initial labels (`Selected: build`, `plan`, `build`,
|
||||
`running`, `Success`, `Failure`), that exactly the `build` node carries
|
||||
`aria-current="true"` (Flutter web maps `Semantics(selected:)` to `aria-current`,
|
||||
not `aria-selected` — review note 5), that clicking `plan` and `Success` yields
|
||||
exactly `Selected: plan` and `Selected: #success`, and that the selected
|
||||
`aria-current` moves to `plan`.
|
||||
|
||||
## Browser evidence (landing, current)
|
||||
|
||||
Real headless Chrome, loopback fixture only, 390×844 phone and 1280×800 desktop.
|
||||
The Material fixture now supplies a stock dark theme (`darkTheme` +
|
||||
`themeMode.system`), so `PROBE_SCHEME=dark` and `=light` are genuinely different
|
||||
renders (phone PNG SHA-256 `ac6272fd…` versus `c603c119…`); Cupertino follows the
|
||||
platform scheme (`3e39555f…` versus `1f40f8b5…`). The runner writes
|
||||
`material-nodes-*.png`, `light-material-nodes-*.png`, `cupertino-nodes-*.png` and
|
||||
`light-cupertino-nodes-*.png`, plus `-long-1x-crop.png` / `-long-2x-crop.png`;
|
||||
the shared copies below use a `land-p2-node-` prefix.
|
||||
|
||||
- `/Users/alan/.local/share/pipelines/data/artifacts/64/public/land-p2-node-material-dark-phone.png`
|
||||
- `.../land-p2-node-material-light-phone.png`
|
||||
- `.../land-p2-node-material-dark-long-2x-crop.png`
|
||||
- `.../land-p2-node-cupertino-dark-phone.png`
|
||||
- `.../land-p2-node-cupertino-light-phone.png`
|
||||
- `.../land-p2-node-cupertino-dark-long-2x-crop.png`
|
||||
- Runner: `.../public/graph_node_probe.mjs` (same file as `tool/graph_node_probe.mjs`)
|
||||
|
||||
The visit-2 `p2-node-fix-material-dark-*` captures were the default light theme
|
||||
with a "dark" name because the fixture had no dark theme; they are history only,
|
||||
as are the visit-1 `material-nodes-*.png` / `cupertino-nodes-*.png` set and the
|
||||
UI-review crops.
|
||||
|
||||
Pixel measurements of the current 2x crops (crops are 2x, 8 logical px margin):
|
||||
|
||||
| Node | Container (px) | Glyph ink (px) | Corner band |
|
||||
| --- | --- | --- | --- |
|
||||
| Material | x 16–316, y 16–560 | x 50–269, y 66–507 | 24 px (radius 12) |
|
||||
| Cupertino | x 16–316, y 16–640 | x 60–268, y 63–590 | 16 px (radius 8) |
|
||||
|
||||
At 1x the same nodes measure Material ink x 50–268, y 61–147 inside a
|
||||
x 16–316, y 16–200 container, and Cupertino ink x 59–264, y 59–164.
|
||||
No glyph ink enters a corner band or crosses the visible boundary in either
|
||||
scaling; the previous outline crossing is gone.
|
||||
|
||||
Inspected captures: Material shows outlined node bodies and a visibly filled
|
||||
selected node in real light and dark, `running` only on `build`, and no status on
|
||||
either terminal; Cupertino shows a tinted body for every unselected node and a
|
||||
filled selected node in both schemes.
|
||||
|
||||
## Honest limits
|
||||
|
||||
- **Material selection is tonal.** `Card.filled` (surfaceContainerHighest) versus
|
||||
`Card.outlined` (surface + border) is the strongest stock card pairing, but it
|
||||
is lighter than the previous primary-filled button. It is visible in the
|
||||
captures and asserted by pixels; if UI review wants a stronger accent, that
|
||||
needs an explicit theme-colour decision rather than a bespoke palette.
|
||||
- **Stage vs terminal is label-driven.** Both hosts give every node the same
|
||||
stock container; the web's terminal pill and outcome tints are styling the
|
||||
rules exclude. Terminals read `Success` / `Failure` (and no invented status).
|
||||
Composition can add a stock type affordance if it is still wanted.
|
||||
- **Material content inset is a spacing choice.** 16 logical px inside the card
|
||||
keeps wrapped glyphs clear of the 12 px corner radius; the framework's
|
||||
`kMinInteractiveDimension` keeps the tap target at the native minimum.
|
||||
- **No measurement API yet.** The control shrink-wraps; the caller imposes width
|
||||
(the fixture uses 150). The renderer still needs to measure this same control.
|
||||
- **`onSelected` identity and wrapping are unchanged**, but U+200B break
|
||||
opportunities would split exotic grapheme clusters (acceptable for stage keys).
|
||||
- **Space activation** is a framework default and is not exercised; only
|
||||
Tab + Enter is tested.
|
||||
- **No composition.** No canvas, layout invocation, edge painter, visit menu,
|
||||
shell registration or `main.dart` wiring: the widget is still not visible in
|
||||
the app.
|
||||
- **State of the branch.** The six paths are committed on
|
||||
`flutter/p2-node-widget` and `main` is merged in with no conflicts; the server
|
||||
performs the landing and the post-landing ancestry check.
|
||||
- **Fixture-only browser evidence**: no Pipelines server, real run,
|
||||
authentication change, deployment or production data.
|
||||
- **Mobile unverified**: web test/analyze/build only; no Android/iOS build,
|
||||
emulator, ADB or install.
|
||||
@@ -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,116 @@
|
||||
# P2c — deterministic orthogonal edge and label routing
|
||||
|
||||
## What changed
|
||||
|
||||
New app-only, pure-Dart files. No existing file, server, web client, legacy
|
||||
client, shell, `main.dart`, pubspec, domain, layout, other feature or platform
|
||||
source was edited.
|
||||
|
||||
| File | Lines | Responsibility |
|
||||
| --- | --- | --- |
|
||||
| `lib/features/graph/routing/route_models.dart` | 261 | public route, port, label, diagnostic and bounds types |
|
||||
| `lib/features/graph/routing/routing_inputs.dart` | 64 | measured label extents and caller clearances |
|
||||
| `lib/features/graph/routing/route_geometry.dart` | 175 | axis track allocator and column-gap bands |
|
||||
| `lib/features/graph/routing/corridor_plan.dart` | 105 | vertical corridor allocation per column gap |
|
||||
| `lib/features/graph/routing/edge_route_planner.dart` | 265 | forward/back/same-rank/self-loop polyline planning |
|
||||
| `lib/features/graph/routing/edge_label_placement.dart` | 175 | measured label boxes clear of nodes and other labels |
|
||||
| `lib/features/graph/routing/graph_edge_routing.dart` | 135 | validation, skipped diagnostics, labels, total bounds |
|
||||
| `test/features/graph/routing/routing_fixtures.dart` | 143 | chain/diamond/parallel/cycle/self-loop/disconnected fixtures |
|
||||
| `test/features/graph/routing/routing_assertions.dart` | 215 | orthogonality, borders, node interiors, corridors, labels, bounds |
|
||||
| `test/features/graph/routing/graph_edge_routing_test.dart` | 191 | chain, diamond, parallel, cycle, loop, disconnected, expanded text, unknown targets |
|
||||
| `test/features/graph/routing/graph_routing_geometry_test.dart` | 161 | wide labels, tight gaps, 3-stage SCC, backward layout, loop + forwards |
|
||||
| `test/features/graph/routing/graph_routing_validation_test.dart` | 222 | empty input, missing measurements, duplicate ids, invalid config, determinism/immutability |
|
||||
|
||||
No painting, widgets, styling, shell wiring or font/CSS/device constants were
|
||||
added.
|
||||
|
||||
## Public API
|
||||
|
||||
```dart
|
||||
GraphRouting routeGraphEdges({
|
||||
required GraphLayout layout,
|
||||
required List<GraphEdge> edges,
|
||||
required Map<int, LabelExtent> labelExtents,
|
||||
required RoutingConfig config,
|
||||
});
|
||||
```
|
||||
|
||||
`RoutingConfig` takes `nodeClearance`, `laneSpacing`, `corridorSpacing`,
|
||||
`portSpacing`, `labelGap` and optional `boundsPadding`. `LabelExtent` is the
|
||||
caller's measured label width/height. The node boxes and ranks are the landed
|
||||
`GraphLayout` values; the router never moves or resizes a node.
|
||||
|
||||
`GraphRouting` exposes unmodifiable `routes`, `labels`, `skipped`, `width` and
|
||||
`height`, plus `routeFor(id)` / `labelFor(id)`. Each `EdgeRoute` keeps the
|
||||
definition `id`, `source`, `outcome`, `target`, `label` and `fallback` flag, and
|
||||
returns `sourcePort`, `targetPort`, a `RouteKind` and an orthogonal `points`
|
||||
list. Each `EdgeLabelBox` carries the measured box for its edge id.
|
||||
|
||||
## Deterministic guarantees (and what is not claimed)
|
||||
|
||||
- **Identity:** routed edges copy the definition identity unchanged; skipped
|
||||
edges keep it in `RouteDiagnostic` with `unknownSource`/`unknownTarget`. No
|
||||
node, route or visit is invented for an empty, missing or unknown target.
|
||||
- **Order and stability:** routes, labels and diagnostics are ordered by edge id
|
||||
regardless of input order. Equal input produces equal, immutable results.
|
||||
- **Orthogonality and ports:** every consecutive point pair shares one
|
||||
coordinate. Endpoints are exactly on the source/target border with the
|
||||
recorded side: forward routes leave right and enter left; same-rank, backward
|
||||
and self-loop routes leave/enter the right side.
|
||||
- **Node avoidance:** a forward one-rank route is a straight horizontal run only
|
||||
when the boxes share a port band and leave room for label-aware track spacing.
|
||||
Every other route drops into a unique horizontal lane below the node grid,
|
||||
travels vertically only inside column gaps (or the free space right of the
|
||||
last column), and returns to a port through its own stub. Vertical corridors
|
||||
and lanes never enter a node column, and every horizontal stub stays on a row
|
||||
that is clear of unrelated node boxes.
|
||||
- **Distinguishable runs:** vertical tracks are spread across each gap, one
|
||||
slot per corridor request; horizontal stubs and straight routes share one
|
||||
interval-aware allocator; every wrapping route owns its own lane. Two edges
|
||||
cannot share a collinear run in the tested fixtures.
|
||||
- **Labels:** each routed edge needs a measured `LabelExtent`; a missing one is
|
||||
an `ArgumentError`. The box is placed at a deterministic route run, clear of
|
||||
node interiors and earlier labels. If a run is too narrow (for example a wide
|
||||
label between close columns), the label moves to a free shelf below the
|
||||
drawing and the returned bounds grow instead of covering a node.
|
||||
- **Bounds:** `width`/`height` include the landed node layout, all route points
|
||||
and all label boxes, plus `boundsPadding`. A self loop or an edge into the
|
||||
right-free gap expands the box; nothing is clipped.
|
||||
- **Not claimed:** perfect general crossing minimization or minimal bend
|
||||
counts. Corridors and lanes are deterministic and locally separated, not a
|
||||
globally optimal routing.
|
||||
|
||||
## Checks actually run
|
||||
|
||||
```
|
||||
flutter pub get
|
||||
dart format lib/features/graph/routing test/features/graph/routing # 0 changed
|
||||
flutter test test/features/graph/routing # 20 passed
|
||||
flutter analyze # No issues found!
|
||||
flutter test # 193 passed
|
||||
```
|
||||
|
||||
Focused coverage includes chain, diamond fan-out/fan-in, three outcomes to one
|
||||
target, a two-stage and a three-stage SCC, a self loop alone and beside forward
|
||||
routes, disconnected stages, heterogeneous widths, 2.6x expanded text, tight
|
||||
gaps, wide labels, a caller-supplied backward rank, missing/empty/unknown
|
||||
targets, immutability, stable ordering and finite bounds.
|
||||
|
||||
## Honest limits
|
||||
|
||||
- **No rendering.** This is a nonvisual geometry slice: no painter, widgets,
|
||||
native controls, screenshots or browser behavior. Rendered parity belongs to
|
||||
the next renderer task.
|
||||
- **Layout is an input.** The router does not widen columns for labels or move
|
||||
nodes. Very wide labels may sit on the free shelf below the drawing; callers
|
||||
that want labels beside an edge should reserve enough column gap when laying
|
||||
out nodes. A zero-width column gap leaves no space for distinct vertical
|
||||
corridors, so callers should supply a positive gap (the landed layout keeps
|
||||
whatever gap it is given).
|
||||
- **No general crossing optimum.** Only deterministic corridor/lane separation
|
||||
is guaranteed, as described above.
|
||||
- **No server or device.** Tests use local fixtures only; no run, pipeline,
|
||||
schedule, service, emulator, ADB, Android/iOS build or live chat was touched.
|
||||
- **Mobile unverified.** Only web-targeted Flutter test/analyze ran.
|
||||
- **Uncommitted candidate.** Per this stage's instruction the slice is left in
|
||||
the worktree; no commit, push or deployment was made.
|
||||
@@ -0,0 +1,7 @@
|
||||
# R1a — runs controller correctness
|
||||
|
||||
Implemented in `runs_controller.dart`: selection requests now retain prior detail while loading and ignore stale/disposed replies; list and detail loading indicators are independent; Back invalidates selection and cancels scheduled refresh; selected-run refreshes use captured ID/generation and preserve detail until the reply; identity-less or unresolvable run events trigger list resynchronization.
|
||||
|
||||
Added six fake-gateway regression tests in `test/features/runs/ui/runs_controller_test.dart` for stale selection, pending futures after disposal, Back cancellation, unrelated events, identity-less list resync, and full-refresh detail retention.
|
||||
|
||||
Verification: `flutter test test/features/runs/ui` passed (6 tests), `flutter analyze` passed with no issues, and `flutter build web` passed. Cupertino UI/browser evidence is outside this R1a slice and remains incomplete for the overall R1 task; mobile is unverified.
|
||||
@@ -0,0 +1,55 @@
|
||||
# R1b — runs controller request independence
|
||||
|
||||
Focused correctness fix on retained candidate `6b8d5ea`. Files:
|
||||
`lib/features/runs/ui/runs_controller.dart`,
|
||||
`test/features/runs/ui/runs_controller_test.dart`.
|
||||
|
||||
## Fixes
|
||||
|
||||
- List and detail requests now use independent generations (`_listGeneration`,
|
||||
`_detailGeneration`). `load(initialId)` no longer bumps the detail generation
|
||||
that `select(initialId)` also advances, so both `loading` and `detailLoading`
|
||||
clear when the requests resolve. Manual list loads also no longer invalidate
|
||||
valid detail refreshes.
|
||||
- List resyncs (`_reloadList`) capture and check a list generation, so a stale
|
||||
reply cannot overwrite a newer `load()`. Concurrent resync requests are
|
||||
coalesced into exactly one followup; a resync requested during a manual load
|
||||
runs after that load instead of being dropped.
|
||||
- Detail refreshes capture the current detail generation and selected run.
|
||||
Same-id refreshes keep the existing detail and are coalesced (in-flight plus
|
||||
one followup). Selecting a different run clears the previous detail instead of
|
||||
presenting it as the new run. Back/dispose invalidate pending replies, and
|
||||
stale requests cannot clear another generation's loading flags.
|
||||
- Added `num? get selectedRunId` for the native UI lane. All existing public
|
||||
methods and fields are preserved.
|
||||
|
||||
The existing 150 ms event debounce is retained; no polling or extra timers were
|
||||
introduced. File is 260 lines; the fix stays within the controller responsibility
|
||||
rather than fragmenting it.
|
||||
|
||||
## Tests
|
||||
|
||||
Extended `test/features/runs/ui/runs_controller_test.dart` with regressions for:
|
||||
|
||||
- `load(initialId)` resolves with `loading == false` and `detailLoading == false`.
|
||||
- Overlapping list loads with reversed completion order: newer reply wins.
|
||||
- List resync leaves the selected detail request valid.
|
||||
- Manual `load()` does not invalidate an in-flight detail refresh.
|
||||
- Sparse unknown run events coalesce into one followup resync.
|
||||
- A followup requested while a superseded resync is still marked in flight
|
||||
starts once that stale reply arrives instead of being stranded.
|
||||
- Selected refresh coalescing (in-flight plus followup) and Back ignoring the
|
||||
pending reply.
|
||||
- Choosing another run does not display the previous run's detail.
|
||||
- Pending detail refresh is safe after dispose.
|
||||
|
||||
Existing six regression tests remain and pass.
|
||||
|
||||
## Verification
|
||||
|
||||
- `/Users/alan/development/flutter/bin/flutter test test/features/runs/ui` — 15 tests passed.
|
||||
- `/Users/alan/development/flutter/bin/flutter test test/features/runs` — 26 tests passed.
|
||||
- `/Users/alan/development/flutter/bin/flutter analyze` — no issues found.
|
||||
- `flutter build web` not run in this NONVISUAL controller slice; manager
|
||||
integration/UI review owns rendered and build acceptance.
|
||||
- Mobile remains unverified; no device or browser tools used.
|
||||
@@ -0,0 +1,50 @@
|
||||
# R1c2 — run detail native widget slice
|
||||
|
||||
## Change
|
||||
|
||||
`RunDetailView` keeps its existing `controller` and `onBack` API but now selects
|
||||
its presentation from the host: MaterialApp uses the standard Material controls,
|
||||
CupertinoApp uses Cupertino controls without a Material ancestor. Selection is
|
||||
based on `MaterialLocalizations`, so it works on the web's desktop host and in
|
||||
widget tests without relying on the browser's target platform.
|
||||
|
||||
- Material: `Chip`, `ExpansionTile`, `ListTile`, `TextButton`, `IconButton`,
|
||||
selectable text and `SnackBar` feedback.
|
||||
- Cupertino: `CupertinoButton`, `CupertinoExpansionTile`, `CupertinoListTile`
|
||||
and grouped list sections. Copy feedback is inline in a live-region status;
|
||||
no `ScaffoldMessenger`/`SnackBar` is used.
|
||||
- Loading and failure states are platform-specific and honest: only the error
|
||||
text is shown when no detail exists, and the Back action remains available.
|
||||
A refresh with retained detail reports `Refreshing run details…` instead of
|
||||
clearing the view.
|
||||
- The scrollable list has a stable per-run key and a test proves a live detail
|
||||
update keeps its scroll offset.
|
||||
|
||||
Detail-only helpers split formatting from presentation:
|
||||
|
||||
- `run_detail_content.dart`: title/pipeline, prompt extraction, nested JSON,
|
||||
usage metrics and recorded timeline entries.
|
||||
- `run_detail_material.dart` and `run_detail_cupertino.dart`: the two native
|
||||
presentations.
|
||||
- Input/output are pretty-printed, selectable JSON. Copy prompt passes the
|
||||
stored string byte-for-byte (no trim, no fallback field).
|
||||
- Usage distinguishes reported zero from unknown: token/cost totals are
|
||||
`Unavailable` unless the corresponding stage count proves reporting; a known
|
||||
stage count with an omitted zero cost renders `$0.000000`. Timeline rows show
|
||||
the server's recorded sequence.
|
||||
|
||||
## Verification
|
||||
|
||||
- `flutter test test/features/runs/ui/run_detail_widget_test.dart`: 7 tests
|
||||
passed. They run both platforms at 390px width with 2x text, exercise
|
||||
loading/error and Back, exact prompt copy and denied clipboard feedback,
|
||||
nested JSON, recorded sequences, zero vs missing usage, and scroll retention.
|
||||
- `flutter test test/features/runs`: 24 tests passed.
|
||||
- `flutter analyze`: no issues.
|
||||
- `flutter build web`: succeeded.
|
||||
|
||||
## Limits
|
||||
|
||||
No real browser interaction or rendered capture was performed in this slice; the
|
||||
manager separately tracks R1 browser acceptance. Android/iOS builds and devices
|
||||
were not run, so mobile is unverified. No commit, push or deployment was made.
|
||||
@@ -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,167 @@
|
||||
# S1b — saved-schedules list (read-only)
|
||||
|
||||
## What changed
|
||||
|
||||
App-only files; no existing feature, shell, `main`, pubspec, data/domain or
|
||||
server source edited.
|
||||
|
||||
| File | Lines | Responsibility |
|
||||
| --- | --- | --- |
|
||||
| `lib/features/schedules/screen.dart` | 94 | `SchedulesScreen(gateway, onOpen, pipelineId)` body; owns controller, search text and scroll |
|
||||
| `lib/features/schedules/ui/list/schedule_list_controller.dart` | 168 | list load, newest-only publish, search/enabled filter, failure classification, cached visible view |
|
||||
| `lib/features/schedules/ui/list/schedule_list_view.dart` | 188 | adaptive list, loading/empty/error states, stable error-banner slot |
|
||||
| `lib/features/schedules/ui/list/schedule_list_toolbar.dart` | 179 | native search, all/enabled filter, refresh, count |
|
||||
| `lib/features/schedules/ui/list/schedule_list_row.dart` | 115 | tappable row with server fields |
|
||||
| `lib/features/schedules/ui/list/schedule_list_format.dart` | 70 | honest value/date/count wording |
|
||||
| `test/features/schedules/ui/list/schedules_screen_test.dart` | 171 | search, filter, empty-filter wording, onOpen, states, unsubscribe |
|
||||
| `test/features/schedules/ui/list/schedules_refresh_test.dart` | 119 | query/scroll preservation across successful and failed refresh |
|
||||
| `test/features/schedules/ui/list/schedules_layout_test.dart` | 79 | Material + Cupertino at 390px, 1x and 2x text |
|
||||
| `test/features/schedules/ui/list/schedule_list_controller_test.dart` | 182 | envelopes, empty/unsupported/error wording, ordering, dispose |
|
||||
| `test/features/schedules/ui/list/schedule_list_filter_test.dart` | 87 | search/filter behavior and cache invalidation |
|
||||
| `test/features/schedules/ui/list/schedule_list_format_test.dart` | 72 | complete/missing/invalid values and fixed due-time wording |
|
||||
| `test/features/schedules/ui/list/schedule_list_test_support.dart` | 143 | recorded/immediate and controlled fake gateways |
|
||||
| `test/features/schedules/ui/list/schedule_screen_harness.dart` | 33 | 390px test app builder |
|
||||
| `tool/schedules_list_probe_app.dart` | 110 | local-only browser fixture (fake schedules, light/dark) |
|
||||
| `tool/schedules_list_probe.mjs` | 252 | real Chrome probe, content assertions, five captures |
|
||||
|
||||
## Behavior
|
||||
|
||||
`SchedulesRepository.listSchedules` and `SavedSchedule` are reused unchanged.
|
||||
The screen calls only `list_schedules`, with `pipeline_id` when supplied. There
|
||||
is no add/edit/delete/pause/enable control and no other request type.
|
||||
|
||||
- A valid empty reply shows `No schedules yet.` An older/unsupported envelope is
|
||||
a distinct error (`This server does not support saved schedules…`), and a
|
||||
transport/repository error keeps its actual text. A failed refresh with rows
|
||||
already loaded keeps those rows and shows the error above them.
|
||||
- Older-server detection now matches the web client's wording
|
||||
(`unknown (message|request|command)` and `unsupported…schedule`, case
|
||||
insensitive) in addition to the repository's `no schedules response` report,
|
||||
so a real server refusal receives the same upgrade guidance as the web.
|
||||
- Search matches schedule name, prompt and the actual pipeline ID (`Pipeline 4`,
|
||||
including a bare `4`). No pipeline name exists in the saved-schedule record, so
|
||||
matching names is not possible without another request; none is faked.
|
||||
- Filter is `All` / `Enabled`. Paused rows remain visible under `All`. When the
|
||||
search box is empty and only the filter hides every row, the empty state says
|
||||
`No enabled schedules.`; an entered query still says
|
||||
`No schedules match this search.`
|
||||
- Rows show the server's pipeline ID, pinned version, workspace, timer rule,
|
||||
timezone and `next_due`. Missing values stay `Pipeline unavailable`,
|
||||
`Version unavailable`, `Workspace unavailable`, `Timer unavailable`; an
|
||||
omitted/`Local` timezone is `Server timezone`; an absent/invalid due time is
|
||||
`Not scheduled` / `Next time unavailable`; a paused row shows `Paused`.
|
||||
Due values are converted to local time and labelled `(your local time)`,
|
||||
matching the web client's wording.
|
||||
- Selecting a row passes the exact `SavedSchedule` object from the loaded list to
|
||||
`onOpen`; it does not re-fetch, copy into a draft or mutate it.
|
||||
- Query, filter and list are not recreated by refresh, so the search text and
|
||||
`ScrollController` offset survive. The failed-refresh banner occupies a
|
||||
permanently present slot above the list, so showing or clearing it does not
|
||||
change the list's ancestor chain or rebuild its `Scrollable`. Only the newest
|
||||
refresh generation may publish; stale replies and replies after dispose are
|
||||
ignored.
|
||||
- The filtered view is cached in the controller and invalidated on query,
|
||||
filter and new replies, so one rebuild does not repeat the same O(n) pass for
|
||||
the body, count and toolbar.
|
||||
|
||||
Controls are native defaults: Material `TextField`, `SegmentedButton`,
|
||||
`IconButton`, `TextButton`, `Divider`, `CircularProgressIndicator`; Cupertino
|
||||
`CupertinoSearchTextField`, `CupertinoSlidingSegmentedControl`,
|
||||
`CupertinoButton`, `CupertinoActivityIndicator`. No CSS palette, custom font,
|
||||
fixed row height or bespoke control was added. Layout is a content-driven column
|
||||
with wrapping text; a single max-width constraint keeps the filter compact on
|
||||
wide screens.
|
||||
|
||||
## Review findings addressed
|
||||
|
||||
- **M1 (must-fix), failed refresh reset the scroll offset.** Reproduced with the
|
||||
new `schedules_refresh_test.dart` against the previous structure: the test
|
||||
failed because the `Expanded` child changed from `ListView` to
|
||||
`Column(banner, Expanded(ListView))`, recreating the `Scrollable`. With the
|
||||
permanent banner slot the test passes for both the failure transition and the
|
||||
later recovery/retry, at the unchanged offset. The test was also run against a
|
||||
temporary local revert of the fix and failed as expected, then restored.
|
||||
- **Advisory 1**, filter-only empty state: now `No enabled schedules.` unless a
|
||||
query is active.
|
||||
- **Advisory 2**, older-server wording: web-parity regex added and tested with
|
||||
raw `unknown request`, `UNKNOWN COMMAND` and `Unsupported schedules command`
|
||||
errors; unrelated errors keep their exact text.
|
||||
- **Advisory 5**, repeated filtering: visible list cached and invalidated.
|
||||
- **Advisory 6**, test oracle: the layout test now asserts the literal
|
||||
`Next due: 2026-10-22 09:00 (your local time)` from a zone-less fixture instant;
|
||||
the duplicated formatter helper was removed from the harness.
|
||||
- **Advisory 7**, Material dark evidence: the fixture accepts
|
||||
`?brightness=dark` and the probe captures Material dark at 390px.
|
||||
|
||||
Advisory 3 (typed repository reason instead of matching a private message
|
||||
string) needs a change in the landed `data/schedules_repository.dart`, outside
|
||||
this list slice; the exact-string mapping is retained and documented. Advisory
|
||||
4 (formatting in the rule's IANA timezone) still needs a timezone package.
|
||||
|
||||
## Checks actually run
|
||||
|
||||
```
|
||||
dart format --set-exit-if-changed lib/features/schedules \
|
||||
test/features/schedules/ui/list tool/schedules_list_probe_app.dart
|
||||
# 19 files, 0 changed
|
||||
|
||||
flutter test test/features/schedules/ui/list # 29 passed
|
||||
flutter test # 110 passed
|
||||
flutter analyze # No issues found!
|
||||
flutter build web # ✓ Built build/web
|
||||
flutter build web -t tool/schedules_list_probe_app.dart # ✓ Built build/web
|
||||
node --check tool/schedules_list_probe.mjs # clean
|
||||
node tool/schedules_list_probe.mjs --out …/public/s1b-schedules-captures
|
||||
# 5 captures, content assertions passed
|
||||
```
|
||||
|
||||
The focused suite covers the list envelope (with and without `pipeline_id`),
|
||||
empty vs unsupported vs transport errors, older-server wording, a failed refresh
|
||||
retaining rows, out-of-order refresh, disposal safety, search/filter behavior and
|
||||
cache invalidation, `onOpen` receiving the exact raw record, no mutation calls,
|
||||
query preservation, a successful and a failed refresh preserving scroll (plus
|
||||
recovery), filter-only empty wording, both MaterialApp and CupertinoApp at 390px
|
||||
with 1x and 2x text, and no render overflow.
|
||||
|
||||
## Browser evidence
|
||||
|
||||
Real headless Chrome served the fixture build on an OS-assigned loopback port,
|
||||
with explicit MIME types, Flutter semantics enabled, and content assertions
|
||||
before each capture:
|
||||
|
||||
- `/Users/alan/.local/share/pipelines/data/artifacts/58/public/s1b-schedules-captures/s1b-schedules-material-390.png`
|
||||
- `…/s1b-schedules-material-390-2x.png`
|
||||
- `…/s1b-schedules-material-390-dark.png`
|
||||
- `…/s1b-schedules-cupertino-390.png` (platform dark appearance)
|
||||
- `…/s1b-schedules-material-1100.png`
|
||||
- `…/manifest.json`
|
||||
|
||||
The fixture uses a local fake gateway with four records (enabled, paused, clock
|
||||
rule, sparse record). It never contacted a Pipelines server, bypassed
|
||||
authentication or created/changed a real schedule or run.
|
||||
|
||||
## Full diff
|
||||
|
||||
Every changed path is new and untracked; no pre-existing work was modified,
|
||||
reset or deleted. The complete patch is saved at:
|
||||
|
||||
`/Users/alan/.local/share/pipelines/data/artifacts/58/public/s1b-schedules-list.diff`
|
||||
|
||||
## Honest limits
|
||||
|
||||
- **Not committed.** This stage forbids commit/push/deploy, so the candidate
|
||||
remains uncommitted in the `flutter/s1-list` worktree for the manager.
|
||||
- **Not wired into the shell.** `lib/main.dart`, `lib/shell/` and destination
|
||||
registration are untouched; the Schedules destination still shows its
|
||||
placeholder until the separate integration item.
|
||||
- **No schedule editor.** Create/edit/delete/pause remain separate follow-up
|
||||
items; no mutation was implemented or exercised.
|
||||
- **Pipeline-name search unavailable.** The saved-schedule record exposes only
|
||||
`pipeline_id`; search uses that exact ID rather than inventing a name.
|
||||
- **Due times use the device timezone.** The absolute `next_due` instant is shown
|
||||
as `(your local time)` and the rule timezone separately. The web client can
|
||||
format in the rule's IANA timezone; that needs a timezone package not available
|
||||
in this slice.
|
||||
- **Mobile unverified.** No Android/iOS build, emulator, ADB or device was used.
|
||||
- **Live server unverified.** Browser evidence is fixture-only by design; no
|
||||
production authentication or schedule data was used.
|
||||
@@ -0,0 +1,140 @@
|
||||
# T1a — template catalogue, validate and create-only submit
|
||||
|
||||
## What changed
|
||||
|
||||
New nonvisual `templates` data/domain slice. One shared file was edited:
|
||||
`app/.gitignore` re-includes `test/**/data/`, because the repository's runtime
|
||||
`data/` rule was silently excluding this slice's tests from the candidate. No
|
||||
other lane's work, `lib/main.dart`, shell, pubspec, `web/`, server or Android
|
||||
file was touched.
|
||||
|
||||
| File | Lines | Responsibility |
|
||||
| --- | --- | --- |
|
||||
| `lib/features/templates/domain/template_entry.dart` | 63 | Immutable server template; models key/name/description/source/scheduled and keeps every unknown field in deeply read-only `raw` |
|
||||
| `lib/features/templates/data/template_repository.dart` | 84 | `TemplateRepository(ApiGateway)`: list, validate, create-only submit |
|
||||
| `test/features/templates/data/template_test_support.dart` | 47 | Recording/refusing fake gateways, server-refusal error, Unicode source fixture |
|
||||
| `test/features/templates/data/template_list_test.dart` | 165 | Catalogue request shape, field preservation, deep immutability, missing/malformed catalogue |
|
||||
| `test/features/templates/data/template_create_test.dart` | 147 | Validate/submit envelopes, blank-name gate, missing payloads, verbatim refusals |
|
||||
| `app/.gitignore` | +4 | Re-includes `test/**/data/` so test files enter the candidate |
|
||||
|
||||
Nothing under `lib/main.dart`, `lib/shell/`, another feature, `pubspec.*`,
|
||||
`web/`, the Go server or `android/` was changed. No dependency was added.
|
||||
|
||||
## Review findings addressed
|
||||
|
||||
- **Tests could never land (blocking).** `test/features/templates/data/` was
|
||||
excluded by the repository root rule `data/`; `app/.gitignore` only re-included
|
||||
`lib/**/data/`. The same negation now covers `test/**/data/`, so these three
|
||||
test files are untracked-but-visible to git and `git add -n` succeeds. Fixing
|
||||
the rule (rather than `git add -f`) also protects later `test/**/data/` lanes
|
||||
such as S1a. No test was moved, so `test/` still mirrors `lib/`.
|
||||
- **`raw` was only shallowly immutable (advisory).** `TemplateEntry.fromJson`
|
||||
now deep-copies nested maps/lists into read-only collections, and the listed
|
||||
test proves nested mutation throws and that the copy does not alias the reply.
|
||||
- **Malformed-catalogue branches were untested (advisory).** Added tests for a
|
||||
non-list `templates` value and a non-object catalogue entry, both rejecting
|
||||
with explicit messages.
|
||||
- `_text` still stringifies a non-string protocol value with `'$value'`; the
|
||||
protocol only sends strings, and this matches how the browser would render
|
||||
such a value, so the behaviour was left unchanged and is documented here
|
||||
rather than claimed as strict parity.
|
||||
|
||||
## Wire behaviour (mirrors `web/src/repository.js`)
|
||||
|
||||
- `listTemplates()` sends exactly `{"type":"list_templates"}` with no fields and
|
||||
returns the `templates` catalogue. A reply with no `templates` field is the
|
||||
older server's empty catalogue (`?? []` in the browser), not a fake template.
|
||||
Each entry keeps `key`, `name`, `description`, `source`, `scheduled` and all
|
||||
unknown fields in `TemplateEntry.raw`; the reply list/maps are never mutated.
|
||||
`raw` is a deep unmodifiable copy: nested unknown maps and lists are copied
|
||||
into read-only collections, so neither the view nor a later caller can mutate
|
||||
the server reply through it.
|
||||
- `listTemplates()` rejects a malformed envelope instead of fabricating
|
||||
entries: a non-list `templates` throws
|
||||
`"The server returned no template catalogue."` and a non-object entry throws
|
||||
`"The server returned a template that is not an object."`. The real server
|
||||
cannot produce either, but a protocol mistake must not look like an empty or
|
||||
half-populated catalogue.
|
||||
- `validate(source)` sends exactly `{"type":"validate","source":<source>}` and
|
||||
returns the reply's `graph`. A reply without a graph throws
|
||||
`TemplateRepositoryException("The server returned no graph.")` — the browser's
|
||||
exact words — rather than reporting a valid definition.
|
||||
- `submit(name, source)` sends exactly
|
||||
`{"type":"submit","name":<trimmed name>,"source":<source>,"create_only":true}`.
|
||||
A blank/whitespace-only name is refused locally with
|
||||
`TemplateRepositoryException("Enter a pipeline name.")` and no gateway call is
|
||||
made; the accepted name is trimmed. A reply without `detail` throws
|
||||
`TemplateRepositoryException("The server returned no pipeline detail.")`.
|
||||
- The source string is never trimmed, normalised or re-encoded: Unicode, tabs,
|
||||
newlines and significant leading/trailing whitespace arrive unchanged.
|
||||
- A server refusal is never caught or reworded by the repository. It reaches the
|
||||
caller as the same gateway error object, so the server's own text is shown.
|
||||
- The repository exposes only these three operations. It has no publish, run,
|
||||
schedule or overwrite path, so loading or validating a template cannot start
|
||||
work or mutate a retained pipeline.
|
||||
|
||||
## Checks actually run
|
||||
|
||||
```
|
||||
flutter pub get # Got dependencies
|
||||
dart format lib/features/templates test/features/templates # clean
|
||||
flutter analyze # No issues found! (0.9s)
|
||||
flutter test test/features/templates # 13 passed
|
||||
flutter test # 76 passed
|
||||
flutter build web # ✓ Built build/web (15.5s)
|
||||
git diff --check # clean
|
||||
git check-ignore / git add -n # tests are no longer ignored
|
||||
```
|
||||
|
||||
Tests are part of the candidate, not merely present on disk:
|
||||
|
||||
```
|
||||
$ git add -n app/test/features/templates/data/template_list_test.dart \
|
||||
app/test/features/templates/data/template_create_test.dart \
|
||||
app/test/features/templates/data/template_test_support.dart
|
||||
add 'app/test/features/templates/data/template_create_test.dart'
|
||||
add 'app/test/features/templates/data/template_list_test.dart'
|
||||
add 'app/test/features/templates/data/template_test_support.dart'
|
||||
exit=0
|
||||
|
||||
$ git status --porcelain=v1 -uall
|
||||
M app/.gitignore
|
||||
?? app/lib/features/templates/data/template_repository.dart
|
||||
?? app/lib/features/templates/domain/template_entry.dart
|
||||
?? app/notes/T1a.md
|
||||
?? app/test/features/templates/data/template_create_test.dart
|
||||
?? app/test/features/templates/data/template_list_test.dart
|
||||
?? app/test/features/templates/data/template_test_support.dart
|
||||
```
|
||||
|
||||
Focused acceptance coverage:
|
||||
|
||||
- exact `list_templates` request (no fields, one call) and preservation of
|
||||
modelled plus unknown fields, including nested unknown data;
|
||||
- listing does not mutate the reply's template list or entry maps; `raw` and
|
||||
every nested map/list are read-only, and the copy does not alias the reply;
|
||||
- missing catalogue -> empty list; malformed catalogue -> explicit refusal;
|
||||
- blank/whitespace name -> refusal with zero gateway calls;
|
||||
- Unicode/emoji, tab/newline and leading/trailing source whitespace preserved in
|
||||
both `validate` and `submit`; submit sends only name, source and
|
||||
`create_only: true`, with the name trimmed;
|
||||
- missing `graph` and missing `detail` rejected with the browser's exact
|
||||
messages, with no fabricated graph/detail;
|
||||
- validate and submit server refusals surface as the identical error object,
|
||||
not a wrapper.
|
||||
|
||||
## Honest limits
|
||||
|
||||
- **Not wired into a screen.** This branch has no templates screen and the task
|
||||
owns data/domain only; the manager owns integration. No browser capture was
|
||||
made because there is no rendered change in this slice.
|
||||
- **Mobile unverified.** No Android/iOS build, emulator, ADB or device was used.
|
||||
The code is plain Dart with no platform-specific code.
|
||||
- No live server, template catalogue, validate call or submit/creation was
|
||||
performed. All tests use local fake gateways with no socket, so no real
|
||||
pipeline was created or run.
|
||||
- No export-gate workaround, server change or service operation was made; the
|
||||
pending export-cap fix remains another lane's scope.
|
||||
- **Not committed.** The stage instruction says not to commit, push or deploy,
|
||||
so the candidate above is uncommitted in the working tree even though the run
|
||||
prompt asks to commit a reviewed candidate. Nothing was pushed or deployed.
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
# X1 — Omni-search
|
||||
|
||||
## Scope and API
|
||||
|
||||
Implemented the `search` feature under `lib/features/search/` with no
|
||||
`main.dart`, shell, pubspec, server, web or Android edits.
|
||||
|
||||
Entry point:
|
||||
|
||||
```dart
|
||||
SearchScreen(
|
||||
gateway: apiGateway, // required ApiGateway
|
||||
onOpen: (hit) { ... }, // required ValueChanged<JsonMap>
|
||||
cupertino: null, // optional; omitted = iOS/macOS Cupertino, else Material
|
||||
)
|
||||
```
|
||||
|
||||
`onOpen` always receives the server's original result map unchanged, including
|
||||
its `target`. Unknown/absent payloads and results without a target are
|
||||
read-only and never call `onOpen`; the client never invents a route or mutates
|
||||
server state.
|
||||
|
||||
Request shape is exact and shared-gateway only:
|
||||
|
||||
```json
|
||||
{"type":"search","search":{"query":"plan","kind":"","limit":0}}
|
||||
```
|
||||
|
||||
`limit` is always `0` (server default cap), never a client-chosen larger value.
|
||||
|
||||
## Behaviour
|
||||
|
||||
- `t:`/`type:` tokens: unquoted, whitespace-delimited, case-insensitive, last
|
||||
supported token wins; quoted, escaped, unknown and trailing-punctuation
|
||||
tokens stay literal. The parser mirrors `web/src/search.js`.
|
||||
- Kind selector: All kinds / Pipelines / Runs / Steps / Fields / Artifacts /
|
||||
Versions. Changing it removes recognised type tokens from the field and sends
|
||||
at once, like the browser's selector.
|
||||
- Empty text with All kinds clears locally and sends nothing. Blank text with a
|
||||
valid kind is a kind-only browse, matching the server/browser contract.
|
||||
- 250 ms debounce; Enter sends at once. Every request carries a monotonically
|
||||
increasing token, and replies for superseded edits are dropped.
|
||||
- Loading, searching, retained-results refresh progress, empty (query-specific
|
||||
and kind-only wording) and error are distinct. A truncated reply with no rows
|
||||
says the server's scan limit was reached and keeps its truncation/scan bounds
|
||||
on screen instead of claiming a complete empty; a complete empty has no bounds
|
||||
line. A reply without `search_results` and an unknown-command rejection use
|
||||
the server-upgrade sentence; any other failure shows the server's own text.
|
||||
Error state offers Retry.
|
||||
- Rows show the kind derived from the server payload (`Unrecognised result` for
|
||||
an unknown payload), title, snippet (first case-insensitive query occurrence in
|
||||
bold), and recency. Bounds show result count, cap, scanned steps/bytes, scan
|
||||
limit and a truncation sentence when the server reports it, including for a
|
||||
truncated reply with zero rows.
|
||||
- In-hand results are re-narrowed by the effective kind while a narrowed request
|
||||
loads, so the list always agrees with the control.
|
||||
- Standard platform controls only: Material `SearchBar`, dropdown,
|
||||
`LinearProgressIndicator`, `CircularProgressIndicator`, `ListTile`,
|
||||
`FilledButton.tonalIcon`; Cupertino `CupertinoSearchTextField`, action-sheet
|
||||
kind picker, `CupertinoListSection`/`CupertinoListTile`,
|
||||
`CupertinoActivityIndicator`, `CupertinoButton.filled`. No CSS port, custom
|
||||
palette, fixed row/bubble dimensions or bespoke buttons. Typography and
|
||||
colours come from the ambient Material/Cupertino theme; rows and the header
|
||||
scroll in one `CustomScrollView` so 2× text never clips.
|
||||
|
||||
## Automated checks
|
||||
|
||||
Run from `app/` with `/Users/alan/development/flutter/bin/flutter`:
|
||||
|
||||
- `flutter test test/features/search` — **36 passed** (controller, repository,
|
||||
query/token parser, row/snippet/routing, Material + Cupertino widget tests).
|
||||
- `flutter test` — **65 passed** (whole app suite, including existing transport,
|
||||
runs and shell tests).
|
||||
- `flutter analyze` — **No issues found**.
|
||||
- `flutter build web` (default `lib/main.dart`) — **succeeded**.
|
||||
- `flutter build web -t tool/search_fixture/main.dart` — **succeeded** for the
|
||||
rendered probe.
|
||||
- `node --check tool/search_probe.mjs` — passed.
|
||||
- `git diff --no-index --check /dev/null <file>` on every touched file — no
|
||||
whitespace errors (all task files are untracked, so plain `git diff --check`
|
||||
would not see them).
|
||||
|
||||
Tests were written before the implementation (initial run failed on missing
|
||||
symbols). Coverage includes the exact envelope, token parsing, selector token
|
||||
clearing, no-request empty state, stale success and failure replies,
|
||||
error/retry, truncation/bounds (including a truncated reply with zero rows),
|
||||
per-kind row text, snippet spans, read-only hits, `onOpen` targets, and
|
||||
MaterialApp/CupertinoApp at 390/1000 wide with 2× text.
|
||||
|
||||
## Rendered browser evidence
|
||||
|
||||
Built the Web-only fixture (`tool/search_fixture/main.dart`) and drove real
|
||||
headless Chrome through CDP with `tool/search_probe.mjs` on an OS-assigned
|
||||
loopback port. The probe typed `plan` into the real field, asserted five rows,
|
||||
the server snippet, recency and truncation/scanned bounds, then clicked the
|
||||
pipeline row and asserted that the fixture receiver got `pipeline:24`. It also
|
||||
typed `needle` with no matching fixtures and asserted the Material and Cupertino
|
||||
truncated-empty copy plus the retained `Results truncated … 0 results … scanned
|
||||
2000 steps … scan limit 1.0 MiB` line, capturing both.
|
||||
|
||||
Captures are in the run's shared artifacts:
|
||||
|
||||
- `/Users/alan/.local/share/pipelines/data/artifacts/49/public/x1-search/x1-search-material-phone.png` — 390×844, Material controls, five mixed-kind results with recency/snippet/bounds.
|
||||
- `/Users/alan/.local/share/pipelines/data/artifacts/49/public/x1-search/x1-search-material-desktop.png` — 1280×800, same results.
|
||||
- `/Users/alan/.local/share/pipelines/data/artifacts/49/public/x1-search/x1-search-cupertino-phone.png` — 390×844, Cupertino search field/kind picker/grouped rows, dark system theme.
|
||||
- `/Users/alan/.local/share/pipelines/data/artifacts/49/public/x1-search/x1-search-open-target.png` — the row click landing on `Opened pipeline target: pipeline:24`.
|
||||
- `/Users/alan/.local/share/pipelines/data/artifacts/49/public/x1-search/x1-search-truncated-empty.png` — 390×844 Material, zero rows with the server's scan-limit sentence and truncation/scan bounds.
|
||||
- `/Users/alan/.local/share/pipelines/data/artifacts/49/public/x1-search/x1-search-truncated-empty-cupertino.png` — 390×844 Cupertino dark, the same bounded empty state.
|
||||
|
||||
The fixture and probe are development-only entry points; they are not imported
|
||||
by `lib/main.dart` and are not part of the production routing. The browser run
|
||||
used a static fake gateway, not a live Pipelines server or operator data.
|
||||
|
||||
## Not verified / open items
|
||||
|
||||
- No shell registration or navigation wiring was added (manager owns
|
||||
`main.dart`/`shell/`); the screen is exported for that integration.
|
||||
- No real server, operator chat/run, or production URL was used.
|
||||
- Mobile targets (Android/iOS) were **not** built, installed or exercised;
|
||||
only Web was rendered and tested. Source is kept portable.
|
||||
- No commit, push, deployment or canonical URL change was made.
|
||||
Reference in New Issue
Block a user