Skip to content

refactor(decopilot): remove dead control-frame wire codec - #6164

Open
pedrofrxncx wants to merge 1 commit into
mainfrom
refactor/remove-dead-control-frame-codec-w1
Open

refactor(decopilot): remove dead control-frame wire codec#6164
pedrofrxncx wants to merge 1 commit into
mainfrom
refactor/remove-dead-control-frame-codec-w1

Conversation

@pedrofrxncx

@pedrofrxncx pedrofrxncx commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Source: dead-code sweep (C1) of apps/api/src/api/routes/decopilot/ — the area other PRs this tick weren't touching.

What: encodeControlFrame/decodeControlFrame in control-frames.ts have zero callers anywhere in the repo outside their own test file. rg -n "encodeControlFrame|decodeControlFrame" across the whole tree turns up only the definitions and control-frames.test.ts. The CancelBroadcast.publishControlFrame path these were built to serialize for is a documented no-op in NatsCancelBroadcast (publishControlFrame(_userSub, _frame) {}) and in the app-wiring stub in app.ts — the comment on the interface says the durable cancel_requested_at flag is the real correctness path, so the wire codec was never wired up to anything live.

The ControlFrame type/schema stays: it's still the real contract type for the CancelBroadcast.publishControlFrame(userSub, frame: ControlFrame) interface method used in nats-cancel-broadcast.ts, cancel-broadcast.ts, routes.ts, and app.ts. Only the unused JSON encode/decode functions and their now-orphaned test go.

Payoff: removes vestigial code from the old tunnel-based control-frame delivery so a future reader doesn't waste time tracing a codec that's never called.

Net: -39 lines / +0.

Verified:

  • rg confirms zero callers of either function outside the deleted test.
  • bun run fmt — clean.
  • cd apps/api && bunx tsc --noEmit — clean (no type errors from the removal).
  • bunx oxlint apps/api/src/api/routes/decopilot/control-frames.ts — 0 warnings/errors.

A reviewer can confirm with: rg -n "encodeControlFrame|decodeControlFrame" apps packages (only doc/PR-body hits expected).


Summary by cubic

Removes the unused JSON codec for Decopilot control frames to reduce dead code. The codec had no callers; CancelBroadcast.publishControlFrame is a no-op, and the ControlFrame type/schema remains.

Review notes

  • Deletes control-frames.test.ts and removes encodeControlFrame/decodeControlFrame from control-frames.ts; keeps the ControlFrame schema/type.
  • No runtime behavior change; cancel signaling relies on the durable cancel_requested_at flag.
  • Suggested checks: rg -n "encodeControlFrame|decodeControlFrame" shows no callers; typecheck and lint pass.
  • Migration: none.

Written for commit 3d3d843. Summary will update on new commits.

Review in cubic

encodeControlFrame/decodeControlFrame have zero callers left — the
CancelBroadcast.publishControlFrame path they were built for is a
documented no-op (the durable cancel_requested_at flag is the real
correctness path; see cancel-broadcast.ts), and nothing else in the repo
calls the codec functions. The ControlFrame type/schema itself is still
live (used by the CancelBroadcast interface and its NATS implementation),
so only the unused encode/decode pair and their now-orphaned test go.
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