Skip to content

Refactor terminal RPC methods into cohesive modules - #16188

Merged
nwparker merged 1 commit into
mainfrom
nwparker/refactor-18-terminal-rpc-2
Aug 25, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/refactor-18-terminal-rpc-2

Conversation

@nwparker

@nwparker nwparker commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​428 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​428
Prod 34 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4616 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3825 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​791

Architecture and responsibility boundaries

  • Keeps src/main/runtime/rpc/methods/terminal.ts as the public registration owner and composes the existing 33-method manifest in its released order.
  • Separates unary query, send, lifecycle, and viewport handlers from their schemas.
  • Separates legacy subscription paths from the multiplex connection state machine; multiplex setup advances through typed frame-delivery, flow-control, cleanup, slot-frame, and subscribe stages.
  • Centralizes concrete terminal-domain operations for input delivery, output batching, snapshot publication, replay, viewport updates, and stream state without barrels or forwarding facades.
  • Removes only the stale terminal.ts max-lines baseline entry.

Preserved regression contracts

  • Method names, registration order, unary/streaming flags, schema coercion, strict control-frame parsing, and skew-tolerant subscribe parsing.
  • Execution-host authority plus opaque SSH and folder-workspace selectors through lifecycle methods.
  • Shared monotonic IDs across legacy binary and JSON subscriptions.
  • Permanent terminal-stream v1 header/opcode assignments, empty/rejected snapshot framing, and slot-registration failure ownership.
  • Existing cleanup order, subscription ownership, flow-control, source-range acknowledgement, and public TERMINAL_METHODS API.

Root size

  • Before: src/main/runtime/rpc/methods/terminal.ts — 3,826 lines.
  • After: src/main/runtime/rpc/methods/terminal.ts — 22 lines.
  • Largest extracted production module: 297 lines; all changed production TypeScript files stay within the 300-line limit.

Validation

  • pnpm exec oxfmt --write config/max-lines-baseline.txt src/main/runtime/rpc/methods/terminal.ts src/main/runtime/rpc/methods/terminal-*-characterization.test.ts src/main/runtime/rpc/methods/terminal/*.ts — passed; 36 TypeScript files formatted.
  • pnpm exec oxlint --deny-warnings — passed with no warnings.
  • pnpm run typecheck — passed.
  • pnpm run check:max-lines-ratchet — passed: 186 grandfathered suppressions, no new bypasses.
  • pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/rpc/methods/terminal-legacy-stream-id-characterization.test.ts src/main/runtime/rpc/methods/terminal-manifest-characterization.test.ts src/main/runtime/rpc/methods/terminal-stream-extraction-characterization.test.ts — passed: 3 files, 10 tests.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 24 minutes.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a6d8be3d-d051-4f57-9443-7b1949fc3bc1

📥 Commits

Reviewing files that changed from the base of the PR and between 5bcbaff and 0286e7b.

📒 Files selected for processing (37)
  • config/max-lines-baseline.txt
  • src/main/runtime/rpc/methods/terminal-legacy-stream-id-characterization.test.ts
  • src/main/runtime/rpc/methods/terminal-manifest-characterization.test.ts
  • src/main/runtime/rpc/methods/terminal-stream-extraction-characterization.test.ts
  • src/main/runtime/rpc/methods/terminal.ts
  • src/main/runtime/rpc/methods/terminal/stream-schemas.ts
  • src/main/runtime/rpc/methods/terminal/terminal-input-delivery.ts
  • src/main/runtime/rpc/methods/terminal/terminal-legacy-binary-control-frames.ts
  • src/main/runtime/rpc/methods/terminal/terminal-legacy-simple-subscriptions.ts
  • src/main/runtime/rpc/methods/terminal/terminal-legacy-subscribe-binary.ts
  • src/main/runtime/rpc/methods/terminal/terminal-legacy-subscribe-live.ts
  • src/main/runtime/rpc/methods/terminal/terminal-legacy-subscribe-snapshot.ts
  • src/main/runtime/rpc/methods/terminal/terminal-legacy-subscription-types.ts
  • src/main/runtime/rpc/methods/terminal/terminal-lifecycle-methods.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-cleanup.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-connection.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-flow-control.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-frame-delivery.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-initial-snapshot.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-live-stream.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-method.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-slot-frames.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-stream-initialization.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-subscribe-frame.ts
  • src/main/runtime/rpc/methods/terminal/terminal-multiplex-subscribe-resolution.ts
  • src/main/runtime/rpc/methods/terminal/terminal-output-batcher.ts
  • src/main/runtime/rpc/methods/terminal/terminal-query-methods.ts
  • src/main/runtime/rpc/methods/terminal/terminal-send-method.ts
  • src/main/runtime/rpc/methods/terminal/terminal-snapshot-publication.ts
  • src/main/runtime/rpc/methods/terminal/terminal-stream-replay.ts
  • src/main/runtime/rpc/methods/terminal/terminal-stream-types.ts
  • src/main/runtime/rpc/methods/terminal/terminal-subscribe-method.ts
  • src/main/runtime/rpc/methods/terminal/terminal-subscription-stream-id.ts
  • src/main/runtime/rpc/methods/terminal/terminal-viewport-methods.ts
  • src/main/runtime/rpc/methods/terminal/terminal-viewport-update.ts
  • src/main/runtime/rpc/methods/terminal/unary-schemas.ts
  • src/main/runtime/rpc/methods/terminal/viewport-schemas.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@nwparker
nwparker merged commit 1c436a8 into main Aug 25, 2026
48 checks passed
paidaxingyo666 pushed a commit to paidaxingyo666/Manta that referenced this pull request Aug 25, 2026
dallascrilley pushed a commit to dallascrilley/orca that referenced this pull request Aug 27, 2026
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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