# R4 — recorded-visit pane ## Delivered The Timeline tab now opens a real recorded visit. Selecting a row, or clicking a visited stage in the Graph tab, shows that visit inside the Timeline tab: - **Facts** — the row's exact stage/visit title, then only the fields the reply recorded: Status, Outcome, Duration (only when both `started_at` and `finished_at` parse and the finish is not before the start), Provider/model (`provider / model`, or the one part recorded), Target, a recorded Verdict (option and reason) and the visit's Diagnostic. A blank field is absent, never `0`, `false`, `0s` or a guessed value. - **Native sections** — Input, Output, Artifacts, Session, Definition, using the Material segmented button or Cupertino segmented control. The strip scrolls rather than squeezing labels at 320/2x. - Input/Output use the run detail's existing field rendering and the exact empty sentences `No input recorded.` / `No output recorded.`. - Artifacts lists this visit's stage files (`visitArtifacts`, so a shared `public/` file stays with the visit that first recorded it) and opens the existing artifact gallery page for that visit. The page is given the whole run and the focused visit, so it lists exactly the rows the pane lists and keeps the run's own visit group. An empty list uses the landed per-visit capture wording (`Artifacts · capture pending` for a running visit, `Artifacts · capture unavailable` when the field is absent, `Artifacts · not recorded for this visit` only for an explicitly empty capture) and shows the partial-capture notes when the scan was bounded. - Session shows the recorded session identity and, when the visit exported one, `Open `. The recorded URL is resolved by the landed `resolveArtifactUrl` and opened through `openArtifactExternally`; a refusal or an unresolved relative URL is reported, never silently swallowed. The state comes from the recorded export evidence (including a repair), falls back to the legacy `session.html` system file web audit uses, and otherwise reports the recorded state in the web client's words: skipped, stopped, session being created, failed with its diagnostic, or the runtime error for a model visit with no identity. An export whose evidence is partial or failed stays openable and says so. - Definition embeds the landed `StageDefinitionView` for the run's own pinned graph and stage, so the authored prompt/output/outcomes/raw source show exactly as landed. When the reply does not declare the stage, the landed exact sentence `This stage is not declared in this pipeline version. No definition has been reconstructed.` is shown instead. - **Back** — `Back to timeline` (native back arrow / Cupertino chevron) closes the pane and restores the rows. The run header, Changes, Artifacts, Rename, Cancel, Retry and Decide actions are untouched and stay outside the tabs. - A different run clears the selection; an unvisited Graph node still opens nothing. ## Files Added: - `app/lib/features/runs/ui/run_detail_visit.dart` — pane layout, facts, verdict and diagnostic, Back. - `app/lib/features/runs/ui/run_detail_visit_facts.dart` — pure step lookup, duration/provider/model/verdict/definition facts, exact wording. - `app/lib/features/runs/ui/run_detail_visit_session_state.dart` — recorded session/export state: identity, repair/legacy export resolution and the state-specific wording. - `app/lib/features/runs/ui/run_detail_visit_sections.dart` — section enum, adaptive strip, section body selection. - `app/lib/features/runs/ui/run_detail_visit_artifacts.dart` — visit artifact rows opening the existing gallery entry. - `app/lib/features/runs/ui/run_detail_visit_session.dart` — session pointer and safe-link export open. - `app/lib/features/runs/ui/run_detail_visit_definition.dart` — pinned stage-definition pane or exact missing wording. - `app/test/features/runs/ui/run_detail_visit_support.dart`, `run_detail_visit_test.dart`, `run_detail_visit_sections_test.dart`, `run_detail_visit_session_test.dart`. - `app/tool/run_detail_visit_probe.dart`, `run_detail_visit_probe.mjs`. - `app/notes/R4-visit.md`. Changed (minimal wiring): - `run_detail_timeline.dart` — rows become selectable and report their index. - `run_detail_tabs.dart` — selected visit index opens the pane; Back closes it; Graph selection uses the latest recorded index. - `run_detail_view.dart`, `run_detail_material.dart`, `run_detail_cupertino.dart` — pass the configured endpoint for the session safe link; the endpoint cast now comes from `configuredGatewayEndpoint` in `core/transport/pipelines_client.dart`. - `run_detail_tab_strip.dart` — `ScrollWhenOverflowing` is public and shared by both tab strips, so the pointer-drag and minimum-width rules live once. - `lib/features/artifacts/domain/artifact_groups.dart` — `visitArtifactGroup` returns the gallery group of exactly one visit from the whole run. - `lib/features/artifacts/ui/artifact_gallery_page.dart`, `artifact_gallery_action.dart` — an optional focused visit limits the page to that visit's attributed group and summary; the run-level gallery is unchanged. - `run_detail_graph_tab_test.dart` — the stage-click expectation now asserts the opened pane and its facts (previous test asserted the row highlight). - `run_detail_graph_support.dart` — optional light/dark theme for 2x checks and an empty-tree reset so one test can pump a second run. - `run_detail_graph_probe.mjs` — the stage-click check now expects the pane and its sections; re-run once to keep the existing probe green. The artifact changes are the two focused-visit additions above: the run-level gallery, its viewer and its domain grouping are otherwise untouched. No `graph/`, `pipelines/`, `chat/`, `application/`, `schedules/`, `templates/` or backend file was edited. ## Checks run From `app/` with Flutter 3.44.6: - `flutter analyze` — no issues. - `flutter test` — **1014 tests passed** (full suite). - `flutter build web` — built `build/web`. - Probe builds: `flutter build web --target tool/run_detail_visit_probe.dart --output build/probe-run-detail-visit` and the existing `run_detail_graph_probe.dart` build both succeeded. - `node tool/run_detail_visit_probe.mjs` — passed for Material and Cupertino at 1280×900/1x dark and 320×568/2x dark: 9/9 checks and 8 captures each. - `node tool/run_detail_graph_probe.mjs` — Material 1280×900/1x dark re-run passed with the pane expectation. ## Browser evidence Probe drives the real `RunDetailView` over a server-shaped fake gateway (plan visit with provider/model, both timestamps, verdict, diagnostic, input/output, artifacts, session id + `session.html` export; a sparse build visit with no timestamps/provider/session). Checks: Graph stage click opens `plan · visit 1` with all five sections; Definition shows the pinned "Draft the plan." source; Session shows `sess-1` and `Open session.html`; Artifacts lists `plan.csv`; the row opens a gallery whose summary says `Artifacts · 1 recorded`, whose only group is `plan · visit 1` and whose only row is `plan.csv` (the `session.html` evidence file is absent); Back restores the rows; the sparse visit has no Duration or Provider/model and its Artifacts tab says `Artifacts · capture unavailable`. Under `/Users/alan/.local/share/pipelines/data/artifacts/95/public/r4-visit-fix/`: | Host | Viewport | Captures | | --- | --- | --- | | Material | 1280×900, dark, 1x | `run-detail-visit-material-dark-1x-1280x900-{visit-pane,definition,session,artifacts,timeline-rows,sparse-visit,sparse-artifacts,visit-gallery}.png` | | Material | 320×568, dark, 2x | `run-detail-visit-material-dark-2x-320x568-{visit-pane,definition,session,artifacts,timeline-rows,sparse-visit,sparse-artifacts,visit-gallery}.png` | | Cupertino | 1280×900, dark, 1x | `run-detail-visit-cupertino-dark-1x-1280x900-{visit-pane,definition,session,artifacts,timeline-rows,sparse-visit,sparse-artifacts,visit-gallery}.png` | | Cupertino | 320×568, dark, 2x | `run-detail-visit-cupertino-dark-2x-320x568-{visit-pane,definition,session,artifacts,timeline-rows,sparse-visit,sparse-artifacts,visit-gallery}.png` | Evidence JSON: `evidence-{material,cupertino}-{1x-1280x900,2x-320x568}.json`; each records 9 checks, all `true`, and the 8 captures above (32 PNGs). At 320/2x the run detail keeps its own 240px minimum tab body, so the visit facts area is a short scroll region; all facts remain reachable by scrolling and the section strip/body stay usable. No overflow or exception is reported. ## Review fixes (visit 2) - Artifact empty states now use the landed per-visit capture wording instead of one "nothing recorded" sentence; tests cover absent, explicitly empty and running captures. - The artifact row opens the gallery focused on the same visit with the whole run as context, so a shared `public/` file is not re-attributed. Tests cover two visits of one stage plus a repeated public file, asserting the pane and the opened page both exclude it. - Session resolution handles a repair and the legacy `session.html`, reports the evidence status/diagnostic when the file is missing, and uses the web client's state-specific sentences. Tests cover a legacy export, a running model visit and a failed one. - Advisory cleanups: shared `ScrollWhenOverflowing`, one timeline lookup for the latest visit, one endpoint helper, corrected stale selection comments and the added refusal test. ## Known gaps - The pane title and timeline rows still use the global recorded `sequence` (`plan · visit 5`), while the gallery group uses the per-stage visit number (`plan · visit 2`). This predates this pane; aligning the rows and pane would change the timeline titles and is recorded here rather than done. - At 320/2x the existing 240px minimum tab body leaves the facts area a short scroll region; all facts are reachable by scrolling and no overflow occurs. ## Not done / unverified - No commit, push, merge or deployment (this stage forbids it; the input's “commit the candidate” was not performed). - Web only. Android/iOS builds, layout and device behavior were not run; the source stays portable (Material/Cupertino only, no platform-only imports). - No backend changes. The pane reads only fields the existing `get_run` reply already carries; nothing new was requested from the server. ## Manager completion after the Code deadline The run had succeeded at Code once, been rejected at Review, and its retry hit the 30-minute stage deadline. The retained tree is complete: 280 runs/artifacts tests pass and analysis is clean. Merged directly. The only cross-feature edit is an 11-line `configuredGatewayEndpoint` helper in the transport so relative recorded artifact/session urls resolve against the configured origin without repeating a cast in the UI.