Skip to content

refactor: split three files back under max-lines - #34081

Closed
nwparker wants to merge 2 commits into
mainfrom
nwparker/max-lines-split-oct26
Closed

nwparker wants to merge 2 commits into
mainfrom
nwparker/max-lines-split-oct26

Conversation

@nwparker

@nwparker nwparker commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​216 $\color{#cf222e}{\Huge{\mathbf{−}}}$​175 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​41
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​144 $\color{#cf222e}{\Huge{\mathbf{−}}}$​56 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​88

ELI5

Three files grew past the repository's line limit, which turned main's lint red. This moves a self-contained piece out of each file. Nothing behaves differently.

What Changed

  • use-native-chat-context-menu.tsx (403 lines, cap 400): the StructuredChatPaneMenuItems component moves to StructuredChatPaneMenuItems.tsx, next to NativeChatPaneMenuItems.tsx. Its prop types are now written out instead of picked from the hook's args type.
  • worktrees-create-metadata-persistence.test.ts (829, cap 800): the "desktop label-only creation through first work" describe moves to worktrees-create-label-only-first-work.test.ts. It brings its own copy of the file's vi.mock block, as sibling worktrees-*.test.ts files already do.
  • runtime-local-worktree-create.test.ts (844, cap 800): the createWorktree helper, which runs the real runtime create against a fake store, moves into runtime-local-worktree-create.test-fixture.ts as runtimeLocalWorktreeCreator, along with its default sparse preset. The vi.mocks and the hoisted mocks stay in the test file.

There's no behaviour change and no lint-disable comment. The one existing SAFETY cast moved with its helper.

Why

Main's lint gate fails on max-lines for these three files (from #31679 and #32919), which blocks every PR.

Linked Issue

N/A, main lint fix. No issue.

Visual Proof

N/A. This only moves code; no UI changes.

Testing

  • oxlint is clean on all six files, and pnpm tc passes.

  • The moved and affected tests pass: both worktree-create IPC files, runtime-local-worktree-create.test.ts (50 tests), and the four native-chat context-menu test files.

  • In runtime-local-worktree-create.test.ts, "creates and renames a creature branch for 認証を修正" takes 19-23s under load on both origin/main and this branch, because its vi.importActual cold-transforms the real module inside the test. In one run alongside pnpm tc it hit 30s. That's pre-existing and unrelated to this move.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Pure move, so there's no platform, SSH, mobile or compatibility impact.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

- StructuredChatPaneMenuItems moves out of use-native-chat-context-menu.tsx.
- The desktop label-only first-work describe moves out of
  worktrees-create-metadata-persistence.test.ts into its own file.
- The runtime create call against a fake store moves into a test fixture.
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The changes add tests for label-only worktree creation and first-work branch renaming. They move the corresponding test suite out of the metadata persistence tests. Runtime worktree tests now use a shared test fixture. The structured chat pane menu is defined in a separate module and imported by the chat context menu.

Priority: Low

Merge Risk: Low · previous review 353f6

The change appears mergeable with a small test-code correction: replace or justify the type assertions in the new test file.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 5 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly describes the main change: splitting code from three files to keep them under the line limit.
Description check Passed The description explains the changes, rationale, and testing, and includes the required sections for visual proof and review. It lists the linked issue as N/A; the template requires an issue link for …
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: Description check

Explanation

The description explains the changes, rationale, and testing, and includes the required sections for visual proof and review. It lists the linked issue as N/A; the template requires an issue link for outside contributors, but allows this exception for maintainers.

Finishing Touches: 💡 1
📝 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/ipc/worktrees-create-label-only-first-work.test.ts: 1

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

Replace or justify the importOriginal assertions.

This assertion and the same assertions at Lines 57, 62, 67, and 72 lack line-specific SAFETY: explanations. Use a typed importOriginal call where possible, as at Line 36. If a cast is unavoidable, explain its safety at that line. As per coding guidelines: “Avoid type assertions except as const. Unavoidable casts need a line-specific SAFETY: explanation.”

Source: Coding guidelines


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: 35af1561-9625-4693-9519-47f3b92897f1
Commits

Reviewing files that changed from the base of the PR and between c2ceb52 and 353f62b.

Files selected for processing: 6
  • src/main/ipc/worktrees-create-label-only-first-work.test.ts
  • src/main/ipc/worktrees-create-metadata-persistence.test.ts
  • src/main/runtime/runtime-local-worktree-create.test-fixture.ts
  • src/main/runtime/runtime-local-worktree-create.test.ts
  • src/renderer/src/components/native-chat/StructuredChatPaneMenuItems.tsx
  • src/renderer/src/components/native-chat/use-native-chat-context-menu.tsx
Files with no reviewable changes: 1
  • src/main/ipc/worktrees-create-metadata-persistence.test.ts

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

@nwparker

Copy link
Copy Markdown
Contributor Author

Superseded by #34072, which landed the same max-lines splits on main.

@nwparker nwparker closed this Oct 26, 2026
@nwparker
nwparker deleted the nwparker/max-lines-split-oct26 branch October 26, 2026 21:34
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