Merge branch 'main' into web-split

This commit is contained in:
2026-10-19 16:38:27 +01:00
10 changed files with 2772 additions and 154 deletions
+7 -1
View File
@@ -63,7 +63,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.
+5 -5
View File
@@ -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-<id>-decision-card.png`, `captures/42-run-<id>-decision-sheet.png`, `captures/43-run-<id>-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. 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 |
@@ -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 |
+96 -127
View File
@@ -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://<this page's host>/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://<this page's host><port>/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.
+48
View File
@@ -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();
}
+801
View File
@@ -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; }
}
+470
View File
@@ -0,0 +1,470 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pipelines web — L2–L4 layout prototype</title>
<link rel="stylesheet" href="prototype.css">
</head>
<body>
<!-- Prototype-only state switcher. It is hidden whenever a screen is targeted,
so captures are full-bleed. -->
<nav class="proto-nav" aria-label="Prototype states">
<span class="proto-title">Layout prototype</span>
<a href="#wide">Wide · 1440</a>
<a href="#runs">Narrow runs · 420</a>
<a href="#detail">Narrow run detail · 420</a>
<span class="proto-hint">load a hash and size the viewport to match</span>
</nav>
<svg class="icon-sprite" aria-hidden="true" focusable="false" width="0" height="0">
<symbol id="i-branch" viewBox="0 0 24 24">
<circle cx="6" cy="5" r="2" fill="currentColor" stroke="none"></circle>
<circle cx="6" cy="19" r="2" fill="currentColor" stroke="none"></circle>
<circle cx="18" cy="12" r="2" fill="currentColor" stroke="none"></circle>
<path d="M6 7v10M8 12h8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path>
</symbol>
<symbol id="i-clock" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="8" fill="none" stroke="currentColor" stroke-width="1.8"></circle>
<path d="M12 8v4l3 2" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path>
</symbol>
<symbol id="i-chat" viewBox="0 0 24 24">
<path d="M4 6.5A2.5 2.5 0 0 1 6.5 4h11A2.5 2.5 0 0 1 20 6.5v7a2.5 2.5 0 0 1-2.5 2.5H10l-6 4V6.5Z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linejoin="round"></path>
</symbol>
<symbol id="i-settings" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="3" fill="none" stroke="currentColor" stroke-width="1.8"></circle>
<path d="M12 3v2M12 19v2M3 12h2M19 12h2M5.6 5.6 7 7M17 17l1.4 1.4M18.4 5.6 17 7M7 17l-1.4 1.4" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path>
</symbol>
<symbol id="i-info" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="8" fill="none" stroke="currentColor" stroke-width="1.8"></circle>
<path d="M12 11v5M12 8h.01" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path>
</symbol>
<symbol id="i-graph" viewBox="0 0 24 24">
<circle cx="6" cy="6" r="2" fill="none" stroke="currentColor" stroke-width="1.8"></circle>
<circle cx="18" cy="9" r="2" fill="none" stroke="currentColor" stroke-width="1.8"></circle>
<circle cx="10" cy="18" r="2" fill="none" stroke="currentColor" stroke-width="1.8"></circle>
<path d="m8 7 8 1M8 8l1 8M16 11l-5 6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path>
</symbol>
<symbol id="i-code" viewBox="0 0 24 24">
<path d="m8 8-4 4 4 4M16 8l4 4-4 4M13 5l-2 14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path>
</symbol>
<symbol id="i-input" viewBox="0 0 24 24">
<path d="M12 4v10M8 10l4 4 4-4M5 19h14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path>
</symbol>
<symbol id="i-output" viewBox="0 0 24 24">
<path d="M12 20V10M8 14l4-4 4 4M5 5h14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path>
</symbol>
<symbol id="i-list" viewBox="0 0 24 24">
<path d="M8 6h12M8 12h12M8 18h12M4 6h.01M4 12h.01M4 18h.01" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path>
</symbol>
<symbol id="i-back" viewBox="0 0 24 24">
<path d="M15 5l-7 7 7 7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path>
</symbol>
<symbol id="i-chevron" viewBox="0 0 24 24">
<path d="M9 5l7 7-7 7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path>
</symbol>
</svg>
<!-- ─────────────────────────────────────────────────────────────────────
Wide state: 200px left rail + pipeline list + pipeline detail.
Captured at 1440 × 900.
───────────────────────────────────────────────────────────────────── -->
<section class="screen" id="wide" aria-label="Wide pipelines layout">
<a class="skip-link" href="#wide-main">Skip to content</a>
<div class="app-shell" data-active-pane="detail">
<aside class="app-rail" aria-label="Pipelines navigation">
<div class="rail-brand">
<span class="brand-mark" aria-hidden="true"></span>
<span>Pipelines</span>
</div>
<nav class="rail-destinations" aria-label="Destinations">
<a class="rail-item" href="#wide" aria-current="page">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-branch"></use></svg>
<span>Pipelines</span>
</a>
<a class="rail-item" href="#runs">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-clock"></use></svg>
<span>Runs</span>
</a>
<a class="rail-item" href="#runs">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-chat"></use></svg>
<span>Chat</span>
</a>
<a class="rail-item" href="#wide">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-settings"></use></svg>
<span>Settings</span>
</a>
</nav>
<div class="rail-divider" role="presentation"></div>
<div class="rail-sections">
<p class="rail-heading" id="wide-sections-label">Sections</p>
<div class="rail-tablist" role="tablist" aria-labelledby="wide-sections-label" aria-orientation="vertical">
<button class="rail-tab" id="wide-rail-tab-summary" type="button" role="tab"
aria-selected="true" aria-controls="wide-panel" tabindex="0">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-info"></use></svg>
<span>Summary</span>
</button>
<button class="rail-tab" id="wide-rail-tab-graph" type="button" role="tab"
aria-selected="false" aria-controls="wide-panel" tabindex="-1">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-graph"></use></svg>
<span>Graph</span>
</button>
<button class="rail-tab" id="wide-rail-tab-source" type="button" role="tab"
aria-selected="false" aria-controls="wide-panel" tabindex="-1">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-code"></use></svg>
<span>Source</span>
</button>
</div>
</div>
<div class="rail-footer">
<span class="status-dot" aria-hidden="true"></span>
<span>Connected</span>
</div>
</aside>
<main class="workspace" id="wide-main" tabindex="-1">
<section class="list-pane" aria-label="Pipelines list">
<header class="pane-header">
<div>
<p class="eyebrow">Workspace</p>
<h1>Pipelines</h1>
</div>
<span class="count-chip" aria-label="12 pipelines">12</span>
</header>
<div class="list-tools">
<button class="tool-button" type="button">Filter</button>
<button class="tool-button" type="button">Sort</button>
<span class="tool-spacer"></span>
<span class="live-badge"><span class="status-dot" aria-hidden="true"></span> live</span>
</div>
<div class="list-scroll">
<ul class="row-list">
<li>
<button class="row is-selected" type="button" aria-current="true">
<span class="row-title">Plan and land</span>
<span class="chip chip--ok">succeeded</span>
<span class="row-meta">id 24 · v5 · 6 stages</span>
<span class="row-last">updated 19 Oct 14:32 · run 458 · 12m</span>
</button>
</li>
<li>
<button class="row" type="button">
<span class="row-title">Server</span>
<span class="chip chip--bad">failed</span>
<span class="row-meta">id 22 · v6 · 4 stages</span>
<span class="row-last">updated 19 Oct 13:05 · run 457 · 2m 08s</span>
</button>
</li>
<li>
<button class="row" type="button">
<span class="row-title">Docs site</span>
<span class="chip">no runs</span>
<span class="row-meta">id 18 · v3 · 3 stages</span>
<span class="row-last">updated 18 Oct 09:41 · no runs recorded</span>
</button>
</li>
<li>
<button class="row" type="button">
<span class="row-title">Nightly audit</span>
<span class="chip chip--warn">running</span>
<span class="row-meta">id 12 · v9 · 5 stages</span>
<span class="row-last">updated 19 Oct 14:20 · run 456 · 00:42</span>
</button>
</li>
<li>
<button class="row" type="button">
<span class="row-title">Release notes</span>
<span class="chip chip--ok">succeeded</span>
<span class="row-meta">id 09 · v2 · 3 stages</span>
<span class="row-last">updated 17 Oct 18:02 · run 449 · 4m 10s</span>
</button>
</li>
</ul>
</div>
</section>
<section class="detail-pane" aria-label="Pipeline detail">
<header class="pane-header detail-header">
<div class="detail-heading">
<p class="eyebrow">Pipeline</p>
<div class="detail-title-row">
<h1>Plan and land</h1>
<span class="chip chip--ok">succeeded</span>
</div>
<p class="detail-subtitle">id 24 · v5 · 6 stages · latest version v5</p>
</div>
<div class="detail-actions">
<button class="tool-button" type="button">Run</button>
<button class="tool-button" type="button">Refresh</button>
</div>
</header>
<div class="pane-scroll" id="wide-panel" role="tabpanel"
aria-labelledby="wide-rail-tab-summary" tabindex="0">
<section class="card">
<h2>Summary</h2>
<dl class="kv">
<div><dt>Latest version</dt><dd>v5</dd></div>
<div><dt>Content hash</dt><dd><code>sha256:9f2c41e8a7</code></dd></div>
<div><dt>Created</dt><dd>12 Oct 2026 09:14</dd></div>
<div><dt>Updated</dt><dd>19 Oct 2026 14:32</dd></div>
<div><dt>Last run</dt><dd><span class="inline-status"><span class="status-dot status-dot--ok" aria-hidden="true"></span>succeeded · run 458 · 12m</span></dd></div>
</dl>
</section>
<section class="card">
<h2>Stages</h2>
<ol class="stage-list">
<li><span class="stage-index">1</span><span class="stage-name">plan</span><span class="stage-type">agent</span></li>
<li><span class="stage-index">2</span><span class="stage-name">implement</span><span class="stage-type">agent</span></li>
<li><span class="stage-index">3</span><span class="stage-name">review</span><span class="stage-type">agent</span></li>
<li><span class="stage-index">4</span><span class="stage-name">land</span><span class="stage-type">shell</span></li>
</ol>
</section>
<section class="card">
<h2>Versions</h2>
<ul class="version-list">
<li><span class="version-tag">v5</span><span>19 Oct 14:31</span><span class="muted">latest</span></li>
<li><span class="version-tag">v4</span><span>18 Oct 16:08</span><span class="muted">6 stages</span></li>
<li><span class="version-tag">v3</span><span>16 Oct 11:22</span><span class="muted">5 stages</span></li>
</ul>
</section>
</div>
</section>
</main>
<nav class="destination-dock" aria-label="Destinations">
<a class="dock-item" href="#wide" aria-current="page">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-branch"></use></svg>
<span>Pipelines</span>
</a>
<a class="dock-item" href="#runs">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-clock"></use></svg>
<span>Runs</span>
</a>
<a class="dock-item" href="#runs">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-chat"></use></svg>
<span>Chat</span>
</a>
<a class="dock-item" href="#wide">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-settings"></use></svg>
<span>Settings</span>
</a>
</nav>
</div>
</section>
<!-- ─────────────────────────────────────────────────────────────────────
Narrow state: one pane, no section strip on a list. Captured at 420 × 900.
───────────────────────────────────────────────────────────────────── -->
<section class="screen" id="runs" aria-label="Narrow runs layout">
<a class="skip-link" href="#runs-main">Skip to content</a>
<div class="app-shell app-shell--phone" data-active-pane="list">
<main class="workspace" id="runs-main" tabindex="-1">
<section class="list-pane" aria-label="Runs list">
<header class="pane-header mobile-header">
<div>
<p class="eyebrow">Workspace</p>
<h1>Runs</h1>
</div>
<span class="live-badge"><span class="status-dot" aria-hidden="true"></span> live</span>
</header>
<div class="list-tools">
<button class="tool-button" type="button">Filter</button>
<button class="tool-button" type="button">Sort</button>
<span class="tool-spacer"></span>
<span class="muted small">12 runs</span>
</div>
<div class="list-scroll">
<p class="day-heading">Today</p>
<ul class="row-list">
<li>
<button class="row" type="button">
<span class="row-title">Plan and land</span>
<span class="chip chip--ok">succeeded</span>
<span class="row-meta">run 458 · v5 · 12m</span>
<span class="row-last">14:32 · implementer · 6 stages</span>
</button>
</li>
<li>
<button class="row" type="button">
<span class="row-title">Server</span>
<span class="chip chip--bad">failed</span>
<span class="row-meta">run 457 · v6 · 2m 08s</span>
<span class="row-last">13:05 · planner · needs you</span>
</button>
</li>
<li>
<button class="row" type="button">
<span class="row-title">Nightly audit</span>
<span class="chip chip--warn">running</span>
<span class="row-meta">run 456 · v9 · 00:42</span>
<span class="row-last">14:20 · auditor · 5 stages</span>
</button>
</li>
</ul>
<p class="day-heading">Yesterday</p>
<ul class="row-list">
<li>
<button class="row" type="button">
<span class="row-title">Release notes</span>
<span class="chip chip--ok">succeeded</span>
<span class="row-meta">run 449 · v2 · 4m 10s</span>
<span class="row-last">18:02 · writer · 3 stages</span>
</button>
</li>
<li>
<button class="row" type="button">
<span class="row-title">Docs site</span>
<span class="chip chip--bad">failed</span>
<span class="row-meta">run 448 · v3 · 1m 31s</span>
<span class="row-last">17:40 · builder · 3 stages</span>
</button>
</li>
</ul>
</div>
</section>
</main>
<nav class="destination-dock" aria-label="Destinations">
<a class="dock-item" href="#wide">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-branch"></use></svg>
<span>Pipelines</span>
</a>
<a class="dock-item" href="#runs" aria-current="page">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-clock"></use></svg>
<span>Runs</span>
</a>
<a class="dock-item" href="#runs">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-chat"></use></svg>
<span>Chat</span>
</a>
<a class="dock-item" href="#runs">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-settings"></use></svg>
<span>Settings</span>
</a>
</nav>
</div>
</section>
<!-- ─────────────────────────────────────────────────────────────────────
Narrow run detail: section strip above the destination bar.
Captured at 420 × 900.
───────────────────────────────────────────────────────────────────── -->
<section class="screen" id="detail" aria-label="Narrow run detail layout">
<a class="skip-link" href="#detail-main">Skip to content</a>
<div class="app-shell app-shell--phone" data-active-pane="detail">
<main class="workspace" id="detail-main" tabindex="-1">
<section class="list-pane" aria-label="Runs list" aria-hidden="true"></section>
<section class="detail-pane" aria-label="Run detail">
<header class="pane-header detail-header mobile-header">
<button class="icon-button" type="button" aria-label="Back to Runs">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-back"></use></svg>
</button>
<div class="detail-heading">
<p class="eyebrow">Run</p>
<div class="detail-title-row">
<h1>Plan and land</h1>
<span class="chip chip--ok">succeeded</span>
</div>
<p class="detail-subtitle">run 458 · v5 · 12m</p>
</div>
</header>
<div class="pane-scroll" id="run-panel" role="tabpanel"
aria-labelledby="run-strip-tab-summary" tabindex="0">
<section class="card">
<h2>Status</h2>
<dl class="kv">
<div><dt>Status</dt><dd><span class="inline-status"><span class="status-dot status-dot--ok" aria-hidden="true"></span>succeeded</span></dd></div>
<div><dt>Started</dt><dd>19 Oct 2026 14:20</dd></div>
<div><dt>Finished</dt><dd>19 Oct 2026 14:32</dd></div>
<div><dt>Duration</dt><dd>12m</dd></div>
</dl>
</section>
<section class="card">
<h2>Run</h2>
<dl class="kv">
<div><dt>Pipeline</dt><dd>24 · v5</dd></div>
<div><dt>Stage</dt><dd>land</dd></div>
<div><dt>Visits</dt><dd>6 recorded</dd></div>
<div><dt>Workspace</dt><dd><code>/Users/alan/repos/pipelines</code></dd></div>
<div><dt>Content hash</dt><dd><code>sha256:9f2c41e8a7</code></dd></div>
</dl>
</section>
<section class="card">
<h2>Changes</h2>
<button class="disclosure" type="button" aria-expanded="false">
<span>4 files changed · +86 −21</span>
<svg class="icon disclosure-chevron" aria-hidden="true" focusable="false"><use href="#i-chevron"></use></svg>
</button>
</section>
</div>
<nav class="section-strip" aria-label="Run sections">
<div class="strip-tablist" role="tablist" aria-label="Run sections">
<button class="strip-tab" id="run-strip-tab-summary" type="button" role="tab"
aria-selected="true" aria-controls="run-panel" tabindex="0">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-info"></use></svg>
<span>Summary</span>
</button>
<button class="strip-tab" id="run-strip-tab-graph" type="button" role="tab"
aria-selected="false" aria-controls="run-panel" tabindex="-1">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-graph"></use></svg>
<span>Graph</span>
</button>
<button class="strip-tab" id="run-strip-tab-input" type="button" role="tab"
aria-selected="false" aria-controls="run-panel" tabindex="-1">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-input"></use></svg>
<span>Input</span>
</button>
<button class="strip-tab" id="run-strip-tab-output" type="button" role="tab"
aria-selected="false" aria-controls="run-panel" tabindex="-1">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-output"></use></svg>
<span>Output</span>
</button>
<button class="strip-tab" id="run-strip-tab-timeline" type="button" role="tab"
aria-selected="false" aria-controls="run-panel" tabindex="-1">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-list"></use></svg>
<span>Timeline</span>
</button>
</div>
</nav>
</section>
</main>
<nav class="destination-dock" aria-label="Destinations">
<a class="dock-item" href="#wide">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-branch"></use></svg>
<span>Pipelines</span>
</a>
<a class="dock-item" href="#runs" aria-current="page">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-clock"></use></svg>
<span>Runs</span>
</a>
<a class="dock-item" href="#runs">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-chat"></use></svg>
<span>Chat</span>
</a>
<a class="dock-item" href="#runs">
<svg class="icon" aria-hidden="true" focusable="false"><use href="#i-settings"></use></svg>
<span>Settings</span>
</a>
</nav>
</div>
</section>
</body>
</html>
+206
View File
@@ -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 `<button>` (or `role="button" tabindex="0"` with Enter/Space) named `Open {artifact name}`; move the viewer/tab action there. Keep Copy link/Share as sibling buttons and stop propagation. Mark the video poster glyph decorative. |
| M6 | **A chat row is a `role=button` containing another real button, and its name absorbs "Chat actions".** AX name of the row is e.g. `New chat Operator Open Idle · … Chat actions`; the inner action button is also a tab stop. 19–21 rows expose the identical `Chat actions` name, and many rows share identical `New chat …` names. | Chat list | must-fix | DOM + AX | `renderChatRow` `src/app.js:5514-5552` (row `role=button` at `5516`, menu appended at `5550`); `renderChatActionsMenu` `5672-5736` | Make the title/meta area the session button and render the actions button as its sibling, not a child. Name the actions control `Chat actions for {title}` (include session id or directory when titles repeat). Drop `role=button` from the row container. |
| M7 | **Every attention-row dismiss control is named exactly "Dismiss".** The captured sheet had 181–182 identical names; a screen-reader user cannot tell which run each one dismisses. | Needs you sheet | must-fix | DOM + AX | `renderAttentionRow` `src/app.js:1053-1089` (`aria-label: "Dismiss"` at `1079`) | Use `aria-label="Dismiss {run label}"` (optionally `— {pipeline}`/kind); keep the visible ✕ and `title`. |
| M8 | **No `h1` on any route, and the list routes have no headings at all.** `document.querySelectorAll("h1").length === 0` on `/pipelines`, `/runs`, `/chat`, `/settings`, `/templates`. Pipeline/Runs list views have zero headings; details begin at `h2`; Settings has four `h2`s; Chat has an `h2` and markdown `h4`/`h5`. | All screens | must-fix | DOM | `renderContent` `src/app.js:1244-1257`; pipeline list `1695-1701`; run list `2362-2406`; `renderSettingsView` `1326-1335`; chat title `5759`; `index.html` (no server-rendered heading) | Render one `h1` per route ("Pipelines", the run/pipeline title, "Chat", "Settings", "Templates") and an `h2` for each list. Keep Settings sections at `h2`; ensure markdown headings start below the transcript heading. |
| M9 | **Timeline rows have no visible focus ring.** `.timeline-row:focus-visible` removes the outline and changes only the background from `--surface` to `--surface-2` (≈1.2:1). The row's other focus styling is absent. | Run detail → Timeline | must-fix | DOM/CSS (`outline: none`, `:focus-visible` true) | `styles.css:790` (`.timeline-row:hover, .timeline-row:focus-visible { background: var(--surface-2); outline: none; }`) | Add `outline: 2px solid var(--accent); outline-offset: -2px;` (matching `.chat-row`/`.change-row`) or another ≥3:1 ring. |
## Should-fix
| # | Finding | Screen(s) | Severity | Evidence | Exact element + file:line | Suggested fix |
| --- | --- | --- | --- | --- | --- | --- |
| S1 | **Selection is not exposed.** Selected pipeline, run and chat rows are marked only by `.selected` (background + inset bar); no `aria-current`/`aria-selected` reaches the AX tree. | Pipelines, Runs, Chat | should-fix | DOM + AX | `renderPipelineRow` `src/app.js:1920-1924`; `renderRunRow` `2450-2453`; `renderChatRow` `5514-5529` | Add `aria-current="true"` to the selected row, or implement the lists as listboxes with `option` + `aria-selected`. |
| S2 | **Pipeline/run Filter and Sort popovers ignore Escape and outside clicks, and their triggers do not expose expanded state.** Escape left `#runFilterMenu`/`#sortPanel` open; clicking the detail pane did not close it. Triggers have no `aria-expanded`; the menus have no role. | Pipelines list, Runs list | should-fix | DOM | Triggers `src/app.js:1721-1741` and `2506-2525`; panels `1756-1823`, `2544-2601`; global Escape `8591-8643` (no filter/sort branch) | Add `aria-expanded`/`aria-controls` on both triggers, close on Escape and outside pointerdown, and give the panels `role="group"`/`role="menu"` with a label. Return focus to the trigger. |
| S3 | **The header server-URL field is named by its placeholder.** AX name is `ws://HOST:PORT/connect`, not "Server URL"; it is the only form field in the header with no label. (Settings' field is correctly named "Server URL".) | Global header | should-fix | AX | `#url` `src/app.js:815-824` | Add a visually hidden or visible `<label for="url">Server URL</label>` (or `aria-label="Server URL"`), and keep the placeholder as an example. |
| S4 | **The document title never changes per route.** Every route reports `Pipelines — web spike`; deep links and SPA navigation do not update it. | All screens / deep links | should-fix | DOM | `index.html:6`; no `document.title` assignment in `src/app.js` (verified by grep) | Set `document.title` from the current route/detail ("Pipelines", "Runs — {run}", "Chat — {title}", "Settings", "Templates — {template}"). |
| S5 | **The chat actions menu advertises `role="menu"` but does not support menu keys, and Escape loses focus.** ArrowDown leaves focus on `Rename…`; Escape closes the menu but focus lands on `body`. | Chat list → Chat actions | should-fix | DOM | Menu `src/app.js:5691-5734`; open/focus `4861-4878`; Escape `8634-8639` | Implement roving focus with ArrowUp/ArrowDown/Home/End (and optional typeahead), and return focus to the `Chat actions for …` trigger on Escape/selection. |
| S6 | **The Search panel is an unlabelled generic div.** `#searchPanel` has no role or accessible name; it is a disclosure rather than a landmark. Its Escape focus loss is covered by M2. | Search | should-fix | DOM | Panel `src/app.js:7311`; open/close `7108-7138` | Give the panel `role="search"`/`role="dialog"` + `aria-label="Search"`, and keep the field labelled. |
| S7 | **The slash-command highlight is visual only.** The textarea has no `aria-controls`/`aria-activedescendant`; ArrowDown changes `aria-selected` on the option but the AX tree gets no active-descendant change, so screen readers do not hear the highlighted command. | Chat composer | should-fix | DOM | Textarea `src/app.js:6780-6790`; palette `6741-6747`, 6815-6839; key handler `5085-5100` | Give options ids and set `aria-controls="chatPalette"` + `aria-activedescendant` on `#chatInput` as the highlight moves (and `aria-expanded`). |
| S8 | **Live updates are not announced.** `#chatTranscript` has no `role="log"`/`aria-live`/label, so streamed answer text and the approval card are silent; the approval card has no `role="alert"`; run status updates have no live region either. | Chat transcript/approval, Runs list/detail | should-fix | DOM for transcript (no attributes); code for approval/run updates | Transcript `src/app.js:6072-6123`; approval card `6152-6188`; approval jump `6126-6142` | Make the transcript a labelled `role="log"` with `aria-live="polite"` (avoid announcing every delta: announce turn boundaries); give a newly actionable approval `role="alert"`/`aria-live="assertive"`; add a polite live region for run status changes. |
| S9 | **The decision sheet's radiogroup does not behave like one** (code-read; no `waiting` run was live). All options are tab stops with `role="radio"`, arrow keys are not handled, and selecting an option calls `renderContent()`, which replaces the button and drops focus. The error line is not `role="alert"`. | Run decision sheet | should-fix | Code | Options `src/app.js:3532-3553`; select handler `3541-3544`; error `3570` | Roving `tabindex` (selected option = 0, others -1), ArrowUp/ArrowDown/ArrowLeft/ArrowRight selection, restore focus to the chosen option after render, and `role="alert"` on the error. |
| S10 | **Artifact action names are duplicated without context.** In run 430's gallery: `Copy link` ×8 and `Share` ×18, with no artifact name in the accessible name. | Artifacts gallery / visit artifacts | should-fix | DOM + AX | `renderTileActions` `src/app.js:3938-3966` | Use `aria-label="Copy link to {name}"` / `"Share {name}"`. |
| S11 | **Two different "Disconnect" buttons on Settings.** The header `#connectBtn` and the Settings primary `#settingsPrimary` are both named `Disconnect`, with no distinguishing context. | Settings | should-fix | AX | Header `src/app.js:833-838`; Settings primary `1381-1395` | Name them by scope ("Disconnect server" / "Disconnect (header)") or hide the header connection controls while Settings is open. |
| S12 | **`prefers-reduced-motion` does not stop the spinner.** Under emulated `prefers-reduced-motion: reduce`, `.spinner` still reports `animation-name: spin; animation-duration: 0.8s`. The graph halo and search progress do stop. | All screens with loading/spinners | should-fix | DOM (CDP media emulation) | `styles.css:390-400`; existing media blocks `662-664` and `1296-1298` | Add `.spinner { animation: none; }` (or a non-rotating loading treatment) to the reduced-motion block. |
## Notes, passes and limits
| # | Observation | Screen(s) | Severity | Evidence | Element + file:line |
| --- | --- | --- | --- | --- | --- |
| N1 | **Status palette contrast passes.** On `--surface` (#171f1d): running 7.62, waiting 11.22, succeeded 9.13, failed 6.94, canceled 5.30, interrupted 9.82, queued 6.68, blocked 8.08, skipped 8.28, unknown 9.88. On `--surface-2`: all ≥4.67 (worst: canceled #889391). Flow-outcome colours are 7.25–12.5. `--muted` is 7.38/6.51. No low-contrast text was found on any audited screen (`lowContrastCount: 0`). | All | note (pass) | DOM (computed colours + WCAG formula) | `styles.css:2-14`, `211-219`, `809-827` |
| N2 | **Status is not colour-only.** Every chip carries its status word; the live badge carries its word; decorative dots are `aria-hidden="true"`. The only state that is still visual-only is the active/selected row/tab, covered by M3/S1. | All | note (pass) | DOM | `styles.css:208-231`; `src/app.js:2535-2542` |
| N3 | **No unnamed controls.** Across the audited screens every focusable control had a non-empty accessible name (447–484 controls on Runs across states, 50–88 in Chat). Icon-only controls (Send, Stop, Attach file, Chat actions, notification bell, remove attachment, Close) all carry `aria-label`. The one unnamed interactive element is the non-focusable artifact tile (M5). | All | note (pass) | DOM + AX | `src/app.js:6867-6881` (Send/Stop), `6765-6777` (Attach), `1076-1088` (Dismiss) |
| N4 | **Composer keyboard works.** Shift+Enter inserted a newline (`"line one\n"`); Enter on an empty draft sent nothing and did not change the transcript. Code confirms Enter submits only through `composerSubmit`. Enter-with-text was **not** sent live (to avoid writing to the operator's chat). | Chat composer | note (pass) | DOM for Shift+Enter/empty Enter; code for Enter-with-text | `onComposerKeydown` `src/app.js:5085-5100` |
| N5 | **URL deep links route correctly.** `/runs/438` and `/runs/438/stage/implementer` opened the run and stage pane; `/pipelines/20` and `/pipelines/20/10` opened the detail; `/settings/templates` and `/templates` are aliases; `/runs/not-a-number` fell back to `/pipelines`. The stage pane opened with its dialog label and Escape returned to `/runs/438`. | Deep links | note (pass) | DOM | `src/routes.js`; `src/app.js:7539-7551` |
| N6 | **Reduced motion is partial.** The graph halo and search progress both become `animation: none` under emulation; only the spinner is missed (S12). | Graph, Search, spinners | note | DOM (emulation) | `styles.css:662-664`, `1296-1298` |
| N7 | **The approval card was not reachable live.** No permission was pending on the live server, so its findings (S8) are code-read; its controls are labelled text buttons and the risk panel is not colour-only. | Chat approval | note (limit) | Code | `src/app.js:6152-6220` |
| N8 | **The decision sheet was not reachable live.** No `waiting` run existed, so S9 is code-read. | Run decision sheet | note (limit) | Code | `src/app.js:3487-3620` |
| N9 | **Focus rings are otherwise visible.** Every other tabbed control showed Chrome's `outline: auto 1px rgb(153, 200, 255)`; chat/change rows show a 2px accent ring. Timeline is the sole missing ring (M9). The inputs that set `outline: none` (decision feedback, template name, rename) still change their border to `--accent`. | All | note | DOM (real Tab walk) | `styles.css:790`, `1334`, `1408`, `1430`, `1526`, `2046` |
| N10 | **Markdown headings inside Chat start at `h4`/`h5` under the `h2` chat title**, so the in-transcript outline skips levels. This is content-generated, but the page outline fix (M8) should account for it. | Chat transcript | note | DOM | `renderMarkdownBlock` `src/app.js:6590-6595` |
| N11 | **The video artifact poster's `▶` is plain text, not `aria-hidden`.** The tile has no accessible name anyway (M5); after M5 the glyph should be decorative. | Artifacts | note | DOM | `src/app.js:3922-3925` |
| N12 | `html lang="en"` is present, and there is one `main` landmark. The single `nav` has no `aria-label` (minor; M3 adds one). | All | note | DOM | `index.html:2`; `src/app.js:1244-1257` |
| N13 | Search results use `aria-live="polite"` and the Settings notification state uses `role="status"`; both are present and correctly scoped. The Settings URL error sets `aria-invalid` + `role="alert"`; the workspace field sets `aria-invalid` and a described helper, but that helper is not a live region (minor). | Search, Settings | note (pass) | DOM | `src/app.js:7309`, `1544`, `1564-1565`, `1573-1582` |
| N14 | Dialogs do expose a name: every `role="dialog"` had an `aria-label` (or a titled heading). The gap is focus management, not naming. The stage pane's name is only the stage key (`implementer`), so "Stage: implementer, run 438" would be clearer. | All dialogs | note | AX | `src/app.js:1014`, `3248`, `3520`, `3666` |
| N15 | The `Dismiss`, `Chat actions`, `Copy link` and `Share` name collisions are real AX-tree duplicates, not just visual repeats. They are listed as M6/M7/S10; `Disconnect` is S11. | Runs/Chat/Artifacts/Settings | note | AX | see M6/M7/S10/S11 |
## Escape and focus-return matrix
| Overlay | Escape closes it? | Where focus goes afterwards | Evidence |
| --- | --- | --- | --- |
| Needs you sheet | yes | `#attentionBell` (correct) | DOM |
| Stage pane | yes | the originating timeline row (correct) | DOM |
| Changes viewer | yes | the originating change row (correct) | DOM |
| Artifact viewer | yes | `body` — no restore | DOM |
| Confirm (Retry/Cancel/Restart) | yes | `body` — no restore | DOM |
| Chat actions menu | yes | `body` — no restore | DOM |
| Chat Rename dialog | yes | `body` — no restore | DOM |
| Search panel | yes | `body` — no restore | DOM |
| Pipelines Filter / Sort | **no — stays open** | focus remains wherever it was (`body` in the test) | DOM |
| Runs Filter / Sort | **no — stays open** | focus remains wherever it was (`body` in the test) | DOM |
| Decision sheet | yes (code) | `Decide` card button (code) | code |
| Chat Close confirm | yes (code) | no explicit restore (code) | code |
| Action failed | yes (code) | no explicit restore (code) | code |
| Template create | yes (code) | no explicit restore (code) | code |
## Evidence and method
### Real DOM / accessibility-tree checks
- **Accessible names:** 7 controls queried with `Accessibility.getPartialAXTree`
on `/runs/438`; chat row, menu button, composer, Send, attention row/dismiss,
settings fields, search row and input queried in follow-up runs. This is how
the header URL placeholder name, the nested "Chat actions" name, the empty
artifact-tile name and the duplicate Dismiss names were confirmed.
- **Tab order and focus rings:** real CDP `Input.dispatchKeyEvent` Tab presses
with computed outline/background comparison against each element's unfocused
style. The focus-distance numbers (351/29/43) come from the actual focusable
order.
- **Dialogs:** opened the attention sheet, stage pane, Changes viewer, artifact
viewer, confirm, chat menu and Rename dialog; focused their first/last
controls and pressed Tab/Shift+Tab; measured `[inert]`, `aria-hidden`, active
element and post-Escape active element.
- **Composer:** Shift+Enter and empty-Enter were sent through CDP with real key
events; the draft was restored.
- **Reduced motion:** `Emulation.setEmulatedMedia` with
`prefers-reduced-motion: reduce`; `matchMedia` confirmed true and computed
animation names were read.
- **Contrast:** computed colours from the live page and the WCAG relative
luminance formula; `--surface`, `--surface-2` and `--bg` were all checked.
### Code-read only (unreachable or deliberately not exercised)
- **Decision sheet (S9):** no `waiting` run on the live server.
- **Approval card (N7/S8):** no pending `chat_permission`.
- **Chat Close confirm / Action failed / template create:** read from source and
not opened/confirmed, to avoid a state change and because the dialogs are not
on the required screen list. Their focus behaviour follows the same pattern
as the measured dialogs.
- **Enter-with-text in the composer (N4):** intentionally not sent; the handler
is read from source.
- **Artifact tile keyboard failure (M5):** confirmed by DOM/AX (`role=generic`,
no tabindex, no key handler), not by attempting a keyboard activation.
### Commands run
```sh
cd /Users/alan/repos/pipelines/web
node serve.mjs --host 127.0.0.1 --port 8097 --pipelines 127.0.0.1:8080
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8097/
# Read-only audit scripts (outside the repo) importing web/test/browser.mjs
node /tmp/a11y/explore.mjs
node /tmp/a11y/audit.mjs
node /tmp/a11y/targeted.mjs
node /tmp/a11y/targeted2.mjs
node /tmp/a11y/targeted3.mjs
```
The audit scripts imported `web/test/browser.mjs` without modifying it. They
launched the installed Chrome headless at 1440×900 and used a fresh profile.
Raw capture files: `/tmp/a11y/audit.json`, `/tmp/a11y/targeted.json`,
`/tmp/a11y/targeted2.json`.
## One-item must-fix checklist
1. Add the shared dialog controller (M1/M2) and convert every `role="dialog"`
to use it: focus entry, Tab trap, `inert` background, Escape/backdrop,
focus return.
2. Convert top-level and detail tabs to `tablist`/`tab`/`tabpanel` with
`aria-selected`, roving `tabindex` and arrow keys (M3).
3. Add the skip link and move focus to the detail heading after a list row is
activated (M4).
4. Turn artifact tiles into real buttons with `Open {name}` names (M5).
5. Restructure the chat row so the session and its actions are siblings; give
every actions and Dismiss control a unique name (M6/M7).
6. Add one `h1` per route and an `h2` for each list view (M8).
7. Restore a visible focus ring on `.timeline-row` (M9).
8. Re-run `node --test test/`, `node test/ui-smoke.mjs` and a short AX/Tab
spot-check on the changed screens; add regression assertions for the
dialog trap, tab roles and artifact-tile keyboard activation.
+574
View File
@@ -0,0 +1,574 @@
# Pipelines web client — L2–L4 layout specification
Design-only deliverable for **L2 (wide: left rail + list/detail panes)**, **L3
(narrow: bottom section strip above the bottom destination bar)** and **L4
(responsive switch by viewport width)**. It does not change `web/src/app.js`,
`web/styles.css`, `web/index.html`, `web/test/**` or the Android app.
Read with:
- `web/design/layout/prototype.html` and `prototype.css` — the rendered mock and
the reference CSS.
- `web/design/layout/capture.mjs` — headless-Chrome capture of the mock.
- Android sources that define the same structure:
`ui/WindowSize.kt` (600dp predicate), `ui/components/DetailTabs.kt`
(200dp section rail, narrow strip), `ui/components/SelectorStrip.kt`
(bottom strip), `ui/DestinationBar.kt` (destinations) and
`ui/PipelinesApp.kt` (`pillVisible`, overlay, strip clearance).
Palette: copied verbatim from `web/styles.css` `:root` (`--bg`, `--surface`,
`--surface-2`, `--border`, `--text`, `--muted`, `--accent`, `--ok`, `--warn`,
`--bad`).
---
## 1. Layout contract
| | Narrow (viewport < 600 CSS px) | Wide (viewport ≥ 600 CSS px) |
| --- | --- | --- |
| Shell | one pane at a time | 200px left rail + list pane + detail pane |
| Section index | bottom strip inside the detail pane | vertical group in the left rail |
| Destinations | fixed bottom destination bar | left rail destination group |
| Detail strip | visible only on a detail pane, above the bar | hidden (the rail is the selector) |
| Bottom bar | `position: fixed`, out of flow | hidden |
| Pane scroll | `overflow: auto` inside the pane | same, per pane |
One breakpoint only: **600 CSS px**, expressed as
`@media (min-width: 600px)`. It is the web analogue of
`isWideLayout(widthDp) = widthDp >= WIDE_LAYOUT_MIN_WIDTH_DP` with
`WIDE_LAYOUT_MIN_WIDTH_DP = 600`. Do not add a second breakpoint, device
sniffing, `screen.width`, user-agent checks or a fixed device width.
At exactly 600px the columns are `200px | minmax(200px, 360px) | 1fr`; the
detail gets the remaining 200px. The rail never shrinks and never scrolls
horizontally; the list may use its 200–360px range.
`widthDp` and CSS px are both logical units. Browser zoom changes the CSS-px
viewport and therefore switches the layout, which is the intended analogue of a
window-size change.
---
## 2. DOM structure
Render one shell per app; the router fills the panes. The wide rail mount and
the narrow strip mount are alternate presentations of the **same** section tab
model (`DetailTab.key`), so the selected key must not change when the viewport
crosses 600px.
```html
<a class="skip-link" href="#pane-main">Skip to content</a>
<div class="app-root"> <!-- existing topbar + banner stay here -->
<header class="topbar">…</header> <!-- unchanged -->
<div class="connbar">…</div> <!-- existing connection banner, unchanged -->
<div class="app-shell" data-active-pane="detail">
<!-- Wide-only. Hidden by the base rules; display:flex from the 600px query. -->
<aside class="app-rail" aria-label="Pipelines navigation">
<div class="rail-brand">Pipelines</div>
<nav class="rail-destinations" aria-label="Destinations">
<a class="rail-item" href="/pipelines" aria-current="page">Pipelines</a>
<a class="rail-item" href="/runs">Runs</a>
<a class="rail-item" href="/chat">Chat</a>
<a class="rail-item" href="/settings">Settings</a>
</nav>
<div class="rail-divider" role="presentation"></div>
<div class="rail-sections">
<p class="rail-heading" id="rail-sections-label">Sections</p>
<div class="rail-tablist" role="tablist"
aria-labelledby="rail-sections-label" aria-orientation="vertical">
<button class="rail-tab" id="rail-tab-summary" type="button" role="tab"
aria-selected="true" aria-controls="detail-panel" tabindex="0">Summary</button>
<button class="rail-tab" id="rail-tab-graph" type="button" role="tab"
aria-selected="false" aria-controls="detail-panel" tabindex="-1">Graph</button>
<!-- Input, Output, Timeline for a run; Source for a pipeline. -->
</div>
</div>
<div class="rail-footer"><span class="status-dot"></span> Connected</div>
</aside>
<main class="workspace" id="pane-main" tabindex="-1">
<!-- List pane. Both panes exist; narrow shows exactly one. -->
<section class="list-pane" aria-label="Runs list">…</section>
<!-- Detail pane. Its section strip is narrow-only. -->
<section class="detail-pane" aria-label="Run detail">
<header class="pane-header detail-header">…</header>
<div class="pane-scroll" id="detail-panel" role="tabpanel"
aria-labelledby="rail-tab-summary" tabindex="0">…</div>
<nav class="section-strip" aria-label="Run sections">
<div class="strip-tablist" role="tablist" aria-label="Run sections">
<button class="strip-tab" id="strip-tab-summary" type="button" role="tab"
aria-selected="true" aria-controls="detail-panel" tabindex="0">Summary</button>
<button class="strip-tab" id="strip-tab-graph" type="button" role="tab"
aria-selected="false" aria-controls="detail-panel" tabindex="-1">Graph</button>
<button class="strip-tab" id="strip-tab-input" type="button" role="tab"
aria-selected="false" aria-controls="detail-panel" tabindex="-1">Input</button>
<button class="strip-tab" id="strip-tab-output" type="button" role="tab"
aria-selected="false" aria-controls="detail-panel" tabindex="-1">Output</button>
<button class="strip-tab" id="strip-tab-timeline" type="button" role="tab"
aria-selected="false" aria-controls="detail-panel" tabindex="-1">Timeline</button>
</div>
</nav>
</section>
</main>
<!-- Fixed overlay, narrow-only. No grid area. -->
<nav class="destination-dock" aria-label="Destinations">
<a class="dock-item" href="/pipelines">Pipelines</a>
<a class="dock-item" href="/runs" aria-current="page">Runs</a>
<a class="dock-item" href="/chat">Chat</a>
<a class="dock-item" href="/settings">Settings</a>
</nav>
</div>
</div>
```
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 (`<a>`), 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="<visible tab id>"`, 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 `<h1>`
(`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 `<button>` or `<a>`; selected row in wide carries
`aria-current="true"`. Nested status chips are text, not controls.
- **Touch targets**: 44px minimum (`min-height`) for rail items, tabs, dock
items and row actions; 48px for the dock item itself, matching the Android
platform minimum.
- Do not put `aria-hidden="true"` on focusable content that remains in flow.
- Preserve the existing search/attention/dialog focus traps; the layout rails
add no focusable content behind an open modal.
---
## 5. Reduced motion
The wide/narrow switch is instantaneous: no animated rail width, no sliding
list, no strip collapse. Section changes may cross-fade in place; they never
slide laterally (Android's `DetailTabs` is a tab swap, not a pager).
```css
@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;
}
}
```
Under reduced motion a pane navigation becomes an immediate swap, the active
indicator jumps rather than travels, and `scrollIntoView` uses `behavior:
"auto"`. Do not disable the selected state or the focus ring.
---
## 6. What moves into the bottom strip
Only the **detail section index**:
| Detail | Strip entries (in order) |
| --- | --- |
| Run | `Summary`, `Graph`, `Input`, `Output`, `Timeline` |
| Pipeline | `Summary`, `Graph`, `Source` |
Not in the strip: destinations, the back control, `Run`/`Refresh` actions, run
filters/sort, the attention bell, or chat composer controls. The top-level
destinations never share the strip; they are the rail on wide and the fixed bar
on narrow.
On wide the same entries render as the rail's `Sections` group. The active key
(`summary`, `graph`, `input`, `output`, `steps`, `source`) is the single source
of truth across both mounts.
---
## 7. Captures
Captured with `node web/design/layout/capture.mjs` through the repository's
read-only `web/test/browser.mjs` driver at device scale 1.
### Wide — 1440 × 900
![Wide pipelines: 200px rail, pipeline list, pipeline detail](../design/layout/captures/wide-pipelines-1440x900.png)
`web/design/layout/captures/wide-pipelines-1440x900.png`
### Narrow run detail — 420 × 900
![Narrow run detail: Summary/Graph/Input/Output/Timeline strip above the Pipelines/Runs/Chat/Settings bar](../design/layout/captures/narrow-run-detail-420x900.png)
`web/design/layout/captures/narrow-run-detail-420x900.png`
### Narrow runs list — 420 × 900
The list has no section selector, so no strip; the destination bar is still a
fixed overlay.
![Narrow runs list](../design/layout/captures/narrow-runs-420x900.png)
`web/design/layout/captures/narrow-runs-420x900.png`
Capture paths are gitignored by the repository's root `captures/` rule; the
PNGs are review evidence, not tracked source.
---
## 8. Android rules this layout cannot express in CSS alone
1. **Covered-pane compact geometry** (`SlidingPaneStack.kt`). Android measures
the compact identity (icon + shortest label + the live leading gesture inset)
and folds older levels into an edge's `"N more"` count; the active pane's
left edge is that measured region at every depth. CSS cannot measure text or
fold levels. This design avoids the peek entirely (wide shows the full list
beside the detail), as L2 asks. If covered peek strips are added later, JS
must measure and publish the width and the folded count.
2. **Destination visibility is route/state-dependent**
(`destinationPillVisible`). Android hides the pill on an open chat
conversation, an open run detail and an open pipeline detail; CSS cannot know
whether a conversation or detail is open. The brief explicitly asks for the
bar on the narrow run detail, so this design keeps it. Implementers who want
Android's exact predicate must compute it in JS (and clear
`--dock-clearance` with it).
3. **Measured strip height → bar offset** (`pillBottomOffset(stripHeight) =
SPACING_L + stripHeight`). With a fixed-height bar the CSS token is enough.
If the strip can grow (localisation, wrapping, a marker row), a
`ResizeObserver` must write its height into `--dock-clearance`; CSS alone
cannot feed a measured value back into the shell.
4. **Roving tabindex, focus restoration and `inert` on a covered pane** are DOM
behaviours; CSS expresses the visual selected state but not the keyboard
model or focus return.
5. **On-screen keyboard geometry**: Android reads `WindowInsets.ime`; the
browser should use `env(safe-area-inset-*)` plus
`<meta name="viewport" content="interactive-widget=resizes-content">` so the
shell shortens above the keyboard. This is a document/meta and viewport
concern, not a layout-grid rule.
6. **Device-width breakpoint semantics**: Android reads `screenWidthDp` from the
configuration; the browser uses the CSS viewport. At browser zoom, or with a
foldable's app-window width different from the physical screen, the two can
disagree. The CSS query is the correct web equivalent; do not substitute
`screen.width` or a user-agent check.
Two deliberate, documented deltas from the current Android shell:
- On wide, destinations live in the rail rather than in a floating bottom-right
pill. This is the L2 reading of “left rail + list/detail panes”.
- The wide layout shows the full list pane beside the detail rather than
Android's covered compact edge, per the same L2 wording. The destination bar
remains an overlay on narrow, so hiding/showing it never changes a grid
track.
No app code, stylesheet, markup or test was changed by this design item.
+96
View File
@@ -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 };
+469 -21
View File
@@ -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;
@@ -256,6 +273,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) {
@@ -753,6 +1151,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);
@@ -813,6 +1215,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") {
@@ -886,7 +1290,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}`);
@@ -2858,10 +3266,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"));
@@ -2869,7 +3278,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 });
@@ -3094,20 +3503,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`);
@@ -6561,6 +6980,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