# P1 wire — Pipelines destination on the shared session ## Implemented - `lib/application/pipelines_destination.dart` registers the landed `PipelinesScreen` on the existing `/pipelines` route through `AppSession`. It reuses the session's single socket and gateway; no second connection, fake rows or hidden request path was added. - Before the first accepted connection the destination mounts no screen and sends no `list_pipelines`, `list_runs` or `get_pipeline`. The full gate says `Connecting to Pipelines…` or `Pipelines server unavailable`, with an explicit native `Retry` and the existing missing-endpoint explanation. - After the first connection the screen stays mounted through drops. A status banner reports `Reconnecting to Pipelines…`; a reconnect advances `syncToken`, and `PipelinesScreen.didUpdateWidget` calls the existing `controller.load()` so the list and the selected detail refresh in place. Selection (pipeline id and requested version) is preserved; there is no remount and no return to the empty list. - `PipelinesScreen` gained `embedded` and `syncToken`. Embedded mode skips its own Material `Scaffold`/`AppBar` or Cupertino `CupertinoPageScaffold`/ `CupertinoNavigationBar`, because the shell already owns the single bar. A native refresh action stays in the content (`IconButton`/`CupertinoButton` with the same `Refresh` wording), using the real host selection. - The connection gate and banner moved verbatim from `runs_destination.dart` to `lib/application/connection_status.dart`, so Runs and Pipelines share one implementation and one wording. Runs behavior is unchanged. - Registration is a tiny entry in the existing `destinationBodies` map in `lib/application/pipelines_app.dart`. - No graph rendering, actions, templates, schedules, route expansion, native control replacement, fixed component size/font/colour override, server, web, legacy, Android or pubspec change was made. Graph still shows `Graph rendering is pending (P2).` ## Files Production: - `lib/application/connection_status.dart` (new, moved shared chrome) - `lib/application/pipelines_destination.dart` (new) - `lib/application/pipelines_app.dart` (registration and import) - `lib/application/runs_destination.dart` (uses the shared chrome) - `lib/features/pipelines/screen.dart` (embedded framing, content refresh, reconnect sync token) Tests: - `test/application/pipelines_destination_test.dart` (new) - `test/application/pipelines_registration_test.dart` (new) - `test/application/pipelines_replies.dart` (new serialized reply helper) - `test/application/pipelines_app_test.dart` (route now renders the real list) - `test/application/settings_registration_test.dart` (answers the mounted Pipelines reads before visiting Settings) - `test/features/pipelines/pipelines_screen_test.dart` (embedded framing and content refresh) Browser tooling (isolated, pure loopback fixtures): - `tool/pipelines_wiring_probe_entry.dart` — exact `runPipelinesApp()` composition - `tool/pipelines_wiring_probe_server.mjs` — static bundle plus loopback websocket fixture with drop/refuse/accept/state endpoints - `tool/pipelines_wiring_probe.mjs` — real Chrome DevTools probe ## Checks actually run | Check | Result | | --- | --- | | `flutter analyze` | `No issues found!` | | `flutter test` | **595 passed** | | `flutter test test/application` | **33 passed** | | `flutter test test/features/pipelines` | **49 passed** | | `flutter test test/features/pipelines/pipelines_screen_test.dart` | **6 passed** | | `dart format --output=none --set-exit-if-changed lib test tool/pipelines_wiring_probe_entry.dart` | 273 files, 0 changed | | `node --check` on both probe scripts | passed | | `flutter build web` (default `lib/main.dart`) | `✓ Built build/web` | | `flutter build web -t tool/pipelines_wiring_probe_entry.dart` | `✓ Built` | | `node tool/pipelines_wiring_probe.mjs ` | exit 0, 25 checks, 9 captures, `probe.json` has no error | Coverage added: - missing native endpoint never opens a socket; - connecting gate sends no list request; the screen mounts only after the shared socket accepts; - refused first connection is friendly, names no transport exception and offers Retry; - a drop retains the loaded rows and detail, then reconnect re-reads list and the open detail without losing the selected row; - the registered `/pipelines` route renders real rows, detail content hash and source with exactly one Material or Cupertino bar, one socket; - Cupertino host builds no `Material` widget; - embedded framing adds no second bar and keeps a working content Refresh. ## Browser evidence (real Chrome, normal composition) Directory: `/Users/alan/.local/share/pipelines/data/artifacts/69/public/p1-wire-captures` - `01-gate-refused-material.png` — first connection refused: honest gate, `Retry`, shell nav present, zero list requests recorded by the fixture. - `02-list-material.png` — Material shell below its single bar with the real `Release verification` / `Nightly documentation` rows. - `03-detail-material.png` — selected pipeline Summary with `sha256:fixture-3-v3`, versions and metadata. - `04-source-material.png` — Source tab with the real fixture source text. - `05-drop-detail-retained-material.png` — socket dropped: `Reconnecting to Pipelines…` banner while the open detail stays visible at `/pipelines`. - `06-reconnect-detail-refreshed-material.png` — after Retry: banner gone, list and open detail re-read (fixture counters advanced for `list_pipelines` and `get_pipeline`), same selection. - `07-list-cupertino-dark.png` — macOS/dark host: Cupertino global bar and tab bar, inset grouped rows, `Release verification` present. - `08-detail-cupertino-dark.png` — Cupertino dark detail with content hash, versions and native segmented tabs. - `09-source-cupertino-dark.png` — Cupertino dark Source with source text. - `probe.json` — fixture URL, 25 checks, captures and final counters. The probe starts the fixture with websocket upgrades refused, asserts the gate and that `listPipelines`, `listRuns` and `getPipeline` are all 0, then accepts and drives the normal app. Hosts are selected through the browser platform user agent (Linux for Material, macOS for Cupertino), which is what the normal composition reads. OCR asserts the real row, content hash and source; the captures were inspected to confirm one bar and Cupertino dark styling. Reproduce: ```sh flutter build web -t tool/pipelines_wiring_probe_entry.dart -o node tool/pipelines_wiring_probe.mjs ``` ## Explicitly not done / unverified - Graph rendering and graph nodes/edges remain P2; the existing pending notice is unchanged. - No action, template, schedule, route expansion or navigation redesign. - No production server, real operator chat/run or authenticated preview was touched; all browser data comes from the isolated loopback fixture. - Android and iOS were not built, installed or run; mobile remains unverified. - No push, deployment or preview-service change was made. The Land stage committed the reviewed candidate on `flutter/p1-wire` and merged `main` into it (see Landing below). - No Material/Cupertino fixed sizes, palette or font overrides were added. The only fixed breakpoint remains the existing `kPipelinesWideBreakpoint`. ## Diff Tracked changes (`git diff --numstat`): ``` 3 0 app/lib/application/pipelines_app.dart 4 184 app/lib/application/runs_destination.dart 57 16 app/lib/features/pipelines/screen.dart 26 5 app/test/application/pipelines_app_test.dart 3 0 app/test/application/settings_registration_test.dart 26 0 app/test/features/pipelines/pipelines_screen_test.dart ``` New files: `connection_status.dart` (195), `pipelines_destination.dart` (61), three test files and three probe files. Net production change is ~120 added lines after moving the shared chrome out of `runs_destination.dart`. ## Landing - Committed the reviewed work as `8476cfd7 feat(app): wire the native pipelines browser on the shared session` (15 paths, no unrelated files). - Merged local `main` (`7be4456f`) into `flutter/p1-wire` with no conflicts; the merge brought in the native run rename work only (`app/WORK.md`, `lib/features/runs/**`, `notes/R2-title-wire.md`, its tests and probe). - Post-merge checks on the merged candidate: `flutter analyze` clean, `flutter test` **599 passed**, `dart format` 274 files 0 changed, `node --check` on both probe scripts, `flutter build web` built, and the Chrome wiring probe again reported **25 checks, 9 captures**, no error, final `{subscribed:3, listPipelines:3, listRuns:3, getPipeline:3, dropped:1, connections:1}`. The 595 in the table above is the pre-merge branch count; the extra 4 tests are the merged rename coverage.