Skip to content

Console redesign stage 3: Leases table, summary and inspector #1429

Closed

Description

@V3RON

Part of #1425.

Scope

Deliver stage 3 of the approved console plan: Leases table, summary and inspector. 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 leases table, summary and inspector 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 3 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 The leases hook holds filtering/paging and reads leases, tokens and workers. ui/src/state/leases.ts:87-105
F2 Lease drawer actions derive from the same leaseActions as list actions. ui/src/state/leases.ts:60-84
F3 The drawer has Details/Events tabs, not a Screen tab. ui/src/screens/leases/drawer.tsx:14-53
F4 Lease events use the shared recent-feed hook. ui/src/screens/leases/drawer.tsx:56-75
F5 The lane has full-response stubs to avoid ETag 304 bodies. e2e/console/stub-answers.ts:6-13
F6 Playwright has named Chromium, Firefox and WebKit projects and a bounded test timeout. playwright.config.ts:8-22
F7 Read-resource mapping distinguishes loading, refusal, unsupported and retained data. ui/src/state/resource.ts:22-46
F8 API requests use a 10000ms default timeout, counted from request setup. ui/src/data/api.ts:1-10

Modules touched

Foundation first integrates only the existing Leases Holder cell and additive identity/display/kind fields as the parent Holder-cell scope exception specifies. Stage 3 starts from that reviewed baseline, owns its subsequent Leases layout/inspector changes and preserves full identity/search/action semantics; these hunks are never edited concurrently.

Searches: rg -n 'LeaseDrawer|useLeases|leaseInspection|useRecentEvents' ui/src e2e/console src/contract returned 24 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/leases
  • ui/src/model/leases.ts
  • ui/src/state/leases.ts
  • e2e/console/leases.spec.ts
  • e2e/console/actions.spec.ts (lease assertions only)
  • e2e/console/render-cases/leases.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 3 and renders 5/6: filter/search, Held by / Device / Worker / Expires in table, no Granted column, count-only footer, fixed-width right summary or inspector. The summary shows By holder bars, By platform rings, Ending in 5 min and Longest held, calculated from the full current lease collection, not only the visible page. Group holders by complete identity, not truncated display text; platform totals retain worker/device association and omit unknown classification rather than inventing a platform. Renewed deadlines update countdowns through existing cache/clock hooks.

The inspector replaces the summary without changing table width; selection keeps URL and browser history semantics. Close restores summary and focus to the originating row, if it still exists. Below the shared inspector breakpoint use a modal drawer with focus trapping and Escape. At the breakpoint itself keep the pane. With no selection on narrow screens put the summary below the table. Reuse the inspection hook, actions runner and recent feed. Remove Details/Events tabs and compose facts and recent events directly. The source has no lease Screen tab (F3); do not add one merely to remove it.

Watch uses foundation state/navigation streamPath and the lease's actual worker/device ids, not its lease id. Only offer when that identity and a streamable running state are known; missing data does not guess. Stage 4 provides the route on the sibling branch, so this link becomes usable after stack integration. Copy id copies the complete id. Copy id failures: if the Clipboard API is absent, rejects (including NotAllowedError), or has not settled within 5000 ms counted from the click, announce "Couldn't copy. Select and copy the id." without a success toast, keep focus on Copy id and leave the complete id selectable. No legacy clipboard workaround, permission request, retry loop or daemon write. A late result after timeout/navigation must not publish success. Use a fake clock for deadline tests (decided in delivery, pending the maintainer). Release keeps existing confirmation, in-flight guard, error and toast semantics. Inbox may continue to reuse LeaseDrawer; provide a presentation prop for pane versus drawer rather than mounting two inspectors and two event consumers.

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 'leases|ttlDeadline|useRecentEvents' ui/src e2e/console returned 540 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

Copy id failures: if the Clipboard API is absent, rejects (including NotAllowedError), or has not settled within 5000 ms counted from the click, announce "Couldn't copy. Select and copy the id." without a success toast, keep focus on Copy id and leave the complete id selectable. No legacy clipboard workaround, permission request, retry loop or daemon write. A late result after timeout/navigation must not publish success. Use a fake clock for deadline tests (decided in delivery, pending the maintainer).

Foundation mechanically moves the existing Fleet worker-action cases from e2e/console/actions.spec.ts into e2e/console/workers.spec.ts before page branches fork, preserving their titles, assertions and action semantics. It splits the combined lease/worker case at that point without dropping either half. Stage 2 owns subsequent worker-layout locator adaptation and coverage in workers.spec.ts; it leaves actions.spec.ts untouched. Stage 3 owns only the remaining lease-inspector assertions in actions.spec.ts. No parallel page owner edits the same test hunks. (decided in delivery, pending the maintainer)

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

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/leases.spec.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 opens Leases and sees the full-collection summary beside its filtered table: cases all or expiring or platform filter, search, empty data, unknown device, duplicate shortened holders and pagination.
  • An operator selects, closes or follows a lease and sees one stable inspector: cases row click, keyboard, deep link, browser back, missing lease, live renewal, 1280px pane and 1279px drawer, narrow summary and focus restoration.
  • An operator uses lease Watch, Copy id or Release and sees the correct result: cases encoded worker/device streaming link, missing identity, unavailable stream, complete clipboard id, unavailable clipboard API, denied clipboard access, clipboard no-answer deadline, successful and rejected clipboard settlement after timeout or navigation, confirm, cancel, refused release and duplicate click; extend leases.spec.ts and the lease-only assertions in actions.spec.ts.
  • An operator reads lease Recent events in the inspector or Inbox drawer and sees only that lease once: cases replay, live duplicate, feed refusal, close and reopen, selection switch and one shared subscription.
  • A reviewer inspects stage 3 pages and sees the approved shape with no overflow or accessibility violations: cases 5-leases-empty.png, 6-leases-selected.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 5-leases-empty.png, 6-leases-selected.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 Leases sections in worker/console.mdx and gateway/fleet-console.mdx. Run pnpm --dir website install && pnpm --dir website build && node website/scripts/check-openapi.mjs when the website changes.

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