Skip to content

feat(cockpit): add browser session client - #3205

Merged
leshy merged 1 commit into
mainfrom
paul/feat/t3-p2
Jul 29, 2026
Merged

feat(cockpit): add browser session client#3205
leshy merged 1 commit into
mainfrom
paul/feat/t3-p2

Conversation

@paul-nechifor

@paul-nechifor paul-nechifor commented Jul 27, 2026

Copy link
Copy Markdown
Contributor
  • Set up the vite + vitest toolchain. They'll be set up in CI in the following PR.
  • The browser can now hold a live viewer session against the relay: find the robot, adopt its manifest, subscribe, and keep the decoded frames in a store.
  • No UI yet, that commes later.
  • It automatically reconnects if the relay drops (e.g. because it was restarted).
  • Rate and age are measured in the robot's clock, burst-delivered backlog reads as its true rate and age instead of as fresh fast data.

@greptile-apps

greptile-apps Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a browser-side cockpit session client.

  • Introduces reconnecting WebTransport control and data-plane handling.
  • Adds manifest-driven subscriptions, JSON decoding, channel/status stores, and React hooks.
  • Adds Deno/Vite/Vitest configuration, dependencies, protocol fixtures, and session/store/transport tests.

Confidence Score: 3/5

The reconnect state-retention defect should be fixed before merging because replacement sessions can display telemetry left by a dead producer.

A new transport run reuses the Session's non-null manifest and ChannelStore, so receiving an identical manifest bypasses reset and leaves old channel slots visible under the newly confirmed producer.

Files Needing Attention: web/cockpit/src/session/session.ts

Important Files Changed

Filename Overview
web/cockpit/src/session/session.ts Implements session orchestration, but reconnect runs retain channel values when the replacement manifest is identical.
web/cockpit/src/session/transport.ts Adds WebTransport connection setup, timeout handling, capped backoff, and lifecycle callbacks.
web/cockpit/src/session/store.ts Adds bounded channel state, source-time rate and age statistics, subscriptions, resets, and sequence rebaselining.
web/cockpit/src/session/decoders/json.ts Adds fatal UTF-8 JSON decoding with payload and preview size limits.
web/cockpit/vite.config.ts Configures React, shared protocol aliases, relay proxying, external workspace access, and threaded Vitest execution.
web/deno.json Adds cockpit to the Deno workspace and scopes existing root checks and tests to relay/shared code.

Sequence Diagram

sequenceDiagram
    participant UI as Cockpit UI
    participant Session
    participant Transport as ReconnectingTransport
    participant Relay
    UI->>Session: startSession()
    Session->>Transport: start()
    Transport->>Relay: fetch /api/info and connect
    Session->>Relay: hello
    Relay-->>Session: welcome and robots
    Session->>Relay: watch robot
    Relay-->>Session: manifest
    Session->>Relay: subscribe to decodable channels
    Relay-->>Session: data frames
    Session-->>UI: publish channel snapshots
    Relay--xTransport: connection closes
    Transport->>Relay: reconnect
    Note over Session: Existing manifest and slots remain
    Relay-->>Session: identical replacement manifest
    Note over Session,UI: Equal-manifest branch preserves stale slots
Loading

Reviews (1): Last reviewed commit: "feat(cockpit): add browser session clien..." | Re-trigger Greptile

Comment thread web/cockpit/src/session/session.ts
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

@@            Coverage Diff             @@
##             main    #3205      +/-   ##
==========================================
- Coverage   75.02%   75.01%   -0.01%     
==========================================
  Files        1120     1120              
  Lines      107091   107091              
  Branches     9719     9719              
==========================================
- Hits        80340    80339       -1     
- Misses      23941    23944       +3     
+ Partials     2810     2808       -2     
Flag Coverage Δ
OS-ubuntu-24.04-arm 68.60% <ø> (ø)
OS-ubuntu-latest 70.69% <ø> (-0.01%) ⬇️
Py-3.10 70.68% <ø> (-0.01%) ⬇️
Py-3.11 70.69% <ø> (-0.01%) ⬇️
Py-3.12 70.69% <ø> (+<0.01%) ⬆️
Py-3.13 70.68% <ø> (-0.01%) ⬇️
Py-3.14 70.69% <ø> (ø)
Py-3.14t 70.68% <ø> (ø)
SelfHosted-Large 29.23% <ø> (ø)
SelfHosted-Linux 35.79% <ø> (+<0.01%) ⬆️
SelfHosted-macOS 34.87% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added the ready-to-merge Required CI checks have passed on this PR label Jul 27, 2026
@paul-nechifor
paul-nechifor marked this pull request as draft July 27, 2026 10:39
@github-actions github-actions Bot removed the ready-to-merge Required CI checks have passed on this PR label Jul 27, 2026
@paul-nechifor
paul-nechifor marked this pull request as ready for review July 28, 2026 03:45
@github-actions github-actions Bot added the ready-to-merge Required CI checks have passed on this PR label Jul 28, 2026
Base automatically changed from paul/feat/t3-p1 to main July 29, 2026 05:13
@github-actions github-actions Bot added ready-to-merge Required CI checks have passed on this PR and removed ready-to-merge Required CI checks have passed on this PR labels Jul 29, 2026
@leshy
leshy added this pull request to the merge queue Jul 29, 2026
Merged via the queue into main with commit b927717 Jul 29, 2026
33 checks passed
@leshy
leshy deleted the paul/feat/t3-p2 branch July 29, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Required CI checks have passed on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants