Skip to content

Console redesign stage 4: Device streaming page and Watch links #1430

Closed

Description

@V3RON

Part of #1425.

Scope

Deliver stage 4 of the approved console plan: Device streaming page and Watch links. This is a reviewable slice of the single feature stack, not permission to merge a partial console into main. The parent Shared values owns every cross-stage value/interface. No issue is claimed or ready until independent spec checking finishes.

In short

The operator gets device streaming page and watch links in the approved visual style, with existing identity, session and action semantics. The parent defines render, holder and view-only behavior; quantities below are CSS pixels for layout and milliseconds for request waits unless explicitly stated otherwise.

flowchart LR
  O[Operator] --> P["Stage 4 page or shared UI — changed"]
  P --> S[Existing state hooks]
  S --> M[Pure view models]
  P --> D[Shared design components]
  S --> A[Existing API and live connection]
Loading

If this goes wrong, the operator sees a missing control, a misleading value or content that cannot be read at the selected window size.

Technical spec

Facts

Commit a4e5e7d. Source Facts use this main-reachable commit; the approved design/reference authority remains 3b8c44d, whose source blobs are identical.

# Fact Source
F1 ScreenPanel owns useDeviceScreen and draws the canvas. ui/src/screens/fleet/screen-panel.tsx:9-30
F2 The stream hook has a 200000ms header wait bound. ui/src/state/screen.ts:34-40
F3 Capture requests the worker/device stream URL with each id encoded separately. ui/src/state/screen.ts:188-193
F4 DeviceDrawer mounts the screen under its Screen tab. ui/src/screens/fleet/device-drawer.tsx:16-54
F5 Existing device addresses are worker/id drawer paths. ui/src/model/paths.ts:40-54
F6 The lane has full-response stubs to avoid ETag 304 bodies. e2e/console/stub-answers.ts:6-13
F7 Playwright has named Chromium, Firefox and WebKit projects and a bounded test timeout. playwright.config.ts:8-22
F8 Read-resource mapping distinguishes loading, refusal, unsupported and retained data. ui/src/state/resource.ts:22-46
F9 API requests use a 10000ms default timeout, counted from request setup. ui/src/data/api.ts:1-10

Modules touched

Searches: rg -n 'ScreenPanel|useDeviceScreen|fleetAddress|devicePath|capture' ui/src e2e/console src/contract returned 101 matching lines at the Facts commit. Opened the source surrounding the Facts rows and the stage's model/state/screen entry points. Scope is the explicit file ownership below, not a repository-wide redesign.

  • ui/src/screens/fleet/streaming-page.tsx (new)
  • ui/src/screens/fleet/streaming-page.css (new)
  • ui/src/screens/fleet/screen-panel.tsx
  • ui/src/screens/fleet/screen-panel.css
  • ui/src/screens/fleet/device-drawer.tsx
  • ui/src/screens/fleet/index.tsx (FleetScreen dispatch only)
  • ui/src/state/streaming.ts (new)
  • ui/src/model/streaming.ts (new)
  • ui/src/state/screen.ts (reuse; minimal lifetime adaptations only)
  • e2e/console/screen.spec.ts
  • e2e/console/render-cases/streaming.ts (new)
  • website/src/content/docs/docs/worker/console.mdx and other described website pages, only the owned sections below.

Changed callers follow screen → state → model/data and screen → ds. The In short diagram shows those arrows. The task adds no daemon module or new module factory. DS exports are React components with plain props; new hooks reuse the existing providers.

Implement PLAN stage 4 and render 4. Foundation owns the address grammar and streamPath helper; FleetScreen dispatches streaming: true to StreamingPage and keeps old drawer addresses working. Only change that dispatch function in index.tsx; stage 2 owns FleetBody and WorkerPage. Add the page-specific state hook to resolve worker, device, optional lease/holder and stream offer using shared route queries; compute pure view data in model/streaming.ts. Export types via state, never import model or data from the screen.

Reuse ScreenPanel/useDeviceScreen, one mounted instance on this route. Restyle to a centered phone card with bezel, glow and two overlay pills; actual aspect ratio remains correct for non-phone sources. Pill figures come from the decoder/readout; never hard-code 30 fps or bit rate from the mock. Header breadcrumb, streaming status, Stop watching and menu; right Holder, Device facts and Recent events. An idle device has Device facts and an empty holder state, not a made-up lease. Holder has wrapped id, ring/countdown, complete Copy lease id, Lease details and existing Release action. Stop watching cancels capture and returns to the worker's Devices page; browser back/forward and direct reload work.

DeviceDrawer Screen tab becomes a Watch link; old drawer ?drawer=screen links keep details with Watch, without silently opening a capture. Stage 2 owns device-tile Watch as a plain foundation streamPath link; no stage-2 export or component is needed on this branch. Do not edit worker-page.tsx; both branches use only foundation interfaces. Lease Watch links from stage 3 use the foundation helper when their sibling joins the stack. Stage 4 proves direct/deep and its own drawer Watch on the foundation-based branch; stage 7 owns the functional worker-tile and lease-inspector Watch journeys after sibling integration, so stage 4 imports no sibling implementation. Do not change the input socket, rotate controls, native capture program or backend stream routes.

At stage 4 start, recheck PR #1256 current merge-base/head against the integration baseline; inspected head is 54a1dc3. Preserve ScreenPanel callable props, four-argument useDeviceScreen callers and, if present in merged changes, its optional capture-acquisition argument and cancellation ownership. Reconcile an extracted renderer rather than discarding it. Resolve actual merged changes through normal merge-forward integration; do not overwrite that branch or import its independent /screens route or capture-budget feature. It has no functional prerequisite here. Redesign owns DeviceDrawer hunks against #1133 throughout this feature; external drafts adapt afterward. (decided in delivery, pending the maintainer)

Contract and event changes

None. Search: rg -n 'baselineEntrySchema|requesterIdSchema|stream|baseline.save' src/contract src/http and the stage symbol search above. No daemon wire shape, operation, input socket or business event is added. Reuse existing route paths and validation; no protocol bump. The parent Baselines amendment uses only ready/stale list data and a documentation link; no baseline-saving workflow or progress field is added.

Other code on the same state

Searches: rg -n 'capture|AbortController|workerId|deviceId' ui/src e2e/console returned 356 matching lines at the Facts commit. Existing readers/writers are the route-query cache and live invalidation in state/live.tsx and state/queries.ts, session/API connection classification, state/actions.ts per-item in-flight guard, state/router.ts navigation and shared recent feed in state/events.ts. New presentation consumes these owners, never replaces their persistence, timers or duplicate-write rules.

Component or parallel stage Interaction and winner
Live events and polling Query/cache remains authoritative; server facts update the view, never fixture or screenshot values in production. Renewal changes use the existing renewal path.
Row, inspector, Inbox and search actions One state/actions runner shares the item key; the first active action wins, later clicks stay disabled until completion. No screen sends its own write.
Browser history, page selection and disappearance URL and latest loaded server identity decide selection; missing subject renders the existing missing/refused state, with no stale action target.
Shared recent feed and Activity Existing recent feed owns drawer/inspector subscriptions; Activity owns its own feed, and stage 6 changes only its hook body. Navigation releases the consumer.
Stages 0–7 Parent Shared values is the ownership contract. Stage 0 APIs are frozen at reviewed baseline; stages 1–6 use disjoint page files/hunks/cases/docs sections; stage 7 integrates serially. A necessary shared API change goes back to the foundation owner and is merged forward before consumers continue.
External device/settings drafts and Screens PR Parent Shared values and Tasks schedule redesign first on the current committed baseline. Redesign owns overlapping DevicesTab/actions, Warm pool and DeviceDrawer hunks throughout this feature; external drafts adapt afterward through normal merge-forward resolution. Stage 4 rechecks actual Screens PR merge-base/head and preserves compatible capture APIs; foundation changes only its owned shell docs. No external task is a prerequisite, claimed, edited or imported.

Failure modes

Call Outcome What happens Limit, counted from
Existing route query → API ok, 200/304 Render mapped data; 304 retains cached identity. Visual/functional Tests below cover the changed presentation. Existing default 10000ms from request setup; no new wait
Same error reply / malformed reply Existing LoadView refusal/unsupported or cached data plus refusal is rendered; no success counts fabricated. Visual Tests include refused/unavailable data. Same request bound
Same absent worker/device/lease Existing missing-subject view; clear actionable selection and avoid stale target. Functional cases below cover missing identity where applicable; shared foundation behavior is exercised by existing workers/leases specs. After bounded request settles, no additional wait
Same network unavailable / throws / no answer Preserve cache and connection/session handling; do not show connection loss as a page-specific business failure. Existing queries/live/session tests own transport classification; this task adds no transport branch. Existing API timeout from request setup
Existing action runner ok / refused / no answer / concurrent click Keep confirm, cancel, daemon message and shared in-flight behavior. Existing actions.spec.ts owns unchanged runner behavior; changed presentation cases below extend that seam, not duplicate it. Existing action timeoutMs or API default from send; task adds no write
Device stream → capture ok One mounted reader paints current frames and metadata. Lifecycle Tests below. Existing STREAM_HEAD_TIMEOUT_MS from capture request; no new wait
Same unknown / not running / unsupported / disabled Keep refusalOf text and no picture. Refusal Tests below. Same header bound
Same throws / unavailable / no answer Existing session/refusal/timeout path and no stale image. Refusal Tests below. 200000ms from stream request for headers; existing capture policy after start
Same stopped / unmounted / ended / late frame Abort once, release reader/decoder and prevent late paint; stop goes to worker. Lifecycle Tests below. On cleanup; no new retry budget, existing capture retry policy

Presentation/filter/selection state is tab-local; a reload rebuilds from URL and server data. Two tabs read independently and share no new mutable store. The daemon resolves conflicting writes; UI uses the existing runner. A process restart creates no new durable partial state. Existing session/connection tests cover unchanged restart behavior; page Tests exercise remount and selection where changed.

Rules in play

  • coding rule 1, “body is the spec”: implement this stage and parent shared decisions, apply the recorded pending-maintainer delivery decisions.
  • delivery rules 7/14/15, “checked before it is ready” and “one stack”: independent spec/review gates, reviewed foundation baseline and merge-forward integration, no early main merge.
  • documentation rule 9, “same change”: update the owned website section and every other page describing the changed behavior.
  • ui/AGENTS.md Layers, “A screen never fetches”: state hooks expose view models; DS receives plain values, no screen-to-screen imports in final code.
  • ADR 0011 §§1–5, “No inline script and no <style> element”: bundle assets, retain CSP provider and existing session.
  • ADR 0037 §§3–5, “One list of actions per kind of item”: reuse runner, model availability, confirmation, errors and toast semantics.
  • ADR 0044 §§1–3, “One query cache”: consume existing keys, clock and feed; no new independent polling.
  • ADR 0045 §§1,3–6, “route names a worker and a device”: keep identity/lifetime and existing policy, view-only console.

Tests

Seam: signed-in console browser, model pure exports where explicitly named; extend e2e/console/screen.spec.ts, ui/src/state/screen.test.ts and model the screenshots on e2e/console/views.spec.ts. Do not duplicate unchanged transport or action-runner tests. Copy these parent Behaviours rows, one test per line with cases in a table.

  • An operator follows Watch and sees the streaming page for the correct worker and device: cases device drawer, direct deep reload, encoded ids, legacy ?drawer=screen link, stream metadata/readout values differing from the reference and a non-phone landscape source with preserved picture aspect ratio; the phone, holder, facts and recent events identify the same device and both overlay pills reflect actual metadata/statistics.
  • An operator watches one device and owns one stream until leaving or stopping: cases Stop watching, route change, back, device switch, hidden tab, sign-out, lease renewal and device state change, existing four-argument callers and merged optional capture acquisition with cancellation ownership; extend screen.spec.ts and state/screen.test.ts.
  • An operator watches a device and sees the existing stream refusal or end state without a stale picture: cases unknown worker/device, not running, unsupported driver, disabled capability, authorization loss, header timeout, capture end and late frame after cancellation.
  • An operator uses the streaming holder actions without starting input or a second capture: cases idle device, held device, copy full lease id, unavailable clipboard API, denied clipboard access, clipboard no-answer deadline, successful and rejected clipboard settlement after timeout or navigation, Lease details, release confirm or cancel or refusal; assert no input WebSocket opens and copy failures follow the parent message/focus/selectable-id rule.
  • A reviewer inspects stage 4 pages and sees the approved shape with no overflow or accessibility violations: cases 4-streaming.png, 1440×900, 1280×800, 390×844, dark and light; compare each dark reference and current PNG, run both-theme axe and list data differences and only the explicit Baselines/Fleet, preserved-collapse header-control and evidence-backed WCAG-AA colour amendments recorded in PLAN.

Done when

  • Every Tests line is covered at its named seam; relevant model/unit tests and touched Chromium page specs pass. The browser lane uses faked drivers, not native hardware.
  • Capture this stage's pages through pnpm test:console --project=chromium e2e/console/renders.spec.ts (page-specific --grep permitted). Compare current PNGs to 4-streaming.png; inspect every non-data difference, fix/rerun until none remain except the explicit Baselines/Fleet, preserved-collapse header-control and evidence-backed WCAG-AA colour amendments recorded in PLAN. The PR includes paired images for each reference page and lists remaining data differences; no-render pages include current images. Do not commit generated current/ or prototype/screens/.
  • Check the same pages at 1440×900, 1280×800 and 390×844: no horizontal page scroll, card escape or text collision. Axe in both light and dark has no WCAG AA violations and actually evaluates color contrast. Per-page verification is required in this stage, not deferred to stage 7.
  • Update website pages describing this stage in the same change. Ownership: Own Open a device / Watch in worker/console.mdx and Watch a device / What to expect in using-devices/watching-the-screen.mdx; preserve API/input reference sections. Run pnpm --dir website install && pnpm --dir website build && node website/scripts/check-openapi.mjs when the website changes.
  • Direct Watch reload and Stop/navigation/sign-out prove one owned capture, no stale frames and no device-input socket.

Out of scope

Other stages' owned files/hunks; new device management, warm-target editing, Settings or multi-device Screens behavior; backend/protocol/native capture changes; new input sockets. Apply the parent delivery decisions and document the explicit Baselines amendment; preserve every other reference requirement.

Depends on

Written by an agent.

Activity

  1. added
    task:draft
    on Nov 7, 2026
  2. V3RON commented on Nov 7, 2026

    @V3RON
    ContributorAuthor

    Spec updated: reconciled source citations, test ownership/cases and explicit reference exceptions; targeted checks precede readiness.

    Written by an agent.

  3. added
    task:ready
    and removed
    task:draft
    on Nov 7, 2026
  4. V3RON commented on Nov 9, 2026

    @V3RON
    ContributorAuthor

    Delivered in #1454 (merged with #1435, caa5b4e40 on main): this stage was built on its own branch and merged into the integrated PR.

    Written by an agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    task:ready

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions