From 7e8e09d36913e5c645335b7ee5d5b17943427201 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Mon, 19 Oct 2026 16:01:27 +0100 Subject: [PATCH 1/6] web: README for the finished client, not the spike Describes what the client is, how to run and test it (OS-assigned smoke port, gitignored captures), the module areas, and keeps the 403/proxy explanation that justifies serving the page from serve.mjs. --- web/README.md | 223 ++++++++++++++++++++++---------------------------- 1 file changed, 96 insertions(+), 127 deletions(-) diff --git a/web/README.md b/web/README.md index 4a545bdd..1b507ee1 100644 --- a/web/README.md +++ b/web/README.md @@ -1,75 +1,95 @@ -# Pipelines web spike (Route B) +# Pipelines web client -A throwaway, dependency-free browser client that proves the Pipelines -**WebSocket protocol works from a web page** end to end. It is a spike, not a -product: it renders a pipeline list and a run detail and nothing else. +The browser client for the Pipelines server: the Android app's feature set, +rendered for the web, against the same WebSocket protocol and the same words. +`web/PARITY.md` is the acceptance checklist and the single source of truth for +what is done; this file covers how to run, test and verify it. -This directory is deliberately **separate from `android/`** and does not touch -it. The Android app remains the Kotlin/Compose client. - -## Why this route - -Two ways to expose the app as a web app were considered: - -- **Route A — Compose Multiplatform Web (WASM):** reuse the Kotlin protocol - layer and Compose UI. Most code reuse, but needs the Kotlin/WASM toolchain. -- **Route B — browser-native client (this spike):** a small JS app using the - browser's native `WebSocket`. No toolchain, browser-native behaviour, and it - can be verified against a live server immediately. - -This spike is Route B. The `android/` protocol models were the spec: the wire -format, server-URL rules and reply matching here mirror -`android/app/src/main/java/net/awan/pipelines/data/`. +- **Dependency-free.** Plain ES modules in the browser, hand-written CSS. No + framework, no bundler, no build step, no npm install. +- **Browser-native transport.** The page opens one `WebSocket` to `/connect`, + matched by request id, with the same server-URL rules as the Android client. +- **Verified in a real browser.** UI claims are backed by PNGs captured from + headless Chrome against a live server (`test/ui-smoke.mjs`); a unit test alone + never marks a parity row done. ## Safety (unchanged from the Android client) - **Trusted LAN/VPN only.** The Pipelines API has **no authentication** and is - **not internet-safe**. Do not expose the server to untrusted networks. A web - page widens that surface: any tab can open the socket. -- **No secrets.** Nothing is stored except the server URL, in `localStorage`. -- **No hardcoded server.** The URL is entered by the user; there is no default - address baked in. - -## Layout - -| File | Android counterpart | Notes | -| --- | --- | --- | -| `src/protocol.js` | `data/protocol/Message.kt` (constants) | types + `#success`/`#failure` | -| `src/serverUrl.js` | `data/transport/ServerUrl.kt` | `validateServerUrl`, `resolveArtifactUrl` | -| `src/client.js` | `data/transport/PipelinesClient.kt` | one reused socket, id matching, backoff. DOM-free | -| `src/repository.js` | `data/PipelinesRepository.kt` | typed request builders | -| `src/app.js` | `ui/**` | DOM UI: pipeline list + run detail | -| `serve.mjs` | — | zero-dep static server | -| `test/*.test.mjs` | `app/src/test/**` | `node --test` | -| `test/smoke.mjs` | — | live end-to-end against a running server | -| `test/browser.mjs` | — | zero-dependency Chrome DevTools driver | -| `test/ui-smoke.mjs` | UI review captures | live browser check; writes screenshots | -| `PARITY.md` | `android/` feature set | the acceptance checklist | -| `AGENTS.md` | `android/AGENTS.md` | the area map for this workstream | - -`client.js` is DOM-free on purpose, so the smoke test drives the **same** -transport module the page uses. + **not internet-safe**. Do not expose the server or this page to untrusted + networks. +- **No secrets.** The page stores only the server URL and its own small UI + preferences (sort/filter choices, attention dismissals, device-local chat + overrides) in `localStorage`; nothing is sent anywhere but the configured + server. +- **No hardcoded server.** The URL is entered by the user, prefilled from the page + origin, and can be overridden. ## Run it ```sh cd web -node serve.mjs # http://127.0.0.1:8090/ -node serve.mjs --host 0.0.0.0 # reachable from other devices (trusted LAN/VPN) +node serve.mjs # http://127.0.0.1:8090/ (proxies /connect -> 127.0.0.1:8080) +node serve.mjs --host 0.0.0.0 # reachable from other devices (trusted LAN/VPN) +node serve.mjs --port 8095 --pipelines 127.0.0.1:8080 ``` -`serve.mjs` both serves the page and **proxies `/connect`** to the Pipelines -server (`--pipelines 127.0.0.1:8080` by default), so the page and the WebSocket -are one origin. The page defaults its URL field to `ws:///connect` -(the proxy) — just press **Connect**. Nothing is hardcoded: the default is derived -from wherever the page was loaded and can be overridden. +The page prefills its URL field with `ws:///connect` — the +proxy — so the usual flow is: open the page, press **Connect**. Nothing is baked +in. -### Why the page cannot connect directly (`403`) +On a deployment where ntfy already uses 8090, pick another port for the page +(e.g. `--port 8095`). The page is a foreground Node process, not a service. -`internal/server/websocket.go` calls `websocket.Accept(w, r, nil)` — -`github.com/coder/websocket` — which **rejects an upgrade whose `Origin` host -does not match the request `Host`**. A browser page served from `:8090` opening -`ws://HOST:8080/connect` sends `Origin: http://HOST:8090` and is refused: +## Test it + +```sh +cd web +node --test test/ # unit tests, no server +PIPELINES_WS_URL=ws://127.0.0.1:8080/connect node test/smoke.mjs # protocol, live +node test/ui-smoke.mjs --out /path/to/captures # browser, live, screenshots +``` + +`node --test` covers the ported URL rules, the transport, and the pure feature +logic (filters, sorting, diffs, graph layout, markdown, chat folding, routing, +attention, alerts). It needs no server. + +`smoke.mjs` drives the real client against a running server: `ping`, +`list_pipelines`, `list_runs`, `get_pipeline`, `get_run`, artifact `HEAD`. + +`ui-smoke.mjs` starts `serve.mjs` on an **OS-assigned free port** (so concurrent +checks never collide), launches the installed Chrome headless, drives the real +page and writes PNGs. **That is the UI evidence**: a review reports capture paths, +not what it thinks would render. Set `CHROME_PATH` if Chrome is not at the +default macOS location, and use `--port`/`WEB_UI_PORT` to pin a port. + +Captures are deliberately gitignored: they are review evidence, not source, and +keeping them out of the tree keeps a delivery checkout clean. + +## Layout + +| Area | Where | +| --- | --- | +| Wire protocol, URL rules | `src/protocol.js`, `src/serverUrl.js` | +| Transport (DOM-free, reused by the smoke test) | `src/client.js` | +| Typed requests | `src/repository.js` | +| Feature logic and models | `src/runs.js`, `src/runDetail.js`, `src/changes.js`, `src/artifacts.js`, `src/pipelines.js`, `src/templates.js`, `src/graph.js`, `src/chat.js`, `src/markdown.js`, `src/search.js`, `src/attention.js`, `src/actions.js`, `src/connection.js`, `src/settings.js`, `src/notify.js`, `src/runEvents.js`, `src/routes.js` | +| Shell and views | `src/app.js` (boot, state, navigation, render dispatch), view modules under `src/views/` | +| Styling | per-area stylesheets linked from `index.html` | +| Server + `/connect` proxy | `serve.mjs` | +| Tests | `test/*.test.mjs`, `test/smoke.mjs`, `test/browser.mjs`, `test/ui-smoke.mjs` | +| Acceptance gate | `PARITY.md` | +| Working map | `AGENTS.md` | + +Keep `client.js` DOM-free: the smoke test and the page must drive the same +transport module. Every server-derived string is set with `textContent`, never +`innerHTML` — the transcript and diffs are untrusted model output. + +## Why the page connects through `serve.mjs`, not the server directly + +`internal/server/websocket.go` calls `websocket.Accept(w, r, nil)`, which rejects +an upgrade whose `Origin` host does not match the request `Host`. A page served +from port 8090 opening `ws://HOST:8080/connect` is refused with **403**: ``` HTTP/1.1 403 Forbidden @@ -77,77 +97,26 @@ request Origin "HOST:8090" is not authorized for Host "HOST:8080" ``` A Node or `curl` client sends no `Origin` and is accepted — which is why the -smoke test passes while a browser does not. The proxy sidesteps this by making -the page same-origin and dropping the `Origin` header on the way through (the -server has no authentication, so nothing is lost). Any web client that is served -from a different origin than the Pipelines server hits this same 403. +protocol smoke can pass while a browser cannot. `serve.mjs` therefore also proxies +`/connect`, dropping `Origin`, so the page and the socket are one origin. + +**Do not "fix" this by relaxing the server's Origin check** — that check is the +only thing between a random web page and an unauthenticated control API. Keep the +proxy. To open the page from another device, bind `--host 0.0.0.0` and use this -machine's Tailscale/LAN address for the page only, e.g. -`http://100.85.25.33:8090/`, then press Connect (the field already holds -`ws://100.85.25.33:8090/connect`). Both hops are plaintext, so there is no -mixed-content block; only do this on a trusted tailnet/VPN. +machine's LAN or Tailscale address for the page (e.g. +`http://100.85.25.33:8095/`), then press Connect. Both hops are plaintext, so +there is no mixed-content block; only do this on a trusted tailnet/VPN. -## Test it +## Verification notes -```sh -cd web -node --test test/ # unit tests, no server -PIPELINES_WS_URL=ws://127.0.0.1:8080/connect node test/smoke.mjs # live -``` - -`node --test` covers the ported URL validation/artifact resolution and the -transport (id matching, serialization order, error replies, timeouts, -not-connected guard, reconnect). `smoke.mjs` connects to a real server and runs -`ping`, `list_pipelines`, `list_runs`, `get_pipeline`, `get_run`, and (when the -newest run has artifacts) an artifact `HEAD`. - -## Verification status - -Run on macOS with Node v26.9.0 against a live `pipelines` server on -`ws://127.0.0.1:8080/connect`: - -- `node --test test/` → **20 tests, 0 failures.** -- `node test/smoke.mjs` → **SMOKE PASS (6 checks)**: websocket connected, - `ping -> pong`, `list_pipelines -> 14 pipelines`, `list_runs -> 189 runs`, - `get_pipeline #1`, `get_run #189`. No artifact fetch (that run had none). -- `node --check` parses every source and test file. -- `serve.mjs` serves `/`, `index.html`, `styles.css` and each `src/*.js` with the - right content type (200); `/favicon.ico` is 204; `/nope.js` is 404; with - `curl --path-as-is` no raw `..` path escapes `web/` (traversal attempts either - serve a file inside `web/` or 404). - -The cross-origin `403` and the proxy fix were verified on macOS against the live -server (`ws://100.85.25.33:8080/connect`): - -- Direct handshake with `Origin: http://100.85.25.33:8090` → `HTTP/1.1 403 - Forbidden` (`request Origin "100.85.25.33:8090" is not authorized for Host - "100.85.25.33:8080"`); the same handshake without `Origin` → `101 Switching - Protocols`. -- Through the proxy (`:8090`) with the same browser `Origin` → `101 Switching - Protocols`. -- `PIPELINES_WS_URL=ws://100.85.25.33:8090/connect node test/smoke.mjs` → - **SMOKE PASS (6 checks)** — a full request/reply session over the tunnel. - -**Not verified:** `wss://`/TLS (no TLS server was available) and multiple concurrent -browser tabs. - -### Rendered-page verification (2026-10-19) - -The gap above is closed: `node test/ui-smoke.mjs` launches the installed Chrome -headless through the zero-dependency DevTools driver (`test/browser.mjs`), serves -the page, connects it through the proxy, and captures what actually rendered. -Against the live server it rendered **29 pipelines**, opened a pipeline detail and -a run detail, and wrote three PNGs. Flow: web → connect → pipeline list → pipeline -detail → Runs tab → run detail, all with real clicks. - -```sh -cd web -node test/ui-smoke.mjs --out /tmp/web-ui # needs a running Pipelines server -``` - -## Next step - -Feature parity with the Android app is tracked in **`PARITY.md`**; that table is -the acceptance gate (a row is only `done` with a captured browser E2E). Work is -planned as small items, one per row or tight group of rows. +- The browser is the gate, never a phone or emulator. No ADB, no device. +- Artifact URLs resolve against the configured server (`resolveArtifactUrl`); the + page opens them in a tab rather than embedding an Android WebView. +- Where the browser genuinely cannot match Android (system-tray notifications need + a secure context; `pipelines://` links become URL routes), the parity row says + so instead of pretending otherwise. +- Feature checks that create server state (a chat, a pipeline) either use a + scratch server or the server's explicit ephemeral flag, so verification never + leaves clutter in the operator's lists. From dc5798706cd520ca81b069f31f4d6db169acddce Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Mon, 19 Oct 2026 16:05:18 +0100 Subject: [PATCH 2/6] web: capture-set comparator for behaviour-preserving refactors --compare BEFORE AFTER fails when a capture is missing or unexpected and lists pixel drift for manual review; live durations make byte equality the wrong gate. --- web/AGENTS.md | 8 ++- web/test/capture-manifest.mjs | 96 +++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 web/test/capture-manifest.mjs diff --git a/web/AGENTS.md b/web/AGENTS.md index dcdca318..7dd601f1 100644 --- a/web/AGENTS.md +++ b/web/AGENTS.md @@ -59,7 +59,13 @@ node test/ui-smoke.mjs --out /path/to/run/artifacts # browser, live, scree ``` `ui-smoke.mjs` starts `serve.mjs`, launches the installed Chrome headless, drives -the real page and writes PNGs into `--out`. **That is the UI evidence**: a review +the real page and writes PNGs into `--out`. It picks a free port unless one is +given, so concurrent checks never collide. + +`capture-manifest.mjs` compares two capture directories. A behaviour-preserving +refactor must keep the same capture SET; `--compare BEFORE AFTER` exits non-zero +when a capture is missing or unexpected and lists the files whose pixels drifted +(live durations legitimately change bytes, so inspect that list by eye). **That is the UI evidence**: a review stage must run it (or an extension of it) and report the capture paths, not describe what it thinks would render. Set `CHROME_PATH` if Chrome is not at the default macOS location. diff --git a/web/test/capture-manifest.mjs b/web/test/capture-manifest.mjs new file mode 100644 index 00000000..cdc37bf2 --- /dev/null +++ b/web/test/capture-manifest.mjs @@ -0,0 +1,96 @@ +// Compare two ui-smoke capture directories. +// +// node test/capture-manifest.mjs DIR # manifest: name, bytes, sha256 +// node test/capture-manifest.mjs --compare BEFORE AFTER +// +// A refactor that must not change behaviour has to produce the SAME capture set: +// every screen the check drove before must still be captured after. Pixel bytes +// legitimately drift on a live server (durations, "x minutes ago", run counts), so +// the gate is the SET, with the differing files listed for a human to inspect: +// +// exit 0 same capture set (drift printed for review) +// exit 1 a capture is missing or unexpected (a screen stopped being driven) +// +// Zero dependencies, no server needed. +import { createHash } from "node:crypto"; +import { readdir, readFile, stat } from "node:fs/promises"; +import { basename, resolve } from "node:path"; + +async function manifest(directory) { + const dir = resolve(directory); + const entries = await readdir(dir).catch(() => { + throw new Error(`no such capture directory: ${dir}`); + }); + const files = entries.filter((name) => name.toLowerCase().endsWith(".png")).sort(); + const rows = []; + for (const name of files) { + const path = `${dir}/${name}`; + const info = await stat(path); + const bytes = await readFile(path); + rows.push({ + name, + bytes: info.size, + sha: createHash("sha256").update(bytes).digest("hex").slice(0, 16), + }); + } + return { dir, rows }; +} + +function printManifest({ dir, rows }) { + console.log(`# ${dir} — ${rows.length} capture(s)`); + for (const row of rows) console.log(`${row.name}\t${row.bytes}\t${row.sha}`); +} + +async function compare(beforeDir, afterDir) { + const before = await manifest(beforeDir); + const after = await manifest(afterDir); + const beforeNames = new Set(before.rows.map((row) => row.name)); + const afterNames = new Set(after.rows.map((row) => row.name)); + const missing = [...beforeNames].filter((name) => !afterNames.has(name)).sort(); + const extra = [...afterNames].filter((name) => !beforeNames.has(name)).sort(); + const beforeByName = new Map(before.rows.map((row) => [row.name, row])); + const drift = []; + for (const row of after.rows) { + const prior = beforeByName.get(row.name); + if (!prior || prior.sha === row.sha) continue; + drift.push({ name: row.name, before: prior.bytes, after: row.bytes, delta: row.bytes - prior.bytes }); + } + console.log(`before: ${before.dir} — ${before.rows.length} capture(s)`); + console.log(`after: ${after.dir} — ${after.rows.length} capture(s)`); + console.log(`same set: ${missing.length === 0 && extra.length === 0 ? "yes" : "NO"}`); + if (missing.length) console.log(`missing after: ${missing.join(", ")}`); + if (extra.length) console.log(`unexpected after: ${extra.join(", ")}`); + console.log( + `pixel drift: ${drift.length} capture(s)` + + (drift.length ? " — inspect these for real visual changes:" : ""), + ); + for (const row of drift) console.log(` ${row.name} ${row.before} -> ${row.after} bytes (${row.delta >= 0 ? "+" : ""}${row.delta})`); + if (missing.length || extra.length) process.exitCode = 1; +} + +import { pathToFileURL } from "node:url"; +const runAsScript = + process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href; +const [first, second, third] = process.argv.slice(2); +if (!runAsScript) { + // Imported as a module (for example from a test): no CLI side effects. +} else if (first === "--compare") { + if (!second || !third) { + console.error("usage: node test/capture-manifest.mjs --compare BEFORE_DIR AFTER_DIR"); + process.exit(2); + } + compare(second, third).catch((error) => { + console.error(error.message); + process.exit(2); + }); +} else if (first) { + manifest(first).then(printManifest).catch((error) => { + console.error(error.message); + process.exit(2); + }); +} else { + console.error("usage: node test/capture-manifest.mjs DIR | --compare BEFORE AFTER"); + process.exit(2); +} + +export { compare, manifest }; From 7ec2ef5c7c9dd2ce094bacd8f09c00bb05bf5965 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Mon, 19 Oct 2026 16:05:56 +0100 Subject: [PATCH 3/6] web: wait for C2's created conversation instead of sampling it The created chat loads its history asynchronously; reading the DOM once raced the load (worse when the OpenCode endpoint is busy), reporting a permanent 'Loading conversation...' that the app never showed. --- web/test/ui-smoke.mjs | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/web/test/ui-smoke.mjs b/web/test/ui-smoke.mjs index 0478b5a6..9c28269f 100644 --- a/web/test/ui-smoke.mjs +++ b/web/test/ui-smoke.mjs @@ -3094,20 +3094,30 @@ try { { timeout: 30000, what: "the C2-created session to be selected" }, ); createdSessionId = createdId; - const created = await page.evaluate(`(() => { - const rows = [...document.querySelectorAll("#chatRows .chat-row")]; - const row = document.querySelector('.chat-row[data-session="${createdId}"]'); - return { - first: rows[0]?.dataset.session ?? "", - title: row?.querySelector(".chat-row-title")?.textContent ?? "", - selected: row?.classList.contains("selected") ?? false, - closed: !!row?.querySelector(".chat-closed-chip"), - header: document.querySelector(".chat-bar-title")?.textContent ?? "", - empty: document.querySelector(".chat-detail .chat-transcript-empty")?.textContent ?? "", - composer: !!document.querySelector("#chatComposer"), - pickerGone: !document.querySelector(".chat-create"), - }; - })()`); + // The created conversation loads its history asynchronously; sample it only once + // it has settled (a loaded OpenCode endpoint can take a few seconds). + const created = await eventually( + () => + page + .evaluate(`(() => { + const rows = [...document.querySelectorAll("#chatRows .chat-row")]; + const row = document.querySelector('.chat-row[data-session="${createdId}"]'); + return { + first: rows[0]?.dataset.session ?? "", + title: row?.querySelector(".chat-row-title")?.textContent ?? "", + selected: row?.classList.contains("selected") ?? false, + closed: !!row?.querySelector(".chat-closed-chip"), + header: document.querySelector(".chat-bar-title")?.textContent ?? "", + empty: document.querySelector(".chat-detail .chat-transcript-empty")?.textContent ?? "", + composer: !!document.querySelector("#chatComposer"), + pickerGone: !document.querySelector(".chat-create"), + }; + })()`) + .then((value) => + value.empty === "This chat has no messages yet. Ask something below." ? value : false, + ), + { timeout: 30000, what: "the created chat's empty conversation to load" }, + ); const createBodies = await page.evaluate(`window.__chatCreateBodies || []`); if (createBodies.length !== 1) { throw new Error(`C2 sent ${createBodies.length} chat_create request(s) for one create`); From 2deaaea05af10f726f2a41c44e9a8237b35bbb7f Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Mon, 19 Oct 2026 16:16:05 +0100 Subject: [PATCH 4/6] web: exercise the human decision sheet live (R11) Add an opt-in --decide smoke mode that reuses or submits a human-only pipeline, starts two runs in throwaway workspaces, and presses the real card, sheet and Confirm for the feedback and no-feedback shapes. Record R11 as done with the live captures. --- web/PARITY.md | 10 +- web/test/ui-smoke.mjs | 452 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 450 insertions(+), 12 deletions(-) diff --git a/web/PARITY.md b/web/PARITY.md index 43cc890d..9e5e8be4 100644 --- a/web/PARITY.md +++ b/web/PARITY.md @@ -41,7 +41,7 @@ Status legend: `todo` · `partial` (some of it works) · `done` (working + captu | R8 | Artifacts gallery + full-screen viewer (images inline, others download/open) | `GET /artifacts/…` | done (captured 2026-10-19: `captures/04-run-430-artifacts.png`, `captures/05-artifact-viewer.png`) | | R9 | Session export link (read-only `session.html`) | `GET /artifacts/…` | done (captured 2026-10-19: `captures/06-session-export-link.png`) | | R10 | Live run updates: subscribe/unsubscribe + event fold | `subscribe`, `unsubscribe`, `run_event` | done — one app-wide watch owned by the connection, never by a screen: becoming connected best-effort `unsubscribe`s the previous watch, sends `{type:'subscribe',workspace:''}` send-only (no `run_ids`; `{type:'unsubscribe'}` drops it), then takes one authoritative resync (`list_runs`, plus one `get_run` when a run detail is open); a socket drop clears the watch and no screen change ever unsubscribes. `src/runEvents.js` is the pure fold ported from `ui/RunEvents.kt` (in-place list update preserving order, insert-at-head from the frame's pipeline identity, `needsResync` without identity, detail merge with explicit `resource_wait` set/clear, one step matched by `sequence` and inserted in sequence order, the monotonic run/step ladders and the full-sync decision) and is unit-tested in `test/runEvents.test.mjs`; the send-only path (`src/client.js#sendOnly`), the exact watch frames (`src/repository.js`) and the `run_event`/unsolicited-frame dispatch are unit-tested in `test/client.test.mjs` and `test/repository.test.mjs`. The 1 s run-detail poll is removed — pushed frames drive the detail and a settled/terminal frame triggers one coalesced `get_run` (at most one in flight per kind plus one queued follow-up, retried at 500 ms × attempt at most 3 times before the badge drops to `reconnecting`); the only surviving intervals are render-only clocks. The badge is the explicit stream state (`live` / `reconnecting` / `not live`, LiveBadge.kt words), independent of whether a run is executing, on the Runs list and the run detail. Captured 2026-10-19 against the live server with a **real pushed run** started by the smoke in a throwaway workspace: `captures/75-run-live-list.png` (the new run's row inserted from its own frame, badge `live`), `captures/76-run-live-detail.png` (the open detail folded to `running` from pushes, badge `live`) and `captures/77-run-live-terminal.png` (the pushed terminal fold to `canceled`, no poll), plus the reachable badge states `captures/28-connected-banner.png` (live), `captures/29-disconnected-banner.png` (not live while idle; reconnecting while the socket retries) and `captures/30-reconnect-recovered.png` (live again). `test/ui-smoke.mjs` asserts the reconnect wire order (unsubscribe → subscribe blank-workspace → list_runs) and that at least one genuine `run_event` frame for the started run arrived. The R10 step itself passes on every run; the full smoke can still fail later in unrelated, pre-existing steps on the shared live server (observed after the main merge: a flaky L1 stale page-level error on one run, a C5 chat fold `expected at least one folded agent turn, got 0` on another, and a C8 composer assertion while the operator's live chat session was streaming, so the composer correctly showed Stop; the focused `--notify` run is `UI SMOKE PASS`), which is not an R10 defect. | -| R11 | Human decision sheet: prompt, options, feedback | `decide_run` | partial — the pure model (`src/actions.js`: `pendingDecision`, `lastWaitingStep`, `waitingPrompt`/`waitingOptions`, `humanOptions`, `decisionTargetLabel`, `DecisionDraft`) and the card + sheet are implemented with the Android copy verbatim: card title `Waiting for your decision`, meta `{stage} · run {id} · {runLabel}`, action `Decide`; sheet title `Decide {stage}`, meta `run {id} · {runLabel}`, the recorded instructions verbatim when non-blank, one selectable row per option in author order showing the option and `→ {target}` only when the declared edge resolves, the `Feedback (optional)` field, and `Cancel` / `Confirm decision` (reading `Sending…` while in flight). Selecting a row sends nothing and Confirm is disabled until a non-blank option is chosen; a refusal keeps the sheet open with the server's exact reason and re-reads the run. The request shape is unit-tested (`decide_run` = `{type, run_id, option, stage?, feedback?}`, stage/feedback omitted when blank, feedback trimmed). **No browser capture yet**: the live server had no `waiting` run when `ui-smoke.mjs` ran (only executing/failed/finished runs), so this row stays `partial`; `test/ui-smoke.mjs` now captures the card, the sheet and the selected state automatically (`captures/41-run--decision-card.png`, `captures/42-run--decision-sheet.png`, `captures/43-run--decision-selected.png`) the moment a waiting run exists | +| R11 | Human decision sheet: prompt, options, feedback | `decide_run` | done — the pure model (`src/actions.js`: `pendingDecision`, `lastWaitingStep`, `waitingPrompt`/`waitingOptions`, `humanOptions`, `decisionTargetLabel`, `DecisionDraft`) and the card + sheet are implemented with the Android copy verbatim: card title `Waiting for your decision`, meta `{stage} · run {id} · {runLabel}`, action `Decide`; sheet title `Decide {stage}`, meta `run {id} · {runLabel}`, the recorded instructions verbatim when non-blank, one selectable row per option in author order showing the option and `→ {target}` only when the declared edge resolves, the `Feedback (optional)` field, and `Cancel` / `Confirm decision` (reading `Sending…` while in flight). Selecting a row sends nothing and Confirm is disabled until a non-blank option is chosen; a refusal keeps the sheet open with the server's exact reason and re-reads the run. The request shape is unit-tested (`decide_run` = `{type, run_id, option, stage?, feedback?}`, stage/feedback omitted when blank, feedback trimmed). **Live, end to end (2026-10-19)**: `test/ui-smoke.mjs` gained an explicit `--decide` mode (the only mode allowed to submit). It reused the entry-stage human-only pipeline submitted create-only as `Web R11 decision 2026-10-19T14-59-18-785Z` (id 30: one `type=human` `gate` stage, `approve -> #success`, `hold -> #success`, `error -> #failure`, so no model stage runs) and started two runs in separate fresh temp workspaces. Run 513 parked in `waiting`; the browser asserted the card (`Waiting for your decision`, `gate · run 513 · Web R11 decision 1 (feedback)`, `Decide`), opened the sheet (`Decide gate`, `run 513 · …`, the recorded instructions `R11 live decision: review the run and choose approve or hold.`, `approve`/`hold` in author order each with `→ SUCCESS`, `Feedback (optional)`, Confirm disabled), selected `approve` (still no `decide_run`, and the run was still `waiting` via `pipelines inspect`), typed feedback, and pressed `Confirm decision`: exactly one frame `{"type":"decide_run","run_id":513,"option":"approve","stage":"gate","feedback":"Approved in the live browser decision sheet."}` was sent, the run left `waiting`, resumed and reached `succeeded`. Run 514 proved the no-feedback shape: selecting `hold` sent nothing, Confirm sent `{"type":"decide_run","run_id":514,"option":"hold","stage":"gate"}` with **no** `feedback` key, the run reached `succeeded`, its recorded feedback is blank and its verdict carries no reason. Captured: `captures/41-run-513-decision-card.png` (waiting card), `captures/42-run-513-decision-sheet.png` (open sheet with the options), `captures/43-run-513-decision-selected.png` (selected + feedback, Confirm enabled), `captures/44-run-513-decision-confirmed.png` (resumed detail, `succeeded`), `captures/45-run-513-decision-verdict.png` (`gate · visit 1` Verdict chip `approve → success` and the exact reason), and the no-feedback path `captures/46-run-514-decision-card.png`, `captures/47-run-514-decision-sheet.png`, `captures/48-run-514-decision-selected.png`, `captures/49-run-514-decision-confirmed.png`, `captures/50-run-514-decision-verdict.png` (`hold → success`, no reason). Command: `cd web && node test/ui-smoke.mjs --decide --out "$PWD/captures"` → `UI SMOKE PASS` (the reused pipeline means no new submit on the capture run); `cd web && node --test test/` stays green. Both runs are terminal, no R11 run remains active and both temp workspaces were removed. The submitted definition is intentionally retained and named here; no operator pipeline, version, run, chat or repository was modified | | R12 | Cancel run | `cancel_run` | done — `src/actions.js` `canCancel` offers a `Cancel run` action only while the run is `executing`; the confirm dialog is the Android copy verbatim (title `Cancel run {id}?`, `This asks the server to stop the active run.`, confirm `Cancel run`, dismiss `Keep`), and the request is exactly `{type:'cancel_run',run_id}` followed by a silent `get_run` refresh (unit-tested in `test/repository.test.mjs`). Captured `captures/40-run-459-cancel-confirm.png` on the executing run present at capture time. **Shown, not executed**: the only candidate was another live pipeline's executing run, so the dialog was shown and dismissed with `Keep` — no `cancel_run` was sent (a real cancel is only safe against a run started in a scratch workspace, which this stage did not do) | | R13 | Retry failed stage (resume) / restart from start | `retry_run` | done — `canRetry` is true only for a loaded, non-executing, `failed` run; the Retry confirm is the Android copy verbatim (title `Retry run {id}?`, `Only failed runs can be retried. The server starts a new run from the same input.`, confirm `Retry`, dismiss `Keep`) and the default send carries only `run_id` + a fresh `request_key` (**no** `retry_mode`, so the server's `resume` default applies exactly like the Android client's mode-less call; unit-tested). Captured `captures/35-run-440-run-actions.png` (failed run 440 offers Retry and no Cancel) and `captures/36-run-440-retry-confirm.png`. **Divergence from the Android UI, stated here**: Android exposes resume only while the protocol has both modes, so the browser adds a clearly-labelled secondary `Restart from start` confirm that states it `replays the whole pipeline from the start instead of resuming the failed stage` and sends `retry_mode:"restart"` (`captures/37-run-440-restart-confirm.png`). Both dialogs were shown and dismissed with `Keep`; no run was started | | R14 | Rename a run | `set_run_title` | done — an inline field on the Summary title row (pre-filled with the current title, `Rename` / `Save` / `Cancel`) sending exactly `{type:'set_run_title',run_id,title}` and then refreshing the run and the runs-list row (unit-tested). Captured `captures/38-run-440-rename-field.png`. The one shared `Action failed` dialog was exercised by a real refused rename: `captures/39-run-440-action-failed.png` shows the live server's exact reason `a title with usable text is required` (a blank title mutates nothing). **Divergence from the Android UI, stated here**: Android does not surface `set_run_title` at all (its README records the deliberate omission), so this control is browser-only | @@ -66,12 +66,12 @@ R11–R14 share one `Action failed` dialog (title `Action failed`, the server's message, a single `OK`), matching `RunDetailScreen.kt`; every server string is set with `textContent`, never `innerHTML`. Where a live action was unsafe this stage says so rather than mutating shared state: the R12 cancel and the R13 retry/restart -sends were shown and dismissed with `Keep` (never executed), and R11 has no live -capture because the server had no waiting run. The request shapes for all four are +sends were shown and dismissed with `Keep` (never executed); R11's live Confirm +**was** executed end to end against a run it started in its own throwaway +workspace (see the row above). The request shapes for all four are unit-tested in `test/repository.test.mjs` and the model in `test/actions.test.mjs`; `test/ui-smoke.mjs` captures the rendered dialogs, the rename field, the refused -rename's exact server reason and — when a waiting run exists — the decision -card/sheet. +rename's exact server reason and, under `--decide`, the full live decision flow. ## Search | # | Feature | Protocol | Status | diff --git a/web/test/ui-smoke.mjs b/web/test/ui-smoke.mjs index c1d57670..7debcd72 100644 --- a/web/test/ui-smoke.mjs +++ b/web/test/ui-smoke.mjs @@ -14,8 +14,14 @@ // against a scratch server and skips the live suite, which needs the operator's // real runs and chat session. The default run never sends a `submit`: the live // server's pipeline list is never mutated. +// +// `--decide` drives ONLY R11's live human-decision flow: it reuses an existing +// entry-stage human pipeline or submits one uniquely named create-only +// definition, starts two throwaway runs in fresh temp workspaces, and presses +// the real card/sheet/Confirm decision for both the feedback and no-feedback +// paths. It is deliberately opt-in because it is the only mode that submits. import { spawn } from "node:child_process"; -import { mkdir, mkdtemp, rm } from "node:fs/promises"; +import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises"; import net from "node:net"; import { tmpdir } from "node:os"; import { dirname, join, resolve } from "node:path"; @@ -74,6 +80,8 @@ const out = resolve( const scratch = process.argv.includes("--scratch"); // Focused notification evidence only; skips the unrelated live-suite steps. const notifyOnly = process.argv.includes("--notify"); +// Focused R11 evidence only; the one explicit mode allowed to submit a pipeline. +const decideOnly = process.argv.includes("--decide"); // The page must connect through its own proxy (the server rejects a cross-origin // upgrade), but serve.mjs only proxies /connect — not /artifacts. Point the URL @@ -81,6 +89,7 @@ const notifyOnly = process.argv.includes("--notify"); // viewer resolve to real files; that is exactly the URL a correctly configured // page would carry. const artifactServerUrl = `ws://${pipelines}/connect`; +const pipelineUrl = artifactServerUrl; const shots = []; let serve = null; @@ -94,6 +103,14 @@ let throwawaySessionId = null; // workspace and the workspace itself, both cleaned up in `finally`. let liveRunId = null; let liveRunScratch = null; +// R11 evidence: the human-stage pipeline used (reused or uniquely submitted), +// every throwaway run started for the decision path, and their temp workspaces. +// Cleanup cancels only these runs while they are still active and removes only +// these directories; the submitted pipeline definition is intentionally retained. +let decidePipelineName = null; +let decidePipelineReused = false; +const decideRunIds = []; +const decideScratchDirs = []; // C2's one real session. It is closed in its own step; kept here only so a // failure before that step can still close it rather than leave it in the list. let createdSessionId = null; @@ -231,6 +248,387 @@ async function cancelLiveRun(id) { } } +// --- R11: live human-decision evidence ------------------------------------- +// A human stage parks a run without starting a model, so it is safe to run on +// the live server in throwaway workspaces. This path is reached only with the +// explicit `--decide` flag: the default suite still never submits a pipeline. + +const DECIDE_PROMPT = "R11 live decision: review the run and choose approve or hold."; +const DECIDE_OPTIONS = ["approve", "hold"]; + +function cliJson(result, what) { + if (result.code !== 0) { + throw new Error(`${what} exited ${result.code}: ${result.stderr.trim().slice(-400)}`); + } + try { + return JSON.parse(result.stdout); + } catch { + throw new Error(`${what} returned no JSON: ${result.stdout.slice(0, 300)}`); + } +} + +async function inspectRun(id) { + return cliJson( + await runCli(["inspect", String(id), "--json", "--url", pipelineUrl], tmpdir()), + `pipelines inspect ${id}`, + ); +} + +async function waitForRun(id, predicate, what, timeout = 60000) { + const deadline = Date.now() + timeout; + let detail = null; + while (Date.now() < deadline) { + detail = await inspectRun(id); + if (predicate(detail)) return detail; + await new Promise((resolvePromise) => setTimeout(resolvePromise, 250)); + } + throw new Error(`run ${id} did not ${what}; last status ${detail?.status ?? "unknown"}`); +} + +/** + * The one pipeline R11 may use without submitting: an existing definition whose + * entry stage is already `type=human`, so starting it runs no model stage. A + * human stage later in a model pipeline is deliberately not reused. + */ +async function findEntryHumanPipeline() { + const list = cliJson( + await runCli(["list", "--json", "--url", pipelineUrl], tmpdir()), + "pipelines list", + ); + for (const item of list.pipelines ?? []) { + const shown = await runCli(["show", String(item.id), "--json", "--url", pipelineUrl], tmpdir()); + if (shown.code !== 0) continue; + let detail = null; + try { + detail = JSON.parse(shown.stdout); + } catch { + continue; + } + if (detail?.graph?.stages?.[0]?.type === "human") { + return { id: Number(item.id), name: String(detail.name ?? item.name) }; + } + } + return null; +} + +/** The tiny create-only definition: one human stage, both options succeed. */ +function humanOnlySource() { + return [ + "# stage gate", + "", + "```output", + "Decision evidence.", + "```", + "", + "```prompt", + DECIDE_PROMPT, + "```", + "", + "```edges", + "approve -> #success", + "hold -> #success", + "error -> #failure", + "```", + "", + "```configs", + "type=human", + "```", + "", + ].join("\n"); +} + +/** + * Use an existing entry-human pipeline, or submit exactly one uniquely named + * create-only definition. Then start two runs in separate fresh workspaces (the + * server permits one run per workspace) and wait for both to park in `waiting`. + * Every run id and workspace is tracked for the `finally` cleanup. + */ +async function prepareHumanDecisionRuns() { + const existing = await findEntryHumanPipeline(); + if (existing) { + decidePipelineName = existing.name; + decidePipelineReused = true; + console.log(` reusing entry-human pipeline ${existing.name} (id ${existing.id}); no submit`); + } else { + const definitionDir = await mkdtemp(join(tmpdir(), "pipelines-web-r11-def-")); + decideScratchDirs.push(definitionDir); + const definition = join(definitionDir, "human.md"); + await writeFile(definition, humanOnlySource(), "utf8"); + const stamp = new Date().toISOString().replace(/[:.]/g, "-"); + const requested = `Web R11 decision ${stamp}`; + const submitted = cliJson( + await runCli( + [ + "submit", + definition, + "--name", + requested, + "--create-only", + "--yes", + "--json", + "--url", + pipelineUrl, + ], + definitionDir, + ), + "pipelines submit", + ); + decidePipelineName = String(submitted.name ?? requested).trim() || requested; + console.log(` submitted create-only pipeline ${JSON.stringify(decidePipelineName)}`); + } + + const prepared = []; + for (const [index, suffix] of [ + [1, "feedback"], + [2, "no-feedback"], + ]) { + const workspace = await mkdtemp(join(tmpdir(), "pipelines-web-r11-")); + decideScratchDirs.push(workspace); + const title = `Web R11 decision ${index} (${suffix})`; + const started = cliJson( + await runCli( + [ + "run", + decidePipelineName, + "R11 web decision smoke", + "--workspace", + workspace, + "--title", + title, + "--json", + "--yes", + "--url", + pipelineUrl, + ], + workspace, + ), + `pipelines run ${decidePipelineName}`, + ); + const id = Number(started.run_detail?.id); + if (!(id > 0)) throw new Error(`pipelines run returned no run id: ${started ? JSON.stringify(started).slice(0, 200) : "no output"}`); + decideRunIds.push(id); + prepared.push({ id, title, suffix, workspace }); + } + + for (const run of prepared) { + const detail = await waitForRun( + run.id, + (d) => d.status === "waiting" && d.current_stage === "gate", + "reach waiting on the gate stage", + ); + const waitingStep = (detail.steps ?? []).find((step_) => step_.status === "waiting"); + const options = waitingStep?.output?.options ?? []; + if (JSON.stringify(options) !== JSON.stringify(DECIDE_OPTIONS)) { + throw new Error(`run ${run.id} waiting options: ${JSON.stringify(options)}`); + } + if (waitingStep?.output?.prompt !== DECIDE_PROMPT) { + throw new Error(`run ${run.id} waiting instructions: ${JSON.stringify(waitingStep?.output?.prompt)}`); + } + console.log(` run ${run.id} waiting on gate in ${run.workspace} (options ${options.join(", ")})`); + } + return prepared; +} + +/** + * One complete live decision: card, sheet, deliberate selection, one Confirm, + * the resumed run and the recorded verdict. Feedback is optional; the same flow + * proves both wire shapes. + */ +async function exerciseDecisionRun(run, { option, feedback, labels }) { + const { id, title } = run; + const expectedMeta = `gate · run ${id} · ${title}`; + console.log(`• R11: ${labels.label} (run ${id})`); + await ensureConnected(); + await eventually( + () => page.evaluate(`!!document.querySelector('.list.runs .run-row-meta[data-run-id="${id}"]')`), + { timeout: 30000, what: `run ${id}'s waiting row to appear` }, + ); + await openRunDetail(id); + await page.waitForSelector(".run-detail .decision-card", { timeout: 20000 }); + const card = await page.evaluate(`(() => ({ + title: document.querySelector(".decision-card .decision-card-title")?.textContent ?? "", + meta: document.querySelector(".decision-card .decision-card-meta")?.textContent ?? "", + action: document.querySelector(".decision-card .decision-open")?.textContent ?? "", + }))()`); + if (card.title !== "Waiting for your decision") throw new Error(`card title: ${card.title}`); + if (card.meta !== expectedMeta) throw new Error(`card meta: ${card.meta}`); + if (card.action !== "Decide") throw new Error(`card action: ${card.action}`); + console.log(` card: ${card.title} — ${card.meta}`); + shots.push(await page.screenshot(`${out}/${labels.card}`)); + + await page.click(".decision-card .decision-open"); + await page.waitForSelector(".decision-sheet .decision-option", { timeout: 20000 }); + const sheet = await page.evaluate(`(() => ({ + title: document.querySelector(".decision-sheet-title")?.textContent ?? "", + meta: document.querySelector(".decision-sheet-meta")?.textContent ?? "", + instructions: document.querySelector(".decision-instructions")?.textContent ?? "", + options: [...document.querySelectorAll(".decision-sheet .decision-option")].map((n) => ({ + key: n.querySelector(".decision-option-key")?.textContent ?? "", + target: n.querySelector(".decision-option-target")?.textContent ?? "", + })), + feedbackLabel: document.querySelector(".decision-field-label")?.textContent ?? "", + confirm: document.querySelector(".decision-confirm")?.textContent ?? "", + confirmDisabled: document.querySelector(".decision-confirm")?.disabled ?? null, + }))()`); + if (sheet.title !== "Decide gate") throw new Error(`sheet title: ${sheet.title}`); + if (sheet.meta !== `run ${id} · ${title}`) throw new Error(`sheet meta: ${sheet.meta}`); + if (sheet.instructions !== DECIDE_PROMPT) { + throw new Error(`sheet instructions: ${JSON.stringify(sheet.instructions)}`); + } + const optionKeys = sheet.options.map((row) => row.key); + if (JSON.stringify(optionKeys) !== JSON.stringify(DECIDE_OPTIONS)) { + throw new Error(`sheet options: ${JSON.stringify(optionKeys)}`); + } + if (sheet.options.some((row) => row.target !== "\u2192 SUCCESS")) { + throw new Error(`sheet targets: ${JSON.stringify(sheet.options)}`); + } + if (sheet.feedbackLabel !== "Feedback (optional)") { + throw new Error(`sheet feedback label: ${sheet.feedbackLabel}`); + } + if (sheet.confirm !== "Confirm decision") throw new Error(`sheet confirm: ${sheet.confirm}`); + if (sheet.confirmDisabled !== true) throw new Error("Confirm decision must start disabled"); + console.log( + ` sheet: ${sheet.title} — ${sheet.meta}; ${sheet.options + .map((row) => `${row.key} ${row.target}`) + .join(", ")}; ${sheet.feedbackLabel}; Confirm disabled`, + ); + shots.push(await page.screenshot(`${out}/${labels.sheet}`)); + + await page.click(`.decision-sheet .decision-option[data-option="${option}"]`); + await eventually(() => page.evaluate(`document.querySelector(".decision-confirm")?.disabled === false`), { + timeout: 5000, + what: "Confirm to enable after selecting an option", + }); + const selected = await page.evaluate(`(() => ({ + checked: document.querySelector('.decision-sheet .decision-option[data-option="${option}"]')?.getAttribute("aria-checked") ?? "", + decideBodies: (window.__decideBodies ?? []).filter((body) => Number(body.run_id) === ${id}), + }))()`); + if (selected.checked !== "true") throw new Error(`option ${option} did not render selected`); + if (selected.decideBodies.length !== 0) { + throw new Error(`selecting an option sent decide_run: ${JSON.stringify(selected.decideBodies)}`); + } + const stillWaiting = await inspectRun(id); + if (stillWaiting.status !== "waiting") { + throw new Error(`run ${id} left waiting on selection: ${stillWaiting.status}`); + } + console.log(" selecting sent no decide_run; the run is still waiting"); + if (feedback) await page.fill(".decision-sheet .decision-feedback", feedback); + shots.push(await page.screenshot(`${out}/${labels.selected}`)); + + await page.click(".decision-sheet .decision-confirm"); + await eventually( + () => + page.evaluate( + `!document.querySelector(".decision-sheet") && !document.querySelector(".decision-card")`, + ), + { timeout: 20000, what: "the sheet and card to close after Confirm" }, + ); + const final = await waitForRun( + id, + (d) => d.status === "succeeded", + "succeed after the decision", + ); + const bodies = await page.evaluate( + `(window.__decideBodies ?? []).filter((body) => Number(body.run_id) === ${id})`, + ); + if (bodies.length !== 1) throw new Error(`expected exactly one decide_run, got ${JSON.stringify(bodies)}`); + const body = bodies[0]; + if (body.type !== "decide_run" || Number(body.run_id) !== id || body.stage !== "gate" || body.option !== option) { + throw new Error(`decide_run body: ${JSON.stringify(body)}`); + } + if (feedback) { + if (body.feedback !== feedback) throw new Error(`decide_run feedback: ${JSON.stringify(body.feedback)}`); + } else if (Object.hasOwn(body, "feedback")) { + throw new Error(`no-feedback decide_run carried feedback: ${JSON.stringify(body)}`); + } + const gate = (final.steps ?? [])[0] ?? {}; + if (gate.outcome !== option || gate.output?.option !== option) { + throw new Error(`recorded decision: ${JSON.stringify(gate.output)} outcome ${gate.outcome}`); + } + const recordedFeedback = String(gate.output?.feedback ?? "").trim(); + if (recordedFeedback !== feedback) { + throw new Error(`recorded feedback: ${JSON.stringify(gate.output?.feedback)}`); + } + const expectedVerdict = `${option} \u2192 success`; + if (gate.verdict?.option !== expectedVerdict) { + throw new Error(`recorded verdict option: ${JSON.stringify(gate.verdict?.option)}`); + } + if (String(gate.verdict?.reason ?? "") !== feedback) { + throw new Error(`recorded verdict reason: ${JSON.stringify(gate.verdict?.reason)}`); + } + console.log( + ` one decide_run ${JSON.stringify(body)}; run succeeded with ${expectedVerdict}` + + (feedback ? ` and the exact reason` : " and no reason"), + ); + + await eventually( + () => + page.evaluate( + `["succeeded","Succeeded"].includes(document.querySelector(".run-detail .run-chip-row .chip")?.textContent ?? "")`, + ), + { timeout: 20000, what: `run ${id}'s detail to show succeeded` }, + ); + shots.push(await page.screenshot(`${out}/${labels.confirmed}`)); + + await page.clickText(".detail .detail-tabs .detail-tab", "Timeline"); + await page.waitForSelector(`.detail .timeline-row[data-stage-key="gate"]`, { timeout: 20000 }); + await page.click(`.detail .timeline-row[data-stage-key="gate"]`); + await page.waitForSelector(".stage-pane .verdict", { timeout: 20000 }); + const verdict = await page.evaluate(`(() => ({ + title: document.querySelector(".stage-pane .verdict-title")?.textContent ?? "", + option: document.querySelector(".stage-pane .verdict .outcome-chip")?.textContent ?? "", + reason: document.querySelector(".stage-pane .verdict-reason")?.textContent ?? "", + }))()`); + if (verdict.title !== "Verdict") throw new Error(`verdict heading: ${verdict.title}`); + if (verdict.option !== expectedVerdict) throw new Error(`verdict chip: ${verdict.option}`); + if (verdict.reason !== feedback) throw new Error(`verdict reason: ${JSON.stringify(verdict.reason)}`); + console.log(` verdict: ${verdict.option}${feedback ? ` — ${verdict.reason}` : " — no reason"}`); + shots.push(await page.screenshot(`${out}/${labels.verdict}`)); + await page.evaluate( + `document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }))`, + ); + await eventually(() => page.evaluate(`!document.querySelector(".stage-pane")`), { + timeout: 5000, + what: "the stage pane to close", + }); +} + +/** The focused R11 suite: two real waiting runs, both decided in the browser. */ +async function runDecisionChecks() { + const prepared = await prepareHumanDecisionRuns(); + await ensureConnected(); + await page.clickText("nav.tabs button.tab", "Runs"); + await page.waitForSelector(".list.runs .run-row", { timeout: 25000 }); + await exerciseDecisionRun(prepared[0], { + option: "approve", + feedback: "Approved in the live browser decision sheet.", + labels: { + label: "decision with feedback", + card: `41-run-${prepared[0].id}-decision-card.png`, + sheet: `42-run-${prepared[0].id}-decision-sheet.png`, + selected: `43-run-${prepared[0].id}-decision-selected.png`, + confirmed: `44-run-${prepared[0].id}-decision-confirmed.png`, + verdict: `45-run-${prepared[0].id}-decision-verdict.png`, + }, + }); + await exerciseDecisionRun(prepared[1], { + option: "hold", + feedback: "", + labels: { + label: "decision without feedback", + card: `46-run-${prepared[1].id}-decision-card.png`, + sheet: `47-run-${prepared[1].id}-decision-sheet.png`, + selected: `48-run-${prepared[1].id}-decision-selected.png`, + confirmed: `49-run-${prepared[1].id}-decision-confirmed.png`, + verdict: `50-run-${prepared[1].id}-decision-verdict.png`, + }, + }); + console.log( + ` pipeline ${JSON.stringify(decidePipelineName)} (${decidePipelineReused ? "reused" : "submitted create-only"}), runs ${decideRunIds.join(", ")} both succeeded`, + ); +} + + // Open one chat row's Chat actions menu (the row's management items live behind // it since C13: Rename… / Close chat… or Reopen / Hide on this device). async function openChatRowMenu(sessionId) { @@ -719,6 +1117,10 @@ try { // ack, so the card's refusal path (reopen with the reason) is exercised. window.__failChatReplyIds = []; window.__chatReplyCounts = { suppressed: 0, forwarded: 0, failed: 0 }; + // R11: the exact decide_run bodies the page actually sends, retained (not + // suppressed) so the smoke can prove a selection sends nothing and Confirm + // sends exactly one body with the chosen option and optional feedback. + window.__decideBodies = []; function Shim(url, protocols) { const ws = protocols === undefined ? new Native(url) : new Native(url, protocols); const nativeSend = ws.send.bind(ws); @@ -779,6 +1181,8 @@ try { frame.chat_prompt?.text ?? "", ); } + // R11: retain the real decision frames without altering them. + if (frame.type === "decide_run") window.__decideBodies.push(frame); // C2: the create bodies this page actually sent, so the smoke can prove // the picker's chosen value reached chat_create. if (frame.type === "chat_create") { @@ -852,7 +1256,11 @@ try { for (const shot of shots) console.log(` ${shot}`); } - if (notifyOnly) { + if (decideOnly) { + await runDecisionChecks(); + console.log("\nUI SMOKE PASS"); + for (const shot of shots) console.log(` ${shot}`); + } else if (notifyOnly) { await runNotificationChecks(); console.log("\nUI SMOKE PASS"); for (const shot of shots) console.log(` ${shot}`); @@ -2814,10 +3222,11 @@ try { } } - // R11: the decision card/sheet, only when the live server actually has a run - // waiting on a person with recorded options. There is normally none (a human - // stage blocks a run until a person answers), so this stays a best-effort - // capture rather than a failure; the model is unit-tested in actions.test.mjs. + // R11: the decision card/sheet, only when the live server already has a run + // waiting on a person with recorded options. This default suite never submits + // and never confirms: it captures the waiting card, the sheet and the selected + // state and then dismisses with Cancel. The full live Confirm (both feedback + // paths) is exercised by the opt-in `--decide` mode above. step("R11: the human-decision card/sheet (only when a waiting run is present)"); const waitingRunId = await page.evaluate(`(() => { const row = [...document.querySelectorAll(".list.runs .run-row")].find((n) => n.querySelector(".chip-waiting")); @@ -2825,7 +3234,7 @@ try { return meta ? Number(meta.getAttribute("data-run-id")) : null; })()`); if (waitingRunId == null) { - console.log(" -- no waiting run available; skipped the decision card/sheet capture (R11 stays partial)"); + console.log(" -- no waiting run available; skipped the decision card/sheet capture (full live path covered by --decide)"); } else { await openRunDetail(waitingRunId); await page.waitForSelector(".run-detail .decision-card", { timeout: 15000 }); @@ -6063,6 +6472,35 @@ try { // leave the scratch directory rather than failing cleanup } } + // Best-effort cleanup of the R11 decision runs: cancel only these tracked runs + // while they are still active (never another run), then remove only the temp + // workspaces/definition directories this smoke created. The uniquely submitted + // human-only pipeline definition is intentionally retained and named in PARITY. + for (const id of decideRunIds) { + try { + const detail = await inspectRun(id); + if (["queued", "running", "waiting"].includes(detail.status)) { + const result = await runCli( + ["cancel", String(id), "--yes", "--json", "--url", pipelineUrl], + tmpdir(), + ); + console.log( + result.code === 0 + ? ` cleanup: canceled the R11 decision run ${id} (${detail.status})` + : ` cleanup: cancel ${id} exited ${result.code}`, + ); + } + } catch { + // the server/CLI may be gone; the failure above is the real signal + } + } + for (const dir of decideScratchDirs) { + try { + await rm(dir, { recursive: true, force: true }); + } catch { + // leave the scratch directory rather than failing cleanup + } + } // Best-effort cleanup of the throwaway session this run created: if the run // failed before its `/close` step, close it now so it is never left open. It // closes only the throwaway: if the open conversation is something else (the From 6d762b73b85ac4c5907e0e79f15ab2715fde491e Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Mon, 19 Oct 2026 16:18:04 +0100 Subject: [PATCH 5/6] web: note R11 re-verification after the main merge --- web/PARITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/PARITY.md b/web/PARITY.md index 1fa1cdae..3274dbb8 100644 --- a/web/PARITY.md +++ b/web/PARITY.md @@ -41,7 +41,7 @@ Status legend: `todo` · `partial` (some of it works) · `done` (working + captu | R8 | Artifacts gallery + full-screen viewer (images inline, others download/open) | `GET /artifacts/…` | done (captured 2026-10-19: `captures/04-run-430-artifacts.png`, `captures/05-artifact-viewer.png`) | | R9 | Session export link (read-only `session.html`) | `GET /artifacts/…` | done (captured 2026-10-19: `captures/06-session-export-link.png`) | | R10 | Live run updates: subscribe/unsubscribe + event fold | `subscribe`, `unsubscribe`, `run_event` | done — one app-wide watch owned by the connection, never by a screen: becoming connected best-effort `unsubscribe`s the previous watch, sends `{type:'subscribe',workspace:''}` send-only (no `run_ids`; `{type:'unsubscribe'}` drops it), then takes one authoritative resync (`list_runs`, plus one `get_run` when a run detail is open); a socket drop clears the watch and no screen change ever unsubscribes. `src/runEvents.js` is the pure fold ported from `ui/RunEvents.kt` (in-place list update preserving order, insert-at-head from the frame's pipeline identity, `needsResync` without identity, detail merge with explicit `resource_wait` set/clear, one step matched by `sequence` and inserted in sequence order, the monotonic run/step ladders and the full-sync decision) and is unit-tested in `test/runEvents.test.mjs`; the send-only path (`src/client.js#sendOnly`), the exact watch frames (`src/repository.js`) and the `run_event`/unsolicited-frame dispatch are unit-tested in `test/client.test.mjs` and `test/repository.test.mjs`. The 1 s run-detail poll is removed — pushed frames drive the detail and a settled/terminal frame triggers one coalesced `get_run` (at most one in flight per kind plus one queued follow-up, retried at 500 ms × attempt at most 3 times before the badge drops to `reconnecting`); the only surviving intervals are render-only clocks. The badge is the explicit stream state (`live` / `reconnecting` / `not live`, LiveBadge.kt words), independent of whether a run is executing, on the Runs list and the run detail. Captured 2026-10-19 against the live server with a **real pushed run** started by the smoke in a throwaway workspace: `captures/75-run-live-list.png` (the new run's row inserted from its own frame, badge `live`), `captures/76-run-live-detail.png` (the open detail folded to `running` from pushes, badge `live`) and `captures/77-run-live-terminal.png` (the pushed terminal fold to `canceled`, no poll), plus the reachable badge states `captures/28-connected-banner.png` (live), `captures/29-disconnected-banner.png` (not live while idle; reconnecting while the socket retries) and `captures/30-reconnect-recovered.png` (live again). `test/ui-smoke.mjs` asserts the reconnect wire order (unsubscribe → subscribe blank-workspace → list_runs) and that at least one genuine `run_event` frame for the started run arrived. The R10 step itself passes on every run; the full smoke can still fail later in unrelated, pre-existing steps on the shared live server (observed after the main merge: a flaky L1 stale page-level error on one run, a C5 chat fold `expected at least one folded agent turn, got 0` on another, and a C8 composer assertion while the operator's live chat session was streaming, so the composer correctly showed Stop; the focused `--notify` run is `UI SMOKE PASS`), which is not an R10 defect. | -| R11 | Human decision sheet: prompt, options, feedback | `decide_run` | done — the pure model (`src/actions.js`: `pendingDecision`, `lastWaitingStep`, `waitingPrompt`/`waitingOptions`, `humanOptions`, `decisionTargetLabel`, `DecisionDraft`) and the card + sheet are implemented with the Android copy verbatim: card title `Waiting for your decision`, meta `{stage} · run {id} · {runLabel}`, action `Decide`; sheet title `Decide {stage}`, meta `run {id} · {runLabel}`, the recorded instructions verbatim when non-blank, one selectable row per option in author order showing the option and `→ {target}` only when the declared edge resolves, the `Feedback (optional)` field, and `Cancel` / `Confirm decision` (reading `Sending…` while in flight). Selecting a row sends nothing and Confirm is disabled until a non-blank option is chosen; a refusal keeps the sheet open with the server's exact reason and re-reads the run. The request shape is unit-tested (`decide_run` = `{type, run_id, option, stage?, feedback?}`, stage/feedback omitted when blank, feedback trimmed). **Live, end to end (2026-10-19)**: `test/ui-smoke.mjs` gained an explicit `--decide` mode (the only mode allowed to submit). It reused the entry-stage human-only pipeline submitted create-only as `Web R11 decision 2026-10-19T14-59-18-785Z` (id 30: one `type=human` `gate` stage, `approve -> #success`, `hold -> #success`, `error -> #failure`, so no model stage runs) and started two runs in separate fresh temp workspaces. Run 513 parked in `waiting`; the browser asserted the card (`Waiting for your decision`, `gate · run 513 · Web R11 decision 1 (feedback)`, `Decide`), opened the sheet (`Decide gate`, `run 513 · …`, the recorded instructions `R11 live decision: review the run and choose approve or hold.`, `approve`/`hold` in author order each with `→ SUCCESS`, `Feedback (optional)`, Confirm disabled), selected `approve` (still no `decide_run`, and the run was still `waiting` via `pipelines inspect`), typed feedback, and pressed `Confirm decision`: exactly one frame `{"type":"decide_run","run_id":513,"option":"approve","stage":"gate","feedback":"Approved in the live browser decision sheet."}` was sent, the run left `waiting`, resumed and reached `succeeded`. Run 514 proved the no-feedback shape: selecting `hold` sent nothing, Confirm sent `{"type":"decide_run","run_id":514,"option":"hold","stage":"gate"}` with **no** `feedback` key, the run reached `succeeded`, its recorded feedback is blank and its verdict carries no reason. Captured: `captures/41-run-513-decision-card.png` (waiting card), `captures/42-run-513-decision-sheet.png` (open sheet with the options), `captures/43-run-513-decision-selected.png` (selected + feedback, Confirm enabled), `captures/44-run-513-decision-confirmed.png` (resumed detail, `succeeded`), `captures/45-run-513-decision-verdict.png` (`gate · visit 1` Verdict chip `approve → success` and the exact reason), and the no-feedback path `captures/46-run-514-decision-card.png`, `captures/47-run-514-decision-sheet.png`, `captures/48-run-514-decision-selected.png`, `captures/49-run-514-decision-confirmed.png`, `captures/50-run-514-decision-verdict.png` (`hold → success`, no reason). Command: `cd web && node test/ui-smoke.mjs --decide --out "$PWD/captures"` → `UI SMOKE PASS` (the reused pipeline means no new submit on the capture run); `cd web && node --test test/` stays green. Both runs are terminal, no R11 run remains active and both temp workspaces were removed. The submitted definition is intentionally retained and named here; no operator pipeline, version, run, chat or repository was modified | +| R11 | Human decision sheet: prompt, options, feedback | `decide_run` | done — the pure model (`src/actions.js`: `pendingDecision`, `lastWaitingStep`, `waitingPrompt`/`waitingOptions`, `humanOptions`, `decisionTargetLabel`, `DecisionDraft`) and the card + sheet are implemented with the Android copy verbatim: card title `Waiting for your decision`, meta `{stage} · run {id} · {runLabel}`, action `Decide`; sheet title `Decide {stage}`, meta `run {id} · {runLabel}`, the recorded instructions verbatim when non-blank, one selectable row per option in author order showing the option and `→ {target}` only when the declared edge resolves, the `Feedback (optional)` field, and `Cancel` / `Confirm decision` (reading `Sending…` while in flight). Selecting a row sends nothing and Confirm is disabled until a non-blank option is chosen; a refusal keeps the sheet open with the server's exact reason and re-reads the run. The request shape is unit-tested (`decide_run` = `{type, run_id, option, stage?, feedback?}`, stage/feedback omitted when blank, feedback trimmed). **Live, end to end (2026-10-19)**: `test/ui-smoke.mjs` gained an explicit `--decide` mode (the only mode allowed to submit). It reused the entry-stage human-only pipeline submitted create-only as `Web R11 decision 2026-10-19T14-59-18-785Z` (id 30: one `type=human` `gate` stage, `approve -> #success`, `hold -> #success`, `error -> #failure`, so no model stage runs) and started two runs in separate fresh temp workspaces. Run 513 parked in `waiting`; the browser asserted the card (`Waiting for your decision`, `gate · run 513 · Web R11 decision 1 (feedback)`, `Decide`), opened the sheet (`Decide gate`, `run 513 · …`, the recorded instructions `R11 live decision: review the run and choose approve or hold.`, `approve`/`hold` in author order each with `→ SUCCESS`, `Feedback (optional)`, Confirm disabled), selected `approve` (still no `decide_run`, and the run was still `waiting` via `pipelines inspect`), typed feedback, and pressed `Confirm decision`: exactly one frame `{"type":"decide_run","run_id":513,"option":"approve","stage":"gate","feedback":"Approved in the live browser decision sheet."}` was sent, the run left `waiting`, resumed and reached `succeeded`. Run 514 proved the no-feedback shape: selecting `hold` sent nothing, Confirm sent `{"type":"decide_run","run_id":514,"option":"hold","stage":"gate"}` with **no** `feedback` key, the run reached `succeeded`, its recorded feedback is blank and its verdict carries no reason. Captured: `captures/41-run-513-decision-card.png` (waiting card), `captures/42-run-513-decision-sheet.png` (open sheet with the options), `captures/43-run-513-decision-selected.png` (selected + feedback, Confirm enabled), `captures/44-run-513-decision-confirmed.png` (resumed detail, `succeeded`), `captures/45-run-513-decision-verdict.png` (`gate · visit 1` Verdict chip `approve → success` and the exact reason), and the no-feedback path `captures/46-run-514-decision-card.png`, `captures/47-run-514-decision-sheet.png`, `captures/48-run-514-decision-selected.png`, `captures/49-run-514-decision-confirmed.png`, `captures/50-run-514-decision-verdict.png` (`hold → success`, no reason). Command: `cd web && node test/ui-smoke.mjs --decide --out "$PWD/captures"` → `UI SMOKE PASS` (the reused pipeline means no new submit on the capture run); `cd web && node --test test/` stays green. Both runs are terminal, no R11 run remains active and both temp workspaces were removed. The submitted definition is intentionally retained and named here; no operator pipeline, version, run, chat or repository was modified. Re-verified after merging `main` (2026-10-19): the same reused pipeline parked runs 522 and 523, the same `--decide` check ended `UI SMOKE PASS` with `captures/41-run-522-decision-card.png` through `captures/50-run-523-decision-verdict.png`, and the full default live suite also ended `UI SMOKE PASS` (its R11 step still skips only because no operator run was waiting at that moment) | | R12 | Cancel run | `cancel_run` | done — `src/actions.js` `canCancel` offers a `Cancel run` action only while the run is `executing`; the confirm dialog is the Android copy verbatim (title `Cancel run {id}?`, `This asks the server to stop the active run.`, confirm `Cancel run`, dismiss `Keep`), and the request is exactly `{type:'cancel_run',run_id}` followed by a silent `get_run` refresh (unit-tested in `test/repository.test.mjs`). Captured `captures/40-run-459-cancel-confirm.png` on the executing run present at capture time. **Shown, not executed**: the only candidate was another live pipeline's executing run, so the dialog was shown and dismissed with `Keep` — no `cancel_run` was sent (a real cancel is only safe against a run started in a scratch workspace, which this stage did not do) | | R13 | Retry failed stage (resume) / restart from start | `retry_run` | done — `canRetry` is true only for a loaded, non-executing, `failed` run; the Retry confirm is the Android copy verbatim (title `Retry run {id}?`, `Only failed runs can be retried. The server starts a new run from the same input.`, confirm `Retry`, dismiss `Keep`) and the default send carries only `run_id` + a fresh `request_key` (**no** `retry_mode`, so the server's `resume` default applies exactly like the Android client's mode-less call; unit-tested). Captured `captures/35-run-440-run-actions.png` (failed run 440 offers Retry and no Cancel) and `captures/36-run-440-retry-confirm.png`. **Divergence from the Android UI, stated here**: Android exposes resume only while the protocol has both modes, so the browser adds a clearly-labelled secondary `Restart from start` confirm that states it `replays the whole pipeline from the start instead of resuming the failed stage` and sends `retry_mode:"restart"` (`captures/37-run-440-restart-confirm.png`). Both dialogs were shown and dismissed with `Keep`; no run was started | | R14 | Rename a run | `set_run_title` | done — an inline field on the Summary title row (pre-filled with the current title, `Rename` / `Save` / `Cancel`) sending exactly `{type:'set_run_title',run_id,title}` and then refreshing the run and the runs-list row (unit-tested). Captured `captures/38-run-440-rename-field.png`. The one shared `Action failed` dialog was exercised by a real refused rename: `captures/39-run-440-action-failed.png` shows the live server's exact reason `a title with usable text is required` (a blank title mutates nothing). **Divergence from the Android UI, stated here**: Android does not surface `set_run_title` at all (its README records the deliberate omission), so this control is browser-only | From 8880495970cfa23d4985b9438c99c45750fdc44b Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Mon, 19 Oct 2026 16:33:59 +0100 Subject: [PATCH 6/6] web: layout prototype/spec and an accessibility audit (design inputs) The layout prototype shows the operator's target shell: a left destination rail (Pipelines/Runs/Chat/Settings) with the detail sections grouped in the rail, list and detail panes, a status dot in the rail footer and no top connection chrome. The spec's DOM sketch still mentions the old connection banner; the implementation brief supersedes that (connection lives in Settings only). The audit records 9 must-fix, 12 should-fix and 15 notes from real DOM and accessibility-tree inspection, with file:line for each finding. --- web/design/layout/capture.mjs | 48 ++ web/design/layout/prototype.css | 801 +++++++++++++++++++++++++++++++ web/design/layout/prototype.html | 470 ++++++++++++++++++ web/docs/a11y-audit.md | 206 ++++++++ web/docs/layout-spec.md | 574 ++++++++++++++++++++++ 5 files changed, 2099 insertions(+) create mode 100644 web/design/layout/capture.mjs create mode 100644 web/design/layout/prototype.css create mode 100644 web/design/layout/prototype.html create mode 100644 web/docs/a11y-audit.md create mode 100644 web/docs/layout-spec.md diff --git a/web/design/layout/capture.mjs b/web/design/layout/capture.mjs new file mode 100644 index 00000000..3dd5ef48 --- /dev/null +++ b/web/design/layout/capture.mjs @@ -0,0 +1,48 @@ +// Capture the L2–L4 layout prototype through the repository's zero-dependency +// Chrome DevTools driver. Read-only import: web/test/browser.mjs is not modified. +// +// node web/design/layout/capture.mjs +// +// Writes PNGs into web/design/layout/captures/ (gitignored by the root +// `captures/` rule). No server is started; the prototype is a local file. + +import { mkdir } from "node:fs/promises"; +import { dirname, join } from "node:path"; +import { fileURLToPath, pathToFileURL } from "node:url"; +import { launchChrome } from "../../test/browser.mjs"; + +const here = dirname(fileURLToPath(import.meta.url)); +const outDir = join(here, "captures"); +const prototype = pathToFileURL(join(here, "prototype.html")); + +const shots = [ + { hash: "wide", width: 1440, height: 900, name: "wide-pipelines-1440x900.png" }, + { hash: "runs", width: 420, height: 900, name: "narrow-runs-420x900.png" }, + { hash: "detail", width: 420, height: 900, name: "narrow-run-detail-420x900.png" }, +]; + +await mkdir(outDir, { recursive: true }); + +const browser = await launchChrome({ width: 1440, height: 900 }); +try { + for (const shot of shots) { + const page = await browser.openPage(`${prototype.href}#${shot.hash}`, { + width: shot.width, + height: shot.height, + }); + await page.waitForSelector(`#${shot.hash}`); + await page.evaluate("document.fonts.ready.then(() => true)"); + await new Promise((resolve) => setTimeout(resolve, 150)); + const box = await page.evaluate(`(() => { + const node = document.querySelector("#${shot.hash} .app-shell"); + const rect = node.getBoundingClientRect(); + return { width: Math.round(rect.width), height: Math.round(rect.height) }; + })()`); + const path = join(outDir, shot.name); + await page.screenshot(path); + console.log(`${shot.name}: viewport ${shot.width}x${shot.height}, shell ${box.width}x${box.height}`); + await page.close(); + } +} finally { + await browser.close(); +} diff --git a/web/design/layout/prototype.css b/web/design/layout/prototype.css new file mode 100644 index 00000000..033c7db5 --- /dev/null +++ b/web/design/layout/prototype.css @@ -0,0 +1,801 @@ +/* ─────────────────────────────────────────────────────────────────────────── + Pipelines web — L2–L4 layout prototype + The app palette below is copied verbatim from web/styles.css :root. + The rules from "App shell" to "Reduced motion" are the reference layout; + everything under "Prototype chrome" is for this static mock only. + ─────────────────────────────────────────────────────────────────────────── */ + +/* App palette — verbatim from web/styles.css. */ +:root { + color-scheme: dark; + --bg: #0e1513; + --surface: #171f1d; + --surface-2: #1f2a27; + --border: #2c3a36; + --text: #e2e8e6; + --muted: #9db0ab; + --accent: #7fd1bb; + --ok: #6bd39a; + --warn: #e6c268; + --bad: #ef8a8a; +} + +/* Named layout tokens, mirroring android/app/src/main/java/net/awan/pipelines/ + ui/theme/Dimens.kt (WIDE_RAIL_WIDTH_DP = 200, SPACING_* = 4/8/12/16). */ +:root { + --rail-width: 200px; + --list-min-width: 200px; + --list-max-width: 360px; + --dock-height: 60px; + --hairline: 1px; + --dock-clearance: calc(var(--dock-height) + env(safe-area-inset-bottom, 0px)); + --radius-s: 8px; + --radius-m: 10px; + --radius-l: 12px; + --space-xs: 4px; + --space-s: 8px; + --space-m: 12px; + --space-l: 16px; + --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; +} + +* { box-sizing: border-box; } + +html, body { height: 100%; } + +body { + margin: 0; + background: var(--bg); + color: var(--text); + font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; + -webkit-font-smoothing: antialiased; +} + +button, a { font: inherit; } +button { color: inherit; } +a { color: inherit; } + +.icon { + width: 20px; + height: 20px; + flex: 0 0 auto; +} + +.icon-sprite { + position: absolute; + width: 0; + height: 0; + overflow: hidden; +} + +:where(a, button, [tabindex]):focus-visible { + outline: 2px solid var(--accent); + outline-offset: 2px; +} + +.skip-link { + position: absolute; + top: -80px; + left: var(--space-l); + z-index: 100; + padding: var(--space-s) var(--space-m); + border-radius: var(--radius-s); + background: var(--surface-2); + color: var(--text); + text-decoration: none; +} +.skip-link:focus { top: var(--space-l); } + +/* ── App shell ────────────────────────────────────────────────────────────── + Narrow is the default: one grid cell, one pane at a time, and clearance for + the fixed destination bar. The wide media query at exactly 600px turns the + same shell into the 200px rail + two panes. No other breakpoint is used. */ + +.screen { + display: none; + height: 100dvh; + min-height: 0; +} +.screen:target { display: block; } +body:not(:has(.screen:target)) #wide { display: block; } +body:has(.screen:target) .proto-nav { display: none; } + +.app-shell { + position: relative; + height: 100dvh; + min-height: 0; + overflow: hidden; + display: grid; + grid-template-columns: minmax(0, 1fr); + grid-template-rows: minmax(0, 1fr); + grid-template-areas: "workspace"; + padding-top: env(safe-area-inset-top, 0px); + padding-bottom: var(--dock-clearance); + background: var(--bg); +} + +.workspace { + grid-area: workspace; + min-width: 0; + min-height: 0; + display: grid; + grid-template-columns: minmax(0, 1fr); + grid-template-rows: minmax(0, 1fr); + grid-template-areas: "main"; +} + +/* The 200px rail is the wide-only destination and section index. */ +.app-rail { display: none; } + +.list-pane, +.detail-pane { + grid-area: main; + min-width: 0; + min-height: 0; + overflow: hidden; + display: none; + flex-direction: column; + background: var(--bg); +} + +.app-shell[data-active-pane="list"] .list-pane { display: flex; } +.app-shell[data-active-pane="detail"] .detail-pane { display: flex; } + +/* ── Wide: left rail + list/detail panes ──────────────────────────────────── + The single breakpoint. widthDp >= 600 is isWideLayout() in WindowSize.kt; + in the browser the same predicate is (min-width: 600px). */ + +@media (min-width: 600px) { + .app-shell:not(.app-shell--phone) { + grid-template-columns: var(--rail-width) minmax(0, 1fr); + grid-template-areas: "rail workspace"; + padding-bottom: 0; + } + + .app-shell:not(.app-shell--phone) .app-rail { display: flex; } + + .app-shell:not(.app-shell--phone) .workspace { + grid-template-columns: minmax(var(--list-min-width), var(--list-max-width)) minmax(0, 1fr); + grid-template-areas: "list detail"; + } + + .app-shell:not(.app-shell--phone) .list-pane { + grid-area: list; + display: flex; + border-right: var(--hairline) solid var(--border); + } + + .app-shell:not(.app-shell--phone) .detail-pane { + grid-area: detail; + display: flex; + } + + /* Wide windows use the rail for sections; the strip is a narrow affordance. */ + .app-shell:not(.app-shell--phone) .section-strip { display: none; } + + /* Wide windows use the rail for destinations; no bottom bar is in flow or + drawn. The bar never gets a grid row in either layout. */ + .app-shell:not(.app-shell--phone) .destination-dock { display: none; } +} + +/* ── Left rail ────────────────────────────────────────────────────────────── + Width is owned by the grid (200px), never by the rail's contents. */ + +.app-rail { + flex-direction: column; + min-width: 0; + min-height: 0; + padding: var(--space-m) var(--space-s); + background: var(--surface); + border-right: var(--hairline) solid var(--border); +} + +.rail-brand { + display: flex; + align-items: center; + gap: var(--space-s); + min-height: 44px; + padding: 0 var(--space-m); + margin-bottom: var(--space-m); + font-size: 15px; + font-weight: 650; + letter-spacing: -0.01em; +} + +.brand-mark { + width: 18px; + height: 18px; + border-radius: 6px; + background: linear-gradient(135deg, var(--accent), var(--ok)); + box-shadow: 0 0 0 4px rgba(127, 209, 187, 0.10); +} + +.rail-destinations { + display: flex; + flex-direction: column; + gap: 2px; +} + +.rail-item, +.rail-tab { + min-height: 44px; + display: flex; + align-items: center; + gap: var(--space-m); + padding: 0 var(--space-m); + border: 0; + border-radius: var(--radius-s); + background: transparent; + color: var(--muted); + text-align: left; + text-decoration: none; + cursor: pointer; +} + +.rail-item:hover, +.rail-tab:hover { + background: var(--surface-2); + color: var(--text); +} + +.rail-item[aria-current="page"], +.rail-tab[aria-selected="true"] { + color: var(--text); + background: rgba(127, 209, 187, 0.12); + box-shadow: inset 2px 0 0 var(--accent); + font-weight: 600; +} + +.rail-divider { + height: var(--hairline); + margin: var(--space-m) var(--space-s); + background: var(--border); +} + +.rail-heading { + margin: 0 0 var(--space-s); + padding: 0 var(--space-m); + color: var(--muted); + font-size: 11px; + font-weight: 600; + letter-spacing: 0.08em; + text-transform: uppercase; +} + +.rail-tablist { + display: flex; + flex-direction: column; + gap: 2px; +} + +.rail-footer { + margin-top: auto; + display: flex; + align-items: center; + gap: var(--space-s); + min-height: 44px; + padding: 0 var(--space-m); + color: var(--muted); + font-size: 12px; +} + +/* ── Panes ──────────────────────────────────────────────────────────────── */ + +.pane-header { + flex: 0 0 auto; + min-height: 64px; + display: flex; + align-items: center; + justify-content: space-between; + gap: var(--space-m); + padding: var(--space-s) var(--space-l); + border-bottom: var(--hairline) solid var(--border); + background: var(--bg); +} + +.eyebrow { + margin: 0 0 2px; + color: var(--muted); + font-size: 11px; + font-weight: 600; + letter-spacing: 0.08em; + text-transform: uppercase; +} + +.pane-header h1 { + margin: 0; + font-size: 18px; + line-height: 1.2; + letter-spacing: -0.01em; +} + +.count-chip { + min-width: 30px; + padding: 2px 9px; + border: var(--hairline) solid var(--border); + border-radius: 999px; + color: var(--muted); + font-size: 12px; + text-align: center; +} + +.list-tools { + flex: 0 0 auto; + display: flex; + align-items: center; + gap: var(--space-xs); + padding: var(--space-s) var(--space-m); + border-bottom: var(--hairline) solid var(--border); +} + +.tool-button { + min-height: 32px; + padding: 0 10px; + border: var(--hairline) solid var(--border); + border-radius: var(--radius-s); + background: var(--surface-2); + color: var(--text); + font-size: 12px; + cursor: pointer; +} +.tool-button:hover { border-color: var(--accent); } + +.tool-spacer { flex: 1 1 auto; } + +.live-badge { + display: inline-flex; + align-items: center; + gap: 6px; + color: var(--ok); + font-size: 11px; + font-weight: 600; +} + +.status-dot { + width: 7px; + height: 7px; + flex: 0 0 auto; + border-radius: 50%; + background: var(--ok); + box-shadow: 0 0 0 3px rgba(107, 211, 154, 0.12); +} +.status-dot--ok { background: var(--ok); } + +.list-scroll, +.pane-scroll { + flex: 1 1 auto; + min-height: 0; + overflow: auto; + overscroll-behavior: contain; + scrollbar-gutter: stable; +} + +.list-scroll { padding: var(--space-s); } +.pane-scroll { padding: var(--space-l); } + +.day-heading { + margin: var(--space-s) var(--space-s) var(--space-xs); + color: var(--muted); + font-size: 11px; + font-weight: 600; + letter-spacing: 0.08em; + text-transform: uppercase; +} + +.row-list { + list-style: none; + margin: 0; + padding: 0; + display: flex; + flex-direction: column; + gap: 2px; +} + +.row { + width: 100%; + display: grid; + grid-template-columns: minmax(0, 1fr) auto; + grid-template-areas: + "title chip" + "meta meta" + "last last"; + gap: 3px var(--space-s); + padding: 10px var(--space-m); + border: var(--hairline) solid transparent; + border-radius: var(--radius-m); + background: transparent; + color: var(--text); + text-align: left; + cursor: pointer; +} + +.row:hover { + background: var(--surface); + border-color: var(--border); +} + +.row.is-selected, +.row[aria-current="true"] { + background: var(--surface-2); + border-color: var(--border); + box-shadow: inset 2px 0 0 var(--accent); +} + +.row-title { + grid-area: title; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-weight: 600; +} + +.row .chip { grid-area: chip; align-self: start; } + +.row-meta, +.row-last { + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + color: var(--muted); + font-size: 12px; + font-variant-numeric: tabular-nums; +} +.row-meta { grid-area: meta; } +.row-last { grid-area: last; } + +.chip { + display: inline-flex; + align-items: center; + gap: 5px; + min-height: 22px; + padding: 1px 8px; + border: var(--hairline) solid var(--border); + border-radius: 999px; + background: var(--surface-2); + color: var(--muted); + font-size: 11px; + font-weight: 600; + line-height: 1.2; + white-space: nowrap; +} +.chip::before { + content: ""; + width: 6px; + height: 6px; + border-radius: 50%; + background: currentColor; +} +.chip--ok { color: var(--ok); border-color: rgba(107, 211, 154, 0.30); background: rgba(107, 211, 154, 0.10); } +.chip--bad { color: var(--bad); border-color: rgba(239, 138, 138, 0.32); background: rgba(239, 138, 138, 0.10); } +.chip--warn { color: var(--warn); border-color: rgba(230, 194, 104, 0.30); background: rgba(230, 194, 104, 0.10); } + +/* ── Detail ─────────────────────────────────────────────────────────────── */ + +.detail-header { + align-items: flex-start; + flex-wrap: wrap; + padding-top: var(--space-m); + padding-bottom: var(--space-m); +} + +.detail-heading { min-width: 0; } + +.detail-title-row { + display: flex; + align-items: center; + gap: var(--space-s); + flex-wrap: wrap; +} + +.detail-subtitle { + margin: 4px 0 0; + color: var(--muted); + font-size: 12px; + font-variant-numeric: tabular-nums; +} + +.detail-actions { + display: flex; + gap: var(--space-xs); + margin-left: auto; +} + +.card { + padding: var(--space-m) var(--space-l); + border: var(--hairline) solid var(--border); + border-radius: var(--radius-l); + background: var(--surface); +} +.card + .card { margin-top: var(--space-m); } + +.card h2 { + margin: 0 0 var(--space-m); + color: var(--muted); + font-size: 11px; + font-weight: 600; + letter-spacing: 0.08em; + text-transform: uppercase; +} + +.kv { + display: grid; + grid-template-columns: minmax(92px, 140px) minmax(0, 1fr); + gap: 8px var(--space-m); + margin: 0; +} +.kv div { display: contents; } +.kv dt { color: var(--muted); font-size: 12px; } +.kv dd { + margin: 0; + min-width: 0; + overflow-wrap: anywhere; + font-size: 13px; + font-variant-numeric: tabular-nums; +} + +code { + font-family: var(--font-mono); + font-size: 12px; + color: var(--text); +} + +.inline-status { + display: inline-flex; + align-items: center; + gap: 6px; +} + +.stage-list, +.version-list { + list-style: none; + margin: 0; + padding: 0; + display: flex; + flex-direction: column; + gap: 2px; +} + +.stage-list li, +.version-list li { + display: flex; + align-items: center; + gap: var(--space-m); + min-height: 34px; + padding: 0 var(--space-s); + border-radius: var(--radius-s); +} +.stage-list li:hover, +.version-list li:hover { background: var(--surface-2); } + +.stage-index { + width: 22px; + height: 22px; + display: grid; + place-items: center; + border-radius: 50%; + background: var(--surface-2); + color: var(--muted); + font-size: 11px; + font-variant-numeric: tabular-nums; +} + +.stage-name { flex: 1 1 auto; font-weight: 550; } +.stage-type, +.muted { color: var(--muted); } +.stage-type { font-size: 12px; } + +.version-tag { + min-width: 38px; + color: var(--accent); + font-family: var(--font-mono); + font-size: 12px; +} +.version-list .muted { margin-left: auto; font-size: 12px; } +.small { font-size: 12px; } + +.mobile-header { + gap: var(--space-s); + justify-content: flex-start; +} + +.icon-button { + width: 44px; + height: 44px; + flex: 0 0 auto; + display: grid; + place-items: center; + border: var(--hairline) solid transparent; + border-radius: var(--radius-m); + background: transparent; + color: var(--muted); + cursor: pointer; +} +.icon-button:hover { + background: var(--surface-2); + border-color: var(--border); + color: var(--text); +} + +.disclosure { + width: 100%; + min-height: 44px; + display: flex; + align-items: center; + justify-content: space-between; + gap: var(--space-m); + padding: 0 var(--space-s); + border: 0; + border-radius: var(--radius-s); + background: var(--surface-2); + color: var(--text); + text-align: left; + cursor: pointer; +} +.disclosure:hover { box-shadow: inset 0 0 0 1px var(--border); } +.disclosure-chevron { width: 16px; height: 16px; color: var(--muted); } + +/* ── Narrow section strip ───────────────────────────────────────────────── + Sits in normal flow at the foot of the detail pane, directly above the + fixed destination bar's reserved clearance. The entries are the same + DetailTab keys the wide rail renders, so section state is not duplicated. */ + +.section-strip { + flex: 0 0 auto; + display: flex; + align-items: center; + min-width: 0; + padding: 6px var(--space-s); + background: var(--surface); + border-top: var(--hairline) solid var(--border); + overflow-x: auto; + overflow-y: hidden; + overscroll-behavior-x: contain; + scrollbar-width: none; +} +.section-strip::-webkit-scrollbar { display: none; } + +.strip-tablist { + display: flex; + align-items: center; + gap: 2px; + min-width: 0; +} + +.strip-tab { + flex: 0 0 auto; + min-height: 44px; + display: inline-flex; + align-items: center; + gap: 4px; + padding: 0 var(--space-s); + border: var(--hairline) solid transparent; + border-radius: var(--radius-s); + background: transparent; + color: var(--muted); + font-size: 12px; + white-space: nowrap; + cursor: pointer; +} +.strip-tab .icon { width: 17px; height: 17px; } + +.strip-tab:hover { + background: var(--surface-2); + color: var(--text); +} + +.strip-tab[aria-selected="true"] { + background: var(--surface-2); + border-color: var(--border); + box-shadow: inset 0 -2px 0 var(--accent); + color: var(--text); + font-weight: 600; +} + +/* ── Bottom destination bar ─────────────────────────────────────────────── + A true overlay: position fixed, no grid row, no layout height. The shell + reserves --dock-clearance as padding so the strip and pane end above it. */ + +.destination-dock { + position: fixed; + inset: auto 0 0 0; + z-index: 30; + height: calc(var(--dock-height) + env(safe-area-inset-bottom, 0px)); + display: flex; + align-items: stretch; + gap: var(--space-xs); + padding: var(--space-xs) var(--space-s) + calc(var(--space-xs) + env(safe-area-inset-bottom, 0px)); + background: var(--surface); + border-top: var(--hairline) solid var(--border); +} + +.dock-item { + flex: 1 1 0; + min-width: 0; + min-height: 48px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 2px; + padding: 2px 0; + border-radius: var(--radius-s); + color: var(--muted); + font-size: 11px; + text-decoration: none; +} +.dock-item .icon { width: 21px; height: 21px; } +.dock-item:hover { background: var(--surface-2); color: var(--text); } +.dock-item[aria-current="page"] { + color: var(--accent); + background: rgba(127, 209, 187, 0.10); +} + +/* ── Reduced motion ─────────────────────────────────────────────────────── + The wide/narrow switch is instant. If a transition is added to the rail, + strip, dock or pane entry, it collapses here; no lateral slide, scale or + smooth scrolling is allowed. */ + +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + scroll-behavior: auto !important; + } +} + +/* ── Prototype chrome (not part of the implementation) ─────────────────── */ + +.proto-nav { + position: fixed; + top: 12px; + left: 50%; + transform: translateX(-50%); + z-index: 90; + display: flex; + align-items: center; + gap: 6px; + padding: 6px; + border: var(--hairline) solid var(--border); + border-radius: 999px; + background: rgba(23, 31, 29, 0.92); + box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); + backdrop-filter: blur(8px); + font-size: 12px; +} +.proto-nav a { + padding: 5px 10px; + border-radius: 999px; + color: var(--muted); + text-decoration: none; +} +.proto-nav a:hover { background: var(--surface-2); color: var(--text); } +.proto-title { + padding: 0 8px; + color: var(--text); + font-weight: 650; +} +.proto-hint { + padding: 0 8px 0 4px; + color: var(--muted); +} + +/* The two narrow states are phone-width states. This class keeps them at + 420px while the page is previewed on a desktop; it is not part of the + responsive rule (the real shell has no such class). */ +.app-shell--phone { + position: relative; + width: 100%; + max-width: 420px; + margin-inline: auto; + box-shadow: 0 0 0 1px var(--border), 0 30px 90px rgba(0, 0, 0, 0.55); +} + +@media (min-width: 600px) { + .app-shell--phone .destination-dock { position: absolute; } +} diff --git a/web/design/layout/prototype.html b/web/design/layout/prototype.html new file mode 100644 index 00000000..b12fa6d1 --- /dev/null +++ b/web/design/layout/prototype.html @@ -0,0 +1,470 @@ + + + + + + Pipelines web — L2–L4 layout prototype + + + + + + + + + +
+ +
+ + +
+
+
+
+

Workspace

+

Pipelines

+
+ 12 +
+ +
+ + + + live +
+ +
+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
+
+ +
+
+
+

Pipeline

+
+

Plan and land

+ succeeded +
+

id 24 · v5 · 6 stages · latest version v5

+
+
+ + +
+
+ +
+
+

Summary

+
+
Latest version
v5
+
Content hash
sha256:9f2c41e8a7
+
Created
12 Oct 2026 09:14
+
Updated
19 Oct 2026 14:32
+
Last run
succeeded · run 458 · 12m
+
+
+ +
+

Stages

+
    +
  1. 1planagent
  2. +
  3. 2implementagent
  4. +
  5. 3reviewagent
  6. +
  7. 4landshell
  8. +
+
+ +
+

Versions

+
    +
  • v519 Oct 14:31latest
  • +
  • v418 Oct 16:086 stages
  • +
  • v316 Oct 11:225 stages
  • +
+
+
+
+
+ + +
+
+ + +
+ +
+
+
+
+
+

Workspace

+

Runs

+
+ live +
+ +
+ + + + 12 runs +
+ +
+

Today

+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+ +

Yesterday

+
    +
  • + +
  • +
  • + +
  • +
+
+
+
+ + +
+
+ + +
+ +
+
+ + +
+
+ +
+

Run

+
+

Plan and land

+ succeeded +
+

run 458 · v5 · 12m

+
+
+ +
+
+

Status

+
+
Status
succeeded
+
Started
19 Oct 2026 14:20
+
Finished
19 Oct 2026 14:32
+
Duration
12m
+
+
+ +
+

Run

+
+
Pipeline
24 · v5
+
Stage
land
+
Visits
6 recorded
+
Workspace
/Users/alan/repos/pipelines
+
Content hash
sha256:9f2c41e8a7
+
+
+ +
+

Changes

+ +
+
+ + +
+
+ + +
+
+ + diff --git a/web/docs/a11y-audit.md b/web/docs/a11y-audit.md new file mode 100644 index 00000000..4fdaef8d --- /dev/null +++ b/web/docs/a11y-audit.md @@ -0,0 +1,206 @@ +# Pipelines web client — accessibility audit + +**Date:** 2026-10-19 +**Scope:** the browser client in `web/` (L7 in `web/PARITY.md`), against the live +server on `127.0.0.1:8080`. +**Status:** audit only. This audit adds only this report; no product source, test, +style or config file was changed. + +## What was driven + +The page was served by `web/serve.mjs` on `127.0.0.1:8097` against the live +Pipelines server on `127.0.0.1:8080`, then driven in headless Chrome 1440×900 +through the read-only `web/test/browser.mjs` driver plus the Chrome DevTools +Protocol for real key events, the accessibility tree and reduced-motion +emulation. + +Screens exercised: Pipelines list + filter/sort; Runs list + filter/sort; all +five run-detail tabs; the Timeline stage pane; the Changes diff viewer +(run 438); the artifact gallery and full-screen image viewer (run 430); Chat +list, transcript, composer, actions menu and Rename dialog; Search; the Needs +you sheet (182 entries at capture time); Settings; and URL deep links +(`/runs/:id`, `/runs/:id/stage/:key`, `/pipelines/:id`, `/pipelines/:id/:version`, +`/settings/templates`, `/templates`, and a malformed run id). + +### Screen coverage + +| Screen | What was driven | Checks that were exercised | Findings | +| --- | --- | --- | --- | +| Pipelines list + filters | list load, Filter panel, Sort panel, trigger toggles | names, tab order, Escape, outside click, headings, contrast | M3, M4, M8, S1, S2 | +| Runs list + filters | 438 runs, Filter and Sort panels, row selection | names, 458-control tab walk, Escape, outside click, headings | M3, M4, M8, S1, S2 | +| Run detail tabs | Summary / Graph / Input / Output / Timeline | tab role/selected, names, ArrowRight, headings | M3, M8 | +| Run decision sheet | not reachable (no `waiting` run); source reviewed | dialogue/radio/groups, keyboard, error announcement | S9 | +| Stage pane | opened from a Timeline row, focus walk, Escape | dialog name, initial focus, trap, background inertness, Escape return | M1, M2 | +| Changes viewer | run 438 Summary → expand Changes → open diff | dialog name, initial focus, trap, Escape return, contrast | M1, M2, N1 | +| Artifacts viewer | run 430 gallery → image tile → full-screen viewer | tile semantics, keyboard, viewer focus/trap/Escape, names | M5, S10, N11 | +| Chat | list, menu, Rename dialog, transcript, composer, palette; approval card unavailable (no pending request) | row/menu names, keyboard, Shift+Enter, empty Enter, live semantics | M6, S5, S7, S8, N4, N7 | +| Search | query `plan`, kind/sort controls, results, Escape | names, live region, focus return | M2, S6, N13 | +| Attention sheet | bell → 182-entry sheet, focus walk, Escape | names, duplicate Dismiss, trap, background, Escape return | M1, M7 | +| Settings | Connection, Workspace, Notifications, Templates sections | names, duplicate Disconnect, headings, status | M8, S11, N13 | +| Deep links | 7 paths including a malformed id | route resolution, stage-pane link, fallback | N5 | + +Read-only guarantees observed: + +- No run was started, cancelled, retried or decided. The Retry **confirm** was + opened and dismissed with Escape; no `retry_run`/`cancel_run`/`decide_run` + was sent. +- No chat was created, closed or hidden. The existing operator session was + opened read-only (subscription only); the Rename dialog was opened and + dismissed without saving. The composer draft was exercised and restored. +- No filter was applied, no attention entry was dismissed, no settings were + saved. + +## Summary + +**9 must-fix, 12 should-fix, 15 notes.** The status palette and the rest of the +dark palette pass AA contrast; status is never colour-only. The largest +problems are structural: modal dialogs do not trap focus or hide the +background, tabs are anonymous buttons, and the detail pane sits after hundreds +of list rows in the tab order. Artifact tiles cannot be opened by keyboard, and +several lists expose identical accessible names for different actions. + +## Must-fix (do these in one later item, in this order) + +| # | Finding | Screen(s) | Severity | Evidence | Exact element + file:line | Suggested fix | +| --- | --- | --- | --- | --- | --- | --- | +| M1 | **No modal focus trap; the background stays tabbable.** Tab from the last control goes to `body` or a background row; Shift+Tab from the first goes back into the page. `document.querySelectorAll("[inert]").length === 0` while each measured dialog was open. | Attention sheet, stage pane, Changes viewer, artifact viewer, confirm dialogs, decision sheet, chat Rename/Close, template create | must-fix | DOM + AX (attention, stage, changes, artifact, confirm measured; others structurally identical) | `div.attention-sheet` `src/app.js:1010-1049`; `div.stage-pane` `3244-3282`; `div.change-viewer` `2983-3107`; `div.artifact-viewer` `4047-4160`; `div.confirm-dialog` `3662-3703`; `div.decision-sheet` `3515-3594`; `div.confirm-chat-rename` `5894-5900`; `div.confirm-chat-close` `6946-7005`; `div.template-create-dialog` `2153-2210` | Add one shared dialog controller: record the trigger, move focus to the first control (or the panel), trap Tab/Shift+Tab inside the panel, set `inert` (or `aria-hidden`) on `#content`, `.topbar` and the banner, close on Escape/backdrop, then restore the trigger. Apply it to every `role="dialog"`. | +| M2 | **Some dialogs open with no focus at all, and several never return focus.** Changes viewer and artifact viewer opened with focus still outside the dialog (`document.activeElement === body` in the automated capture, `dialog.contains(activeElement) === false`); confirm also opened on `body` after its trigger was replaced. After Escape, the artifact viewer, confirm, chat actions menu, chat Rename and Search leave focus on `body`. | Changes viewer, artifact viewer, confirm, Action failed, chat menu, chat Rename/Close, template create, Search | must-fix | DOM for changes/artifact/confirm/menu/rename/search; code for Action failed/chat Close/template create | `openChangeViewer` `src/app.js:2978-3107`; `openArtifactViewer` `4043-4160`; `renderConfirmDialog` `3639-3704`; `dismissConfirm` `3628-3631`; `dismissActionError` `3750-3753`; `dismissChatRename` `4890-4893`; `dismissChatClose` `4766-4769`; `closeTemplateCreateDialog` `2137-2144`; chat menu close `8634-8639`; `closeSearch` `7124-7138` | Give each opener an explicit return target and call `.focus()` after render. The same shared controller as M1 should cover this; for the menu, return to its `button.chat-menu-button`; for Search, return to `#searchToggle`. | +| M3 | **The "tabs" are plain buttons: no tablist/tab/tabpanel, no selected state, no arrow-key operation.** Chrome's AX tree reports `role=button` for every top-level and detail tab; `aria-selected`/`aria-current` are absent; the active state exists only as `.active` CSS. ArrowRight on the active detail tab does nothing. | Top nav, pipeline detail tabs, run detail tabs | must-fix | DOM + AX | `tabButton` `src/app.js:1301-1313`; pipeline tab strip `1938-1950`; run tab strip `2686-2701`; `nav.tabs` `1244-1257` | Use `role="tablist"` on the strip, `role="tab"` + `aria-selected` + `aria-controls` on each tab, `role="tabpanel"` + `aria-labelledby` on the body; roving `tabindex` and ArrowLeft/ArrowRight/Home/End. If the top nav stays navigation, at minimum add `aria-current="page"` and `aria-label="Primary"`. | +| M4 | **The detail pane comes after the entire list in tab order; there is no skip link.** From the selected run row to the first detail tab is **351 tab stops** (458 focusables on screen). Pipelines: **29** stops; Chat: **43** stops. No skip link exists on any route. | Runs, Pipelines, Chat | must-fix | DOM (real Tab order / focusable indices) | `renderContent` split order `src/app.js:1265-1277` (list appended before detail); `renderPipelineList` `1695-1701`; `renderRunList` `2362-2406`; `index.html:9-15` (no skip link) | Add a "Skip to detail" link as the first focusable, and after a row is activated move focus to the detail's `h1`/`h2` (and announce it). Alternatively make each list a roving-tabindex listbox so it contributes one stop. | +| M5 | **Artifact tiles are click-only generic divs.** Chrome reports `role=generic`, name `""` for `div.artifact-tile.clickable`; it has no `tabindex`, no key handler and no control role. An image/video tile opens the viewer; a file tile opens a new tab — both only by mouse. | Artifacts gallery and visit artifacts | must-fix | DOM + AX | `renderArtifactTile` `src/app.js:3904-3936`; click handlers `3921`, `3925`, `3932` | Make the tile itself a ` + + + + + + + + +
+ +
…
+ + +
+
…
+ +
…
+ + +
+
+ + + + + +``` + +Rules for the two section mounts: + +- Render only the mount appropriate to the current width, **or** render both and + give each unique ids. In the latter case the hidden mount must be + `display: none` (not merely transparent), so only one tablist is in the + accessibility tree. Never leave two visible tablists. +- `aria-controls` always names the one panel id (`detail-panel`). +- The panel's `aria-labelledby` names the tab id of the **visible** mount. +- A pipeline detail has `Summary`, `Graph`, `Source`; a run detail has + `Summary`, `Graph`, `Input`, `Output`, `Timeline`. Order is the Android + `runDetailTabs` / `pipelineDetailTabs` order; Summary is the default. +- The strip is rendered only when the detail has more than one section + (`selectorStripShown(entryCount) = entryCount > 1`). A list-only screen has + no strip. + +Pane selection: + +- `data-active-pane="list" | "detail"` is the narrow single-pane switch. +- On wide both panes are shown and the attribute is ignored. +- On narrow the inactive pane is `display: none`; if it is kept mounted for a + transition, also set `inert` and `aria-hidden="true"` while covered. +- Selecting a row sets `detail`; Back sets `list` and restores focus to the + originating row. `open`/`close` also updates the URL route, not a local-only + class. + +--- + +## 3. CSS the implementer should produce + +The rules below are the layout contract. Visual finish (tones, radii, chip +styles, icon sizing) can follow `prototype.css`; the grid/flex and overflow +rules should be kept as written. + +```css +.app-root { + display: flex; + flex-direction: column; + height: 100vh; + height: 100dvh; + min-height: 0; +} + +/* Narrow is the default layout. */ +.app-shell { + position: relative; + flex: 1 1 auto; + min-height: 0; + overflow: hidden; + display: grid; + grid-template-columns: minmax(0, 1fr); + grid-template-rows: minmax(0, 1fr); + grid-template-areas: "workspace"; + padding-top: env(safe-area-inset-top, 0px); + padding-bottom: var(--dock-clearance); + background: var(--bg); +} + +.workspace { + grid-area: workspace; + min-width: 0; + min-height: 0; + display: grid; + grid-template-columns: minmax(0, 1fr); + grid-template-rows: minmax(0, 1fr); + grid-template-areas: "main"; +} + +.list-pane, +.detail-pane { + grid-area: main; + min-width: 0; + min-height: 0; + overflow: hidden; + display: none; + flex-direction: column; + background: var(--bg); +} + +.app-shell[data-active-pane="list"] .list-pane, +.app-shell[data-active-pane="detail"] .detail-pane { + display: flex; +} + +/* The one breakpoint: 600px. WindowSize.kt's isWideLayout(600) is true. */ +@media (min-width: 600px) { + .app-shell { + grid-template-columns: var(--rail-width) minmax(0, 1fr); + grid-template-rows: minmax(0, 1fr); + grid-template-areas: "rail workspace"; + padding-bottom: 0; + } + + .app-shell .app-rail { display: flex; } + + .app-shell .workspace { + grid-template-columns: minmax(var(--list-min-width), var(--list-max-width)) minmax(0, 1fr); + grid-template-areas: "list detail"; + } + + .app-shell .list-pane { + grid-area: list; + display: flex; + border-right: var(--hairline) solid var(--border); + } + + .app-shell .detail-pane { + grid-area: detail; + display: flex; + } + + .app-shell .section-strip { display: none; } + .app-shell .destination-dock { display: none; } +} +``` + +```css +:root { + --rail-width: 200px; /* WIDE_RAIL_WIDTH_DP */ + --list-min-width: 200px; + --list-max-width: 360px; + --dock-height: 60px; + --hairline: 1px; + --dock-clearance: calc(var(--dock-height) + env(safe-area-inset-bottom, 0px)); +} +``` + +Rail: + +```css +.app-rail { + display: none; /* narrow: destinations live in the dock */ + flex-direction: column; + min-width: 0; + min-height: 0; + padding: 12px 8px; + background: var(--surface); + border-right: var(--hairline) solid var(--border); +} +.rail-destinations, +.rail-tablist { display: flex; flex-direction: column; gap: 2px; } +.rail-item, +.rail-tab { + min-height: 44px; + display: flex; + align-items: center; + gap: 12px; + padding: 0 12px; + border: 0; + border-radius: 8px; + background: transparent; + color: var(--muted); + text-align: left; + text-decoration: none; +} +.rail-item[aria-current="page"], +.rail-tab[aria-selected="true"] { + color: var(--text); + background: rgba(127, 209, 187, 0.12); + box-shadow: inset 2px 0 0 var(--accent); + font-weight: 600; +} +.rail-footer { margin-top: auto; } +``` + +The rail's **width comes from the grid track** (`grid-template-columns: +var(--rail-width) …`), never from its contents. No collapse control, no hover +peek, no master-pane width constant. + +Panes and scroll: + +```css +.pane-header, +.list-tools, +.section-strip { flex: 0 0 auto; } + +.list-scroll, +.pane-scroll { + flex: 1 1 auto; + min-height: 0; + overflow: auto; + overscroll-behavior: contain; + scrollbar-gutter: stable; +} +``` + +Every grid/flex ancestor of a scroll container needs `min-height: 0`; without it +the pane pushes the socket shell taller instead of scrolling internally. + +Exactly one layer owns the top safe area. The prototype has no topbar, so the +shell owns it with `padding-top`; if the existing `.topbar` already applies +`safe-area-inset-top`, omit that padding from `.app-shell` so the inset is not +counted twice — the same rule Android's shell follows. + +Narrow section strip: + +```css +.section-strip { + display: flex; + align-items: center; + min-width: 0; + padding: 6px 8px; + background: var(--surface); + border-top: var(--hairline) solid var(--border); + overflow-x: auto; + overflow-y: hidden; + overscroll-behavior-x: contain; + scrollbar-width: none; +} +.section-strip::-webkit-scrollbar { display: none; } + +.strip-tablist { display: flex; align-items: center; gap: 2px; min-width: 0; } + +.strip-tab { + flex: 0 0 auto; + min-height: 44px; + display: inline-flex; + align-items: center; + gap: 4px; + padding: 0 8px; + border: 1px solid transparent; + border-radius: 8px; + background: transparent; + color: var(--muted); + font-size: 12px; + white-space: nowrap; +} +.strip-tab[aria-selected="true"] { + color: var(--text); + background: var(--surface-2); + border-color: var(--border); + box-shadow: inset 0 -2px 0 var(--accent); + font-weight: 600; +} +``` + +The strip is in flow at the foot of the detail pane. It scrolls horizontally +when the labels do not fit, never wraps and never hides a label. Five labels +fit at 420px in the prototype at this padding; a longer localisation must scroll +rather than truncate. + +Bottom destination bar: + +```css +.destination-dock { + position: fixed; + inset: auto 0 0 0; + z-index: 30; + height: calc(var(--dock-height) + env(safe-area-inset-bottom, 0px)); + display: flex; + gap: 4px; + padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px)); + background: var(--surface); + border-top: var(--hairline) solid var(--border); +} +.dock-item { + flex: 1 1 0; + min-width: 0; + min-height: 48px; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 2px; + border-radius: 8px; + color: var(--muted); + text-decoration: none; +} +.dock-item[aria-current="page"] { + color: var(--accent); + background: rgba(127, 209, 187, 0.10); +} +``` + +The bar has **no grid area and no reserved row**. It is fixed to the viewport +bottom, painted above the pane with `z-index`. The shell reserves its height as +`padding-bottom: var(--dock-clearance)`, so the strip and the last scrollable +row end above it. That padding is the only space the bar influences. On wide the +bar is `display: none`. + +If a future change lets the bar hide (for example during an open chat +conversation), set `--dock-clearance: 0px` at the same time; do not leave a +reserved band behind a hidden bar. + +--- + +## 4. Focus and ARIA + +- **Skip link** first in the shell, pointing at `#pane-main`. It is the first + tab stop and becomes visible on focus. +- **Landmarks**: rail `aside aria-label="Pipelines navigation"`, workspace + `main id="pane-main" tabindex="-1"`, destinations + `nav aria-label="Destinations"`, strip `nav aria-label="Run sections"`. +- **Destinations** are links (``), not tabs. The current one carries + `aria-current="page"`. Set it in both the rail and the dock; the hidden mount + is not exposed. +- **Section tabs** are `role="tab"` inside `role="tablist"`; the rail tablist is + `aria-orientation="vertical"`, the strip is horizontal. Selected tab has + `aria-selected="true"` and `tabindex="0"`; the rest have `tabindex="-1"` + (roving tabindex). Implement Left/Right/Up/Down/Home/End in JS. Selection is + conveyed by `aria-selected` and the container colour/inset underline, never + by colour alone. +- **Panels** are `role="tabpanel"`, `tabindex="0"`, + `aria-labelledby=""`, and are the only scrolling body of a + detail. Changing a section keeps each section's saved scroll under its stable + key. +- **Pane focus**: after opening a detail, move focus to the detail's `

` + (`tabindex="-1"`) or to `#pane-main`; on Back, return it to the row that + opened it. When narrow, the covered pane is `display:none` and, while + animating, `inert` + `aria-hidden="true"`. +- **Rows**: the whole row is a `