Skip to content

feat: web consumes @codeoid/protocol — retire the hand-maintained mirror - #105

Merged
saucam merged 1 commit into
mainfrom
feat/web-consume-protocol
Jul 5, 2026
Merged

feat: web consumes @codeoid/protocol — retire the hand-maintained mirror#105
saucam merged 1 commit into
mainfrom
feat/web-consume-protocol

Conversation

@saucam

@saucam saucam commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

Follow-up deferred from #101 (and the resolution to CodeRabbit's CAPABILITIES-duplication nitpick on #102): the web UI's 700-line hand-synced protocol mirror is gone.

What changed

  • web now depends on @codeoid/protocol via file:../packages/protocol — web stays a standalone package (its CI runs its own bun install --frozen-lockfile, verified working). Bun's link: protocol doesn't accept relative paths, so file: (copy-at-install) it is; the shim header documents the one gotcha: after editing packages/protocol, re-run bun install in web/ (CI always installs fresh).
  • web/src/protocol/types.ts is now a one-line re-export shim — all existing ../protocol/types imports across web/src resolve unchanged, same pattern as the daemon's shims.

The migration instantly caught real drift 🎯

The mirror still typed and handled a "working" SessionStatus that was split into thinking/tool_running before v0.1.0 ever shipped (verified via git log -S + git show v0.1.0) — no published daemon has ever emitted it. Exactly the class of silent divergence this migration exists to kill. Removed the dead handling: StatusDot, Transcript's streaming gate, WorkerIndicator, the approvals active-status set, and two tests (semantics preserved — the "returns null when nothing is waiting" case now uses tool_running, still an approval-possible status).

Verification

web tsc -b clean · eslint clean (2 pre-existing warnings on untouched lines) · 171 tests pass · vite production build green (bundles the TS-source dep) · --frozen-lockfile re-install verified.

Next

@codeoid/core extraction (ws client + reducers + formatters) builds on this — web and mobile then share client logic, not just types.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for shared protocol definitions across the app, helping keep client behavior aligned with the latest message formats.
  • Bug Fixes

    • Updated session status handling so approval prompts, activity indicators, and transcript caret behavior now reflect the correct active states.
    • Improved session list updates to show the latest status changes more reliably.
  • Tests

    • Updated automated checks to match the revised session status behavior.

The web UI kept a 700-line hand-synced copy of the wire types
(web/src/protocol/types.ts, "keep them in sync"). It now depends on
@codeoid/protocol (file:../packages/protocol — web stays a standalone
package; bun's link: doesn't support relative paths) and the mirror file
becomes a one-line re-export shim, so all existing "../protocol/types"
imports resolve unchanged. One source of truth for daemon + web; the
mobile client consumes the same package next.

The switch immediately surfaced real drift the mirror had accumulated:
web still typed and handled a "working" SessionStatus that was split
into thinking/tool_running BEFORE v0.1.0 ever shipped — no published
daemon has ever emitted it. Removed the dead handling (StatusDot,
Transcript streaming gate, WorkerIndicator, approvals active-set, tests).

Note on bun file: semantics — the dep is COPIED at install, not
symlinked; after editing packages/protocol run `bun install` in web/ to
refresh (documented in the shim header). CI installs fresh every run;
--frozen-lockfile verified.

Verified: web tsc clean, eslint clean, 171 tests pass, vite production
build green (bundles the TS-source dep).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 220bc9be-611c-4afa-b868-898d5b3eda57

📥 Commits

Reviewing files that changed from the base of the PR and between f2239d9 and 5c4ad74.

⛔ Files ignored due to path filters (1)
  • web/bun.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (8)
  • web/package.json
  • web/src/components/SessionListPane.tsx
  • web/src/components/transcript/Transcript.tsx
  • web/src/components/transcript/WorkerIndicator.tsx
  • web/src/lib/approvals.test.ts
  • web/src/lib/approvals.ts
  • web/src/protocol/types.ts
  • web/src/state/sessions.test.ts
💤 Files with no reviewable changes (4)
  • web/src/components/transcript/Transcript.tsx
  • web/src/components/transcript/WorkerIndicator.tsx
  • web/src/lib/approvals.ts
  • web/src/components/SessionListPane.tsx

📝 Walkthrough

Walkthrough

This PR removes the "working" session status from status-gating logic across UI components (StatusDot, WorkerIndicator, Transcript) and approval eligibility checks, updating corresponding tests. Separately, it adds a workspace dependency on @codeoid/protocol and converts web/src/protocol/types.ts into a re-export shim.

Changes

Session Status Handling

Layer / File(s) Summary
Status gating logic
web/src/lib/approvals.ts, web/src/components/transcript/WorkerIndicator.tsx, web/src/components/transcript/Transcript.tsx, web/src/components/SessionListPane.tsx
Removes "working" from APPROVAL_POSSIBLE, WorkerIndicator visibility, Transcript streaming-caret condition, and StatusDot switch, favoring "thinking"/"tool_running".
Test updates
web/src/lib/approvals.test.ts, web/src/state/sessions.test.ts
Updates test fixtures and assertions to use "thinking"/"tool_running" instead of "working".

Protocol Package Consolidation

Layer / File(s) Summary
Dependency and re-export shim
web/package.json, web/src/protocol/types.ts
Adds @codeoid/protocol as a local workspace dependency and replaces local protocol type definitions with export * from "@codeoid/protocol".

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related PRs

  • saucam/codeoid#75: Both PRs update pending-approval/session-status gating in web/src/lib/approvals.ts regarding removal of "working" in favor of "thinking"/"tool_running".
  • saucam/codeoid#101: Directly ties to this PR's web/package.json and web/src/protocol/types.ts changes depending on/re-exporting from the new @codeoid/protocol package.
  • saucam/codeoid#102: Ties to this PR's re-export shim in web/src/protocol/types.ts, which now sources capability/auth types from @codeoid/protocol.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: web now consumes @codeoid/protocol instead of maintaining a local protocol mirror.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/web-consume-protocol

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.39%. Comparing base (f2239d9) to head (5c4ad74).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #105   +/-   ##
=======================================
  Coverage   76.39%   76.39%           
=======================================
  Files          70       70           
  Lines       11605    11605           
=======================================
  Hits         8866     8866           
  Misses       2739     2739           
Flag Coverage Δ
daemon 76.39% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@saucam
saucam merged commit 9858cc1 into main Jul 5, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant