feat(app): add the Graph tab and recorded-stage selection to run detail

This commit is contained in:
2026-10-22 00:39:42 +01:00
parent 0e323dde10
commit d74e5c501f
16 changed files with 1702 additions and 306 deletions
+104
View File
@@ -0,0 +1,104 @@
# R3 — run detail Graph tab
## Delivered
The real run detail is now tabbed in the web's order: **Summary, Graph, Input,
Output, Timeline**. The host-built header (Back, Changes, title, status,
Rename, Retry, Cancel, Decide, Artifacts) stays above the tabs, so switching
tabs never removes an action.
- **Summary** keeps the original prompt with its copy control and the reported
usage metrics (unknown stays `Unavailable`, never a fabricated zero).
- **Graph** mounts the landed `RunGraphView` from `run['graph']` (the run's own
pinned definition) and `run['steps']`. It shows the exact `Executed` /
`Not executed` legend and fills a bounded `Expanded` slot. A reply without a
graph shows `This server did not include the run graph.` and no canvas.
- **Input** / **Output** render the recorded field as their own tab.
- **Timeline** lists every recorded visit. A graph click on a visited stage
selects that stage's latest recorded visit and switches to Timeline, where
the row is highlighted (`ListTile.selected` on Material; native tint +
checkmark and selected semantics on Cupertino). The strip scrolls the
programmatically selected Timeline segment into view at narrow widths. An
unvisited node has no visit: clicking it does nothing and no row is invented.
The header may scroll when scaled text or a short viewport would otherwise
squeeze the tab away; the tab keeps at least `kRunDetailMinContentHeight`
(240) so the graph's own legend and canvas stay positive at 320px/2x.
## Files
Added:
- `app/lib/features/runs/ui/run_detail_tab.dart` — tab keys/labels in web order.
- `app/lib/features/runs/ui/run_detail_tab_strip.dart` — adaptive segmented
control with horizontal scrolling when labels do not fit.
- `app/lib/features/runs/ui/run_detail_tabs.dart` — tab state, bounded layout,
graph selection → Timeline handoff.
- `app/lib/features/runs/ui/run_detail_tab_bodies.dart` — Summary/Input/Output
bodies and metrics in both hosts.
- `app/lib/features/runs/ui/run_detail_timeline.dart` — timeline rows and
selected highlight.
- `app/test/features/runs/ui/run_detail_graph_tab_test.dart`,
`run_detail_tabs_test.dart`, `run_detail_graph_support.dart`.
- `app/tool/run_detail_graph_probe.dart`, `run_detail_graph_probe.mjs`.
- `app/notes/R3-graph.md`.
Changed:
- `run_detail_content.dart` — `DetailVisit` now carries the exact `stage` and
`sequence`; `latestDetailVisit`, `detailGraph`.
- `run_detail_material.dart`, `run_detail_cupertino.dart` — host headers plus
`RunDetailTabs`; no content or action dropped.
- `run_changes_action.dart` — the Cupertino Changes button label is `Flexible`
so 320px/2x text wraps inside the native button instead of overflowing the
header by 14px (surfaced by the new bounded-layout test).
- `run_detail_widget_test.dart` — existing prompt/copy/metrics/timeline and
refresh-retention coverage adapted to the tabs.
## Checks run
From `app/` with Flutter 3.44.6:
- `flutter analyze` — no issues.
- `flutter test` — **960 tests passed** (full suite, including the new tab
tests and the existing cancel/retry/decision/changes/artifacts wiring).
- `flutter build web` — built `build/web`.
- Probe build: `flutter build web --target tool/run_detail_graph_probe.dart
--output build/probe-run-detail-graph` — succeeded.
## Browser evidence
Probe drives the real `RunDetailView` over a server-shaped fake gateway. Each
run checks: Graph opens; `Executed`/`Not executed` legend; recorded `plan` and
`build` statuses; `audit` unvisited; a plan click selects `plan · visit 1`
(`aria-current=true` on the row), reveals the Timeline tab in the strip and
shows no `audit · visit`; the missing-graph case shows the exact sentence and no
canvas.
| Host | Viewport | Captures |
| --- | --- | --- |
| Material | 1280×900, dark, 1x | `r3-graph/run-detail-graph-material-dark-1x-1280x900-{graph,selected-visit,missing-graph}.png` |
| Material | 320×700, dark, 2x | `r3-graph/run-detail-graph-material-dark-2x-320x700-{graph,selected-visit,missing-graph}.png` |
| Cupertino | 1280×900, dark, 1x | `r3-graph/run-detail-graph-cupertino-dark-1x-1280x900-{graph,selected-visit,missing-graph}.png` |
| Cupertino | 320×700, dark, 2x | `r3-graph/run-detail-graph-cupertino-dark-2x-320x700-{graph,selected-visit,missing-graph}.png` |
Evidence JSON: `r3-graph/evidence-{material,cupertino}-{1x-1280x900,2x-320x700}.json`
under the run's public artifacts. At 320/2x the canvas is panned so the later
`audit` node can be outside the visible viewport; the unvisited-node check is
therefore recorded as skipped there and is covered by the widget test at every
host.
## Not done / unverified
- No commit, push, merge or deployment.
- Android/iOS builds and device behavior were not run (web only, per the app
working agreement); source remains portable to both.
- No backend changes.
## Manager completion after the server evidence failure
The run ended with the server's re-saved-visit evidence bug (fixed and redeployed
separately). The retained tree is complete: 147 runs tests pass. Manager merged it
directly. The detail now owns Summary/Graph/Input/Output/Timeline tabs, renders the
run's pinned graph with the executed/not-executed legend, and a node click selects
the recorded visit and shows it in the timeline; an unvisited node reports nothing.