Skip to content

fix(runtime): keep terminal.send under the file-length limit - #34256

Merged
nwparker merged 2 commits into
mainfrom
brennanb2025/main-lint-1026b
Oct 27, 2026
Merged

nwparker merged 2 commits into
mainfrom
brennanb2025/main-lint-1026b

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​18 $\color{#cf222e}{\Huge{\mathbf{−}}}$​58 $\color{#cf222e}{\Huge{\mathbf{−}}}$​40

Problem

Lint fails on main and on every PR that merges current main. #33968 added three lines to src/main/runtime/rpc/methods/terminal/terminal-send-method.ts, which now has 301 counted lines against the repo's 300-line limit for .ts files. No open PR fixes it.

Change

No behavior change. terminal.send spelled out the same refused result (accepted: false, zero bytes written, plus the guard's reason when there is one) in eight places. A single refusedSend helper now builds that result, so the file drops to 269 physical lines (259 counted by the lint rule). Each result keeps the same shape and the same keys, and refusedReason appears only when the guard gave one.

Verification

  • Named tests pass: 49/49 across terminal-send.test.ts, terminal-agent-send-guard.test.ts, terminal-send-question-answered.test.ts, terminal-send-launch-draft-resolution.test.ts and terminal-prompt-delivery-receipt.test.ts.
  • The pre-commit hook passed.
  • CI is the lint and typecheck gate.

Review plan

Full review path: the patch is 18 added and 58 removed production lines in one file, but it touches the RPC send handler and refusal result construction. Independent correctness and architecture reviews verify all eight result shapes, key presence and serialization, plus a final compatibility and performance check. No user-visible behavior, guard conditions, saved state, or process lifecycle changes are intended. QA is test-based; the previously passing 49 targeted tests cover the unchanged send flows. CI checks the full repository lint and typecheck gates.

… refusal helper

#33968 pushed terminal-send-method.ts to 301 counted lines against the 300-line rule, failing Lint on main and every PR that merges it. Eight refusal branches spelled out the same zero-byte result; one helper builds it.
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 261619d6-bb7b-418e-b512-68cd00bf536e
Commits

Reviewing files that changed from the base of the PR and between 4e23c68 and 9660ceb.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
Walkthrough

The terminal send method now uses a local helper to construct rejected send results with zero bytes written and an optional refusal reason. Existing refusal conditions remain unchanged. Unrecognized errors continue through the existing handling.

Priority: Low

Merge Risk: Minimal · previous review 4e23c

The change is ready to merge; the helper comment should be narrowed or removed as a small cleanup.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description follows most of the template. It has a clear Problem, Change, and Verification section, and it explains the no-behavior-change refactor and why the file length matters. It has no ELI5 … Add an ELI5 section in plain language. Add a Linked Issue with a real issue number in place of the blank 'Fixes #'. Write 'N/A' with a short reason under Visual Proof. Tick the Testing checkboxes that apply, and state which platforms were t…
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the runtime file-length fix and matches the main change in the pull request.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Full details: Description check

Explanation

The description follows most of the template. It has a clear Problem, Change, and Verification section, and it explains the no-behavior-change refactor and why the file length matters. It has no ELI5 section, no Visual Proof section (or N/A with reason), and the Linked Issue section is missing: 'Fixes #' is blank. The description does not link an issue, and the template says outside contributors need one. The Testing checkboxes are not ticked, the AI Disclosure and Agent skill upstream boundary sections are not addressed, and the Checklist is absent. Missing required content makes this description incomplete.

Resolution

Add an ELI5 section in plain language. Add a Linked Issue with a real issue number in place of the blank 'Fixes #'. Write 'N/A' with a short reason under Visual Proof. Tick the Testing checkboxes that apply, and state which platforms were tested. Complete the Agent skill upstream boundary checkbox. Add the Checklist, or confirm it was reviewed. Keep the AI Disclosure section if it applies to the contributor.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick comments: 1
src/main/runtime/rpc/methods/terminal/terminal-send-method.ts: 1

24-24: Trivial · Maintainability & Code Quality · Quick win

Remove the overbroad helper comment.

runtime.sendTerminal(...) can return accepted: false through the result path. That result includes writeSettlement and does not add refusedReason, so the comment does not describe every refusal. The helper body already describes its own result shape.

Suggested fix
-// Every refused send reports the same zero-byte result, with the guard's reason when it has one.
 function refusedSend(

Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1fd07bad-3cbe-4c2a-98e9-50fc41274bb2
Commits

Reviewing files that changed from the base of the PR and between 887b781 and 4e23c68.

Files selected for processing: 1
  • src/main/runtime/rpc/methods/terminal/terminal-send-method.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

@brennanb2025

brennanb2025 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor Author

Main lint was blocked because terminal.send exceeded the 300-line TypeScript limit. The repeated refusal responses now use one private constructor, bringing the file to 259 counted lines while preserving every response field, key omission and send guard.

The full production review finished with no findings or deferrals. Independent checks compared the actual base and branch handlers across 135 cases and exercised 66 refusal pairs through existing desktop, CLI and mobile consumers. All eight replacement sites preserve strict object shape, property order, JSON output, errors and side effects. Architecture, complete input/refusal comparison, performance and compatibility checks found no regression.

All 49 targeted tests passed across five files on 9660ceb1a9538302854fb0bb65b9d8ff2072c5f2. That commit merges main's browser/media change; its narrow merge diff leaves terminal behavior unchanged. All CI checks passed on this head, including lint/typecheck, five test shards, packages, mobile verification, WSL and cross-version compatibility. QA is test-based: no lifecycle, process ownership, login or presentation flow changed, so no running-app test or screenshot was needed. Handler/consumer equivalence used controlled I/O; full transport and React hooks were source-traced.

Neil merged this PR at 2026-10-27 05:01:45 UTC, as merge commit 192f5783abcb16d654b7254c77c9f3b5fd3827d1. The later branch commit a19dc9aad5b6a8aa4e67a1179de5bf8df14f227e strengthens two existing refusal assertions to toStrictEqual; it passed 29/29 tests and continued review, but is not part of the merged PR. The readiness checker initially rejected qa=tests because the original diff changed no test file; after the external merge it reports the PR closed, so this loop does not claim a brennan-ready READY verdict.

For Brennan's review: the merged refusal constructor and its exact optional-reason shape.

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.

2 participants