Skip to content

refactor: split files exceeding the main lint limits - #34075

Closed
brennanb2025 wants to merge 3 commits into
mainfrom
brennanb2025/fix-main-max-lines-1026
Closed

brennanb2025 wants to merge 3 commits into
mainfrom
brennanb2025/fix-main-max-lines-1026

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​609 $\color{#cf222e}{\Huge{\mathbf{−}}}$​315 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​294
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​59 $\color{#cf222e}{\Huge{\mathbf{−}}}$​56 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3

Current main exceeds the root oxlint max-lines limits in the native chat context menu and two worktree creation test files, blocking unrelated PR checks.

This is a pure split: move the structured pane menu component and two whole test groups into named files, with every assertion and runtime behavior preserved.

Validation: 106 tests passed before and after (IPC 27 → 22 + 5; runtime 50 → 37 + 13; context menu 29 → 29). The normal pre-commit hook passed root oxlint, JS-plugin lint, ast-grep, React checks, and formatting on all six changed files.

Plan: extract the existing pane-menu component and relocate two complete test groups into purpose-named files, preserving behavior and assertions. This restores the file-size checks blocking #31999 and #33632.

Review path: light.

  • Small: 115 changed production lines across two files; four additional files are tests.
  • Outside risky areas: exact pane-menu extraction and test-group splits; no lifecycle, persistence, IPC/wire, process, auth, ordering, build, or default behavior changes.
  • Not a repeat: checked touched-file history for the last 30 days; no prior fix for the max-lines symptom or identified revert/incident. Recent behavior fixes are unrelated.
  • Local effect: moved the existing component and two whole test groups without changing runtime statements, test cases, or assertions.

QA: existing renderer coverage and CI (qa=tests); no app run or screenshot because the menu's appearance and behavior are unchanged. All 106 cases are retained, and an independent AST comparison verified all moved test bodies and production statements.

Final validation on 1efc6e66be2d0344b0b556b332b7da391c0aa1eb: CI passed, including static analysis/typecheck, all five unit shards, relay integration, both packaging jobs, and selection evidence. The daemon test plus both new split files also passed together through tc-gate (3 files, 34 tests). Actual CI artifacts place the daemon and label split in different runner processes with per-file isolation, and the runtime split on another shard; direct shared-mock leakage is unsupported. The earlier repeated daemon assertion did not recur on this head; its precise intermittent cause remains unknown.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent 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: f7b85107-0a4a-4e3e-bc8f-40a58930baa5
Commits

Reviewing files that changed from the base of the PR and between 9fa0cc4 and 337bfde.

Files selected for processing: 1
  • src/main/ipc/worktrees-create-label-only-first-work.test.ts
Files skipped from review as they are similar to previous changes: 1
  • src/main/ipc/worktrees-create-label-only-first-work.test.ts

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

Walkthrough

The pull request adds and relocates tests for IPC and runtime worktree creation. The tests cover label-only creation, first-work renaming, branch and path conflicts, and PR-conflict probing during pending refreshes or fetches. It also extracts structured chat pane menu rendering into an exported component and updates the context-menu hook to import it.

Priority: Low

Merge Risk: Minimal · up to 337bf

No actionable merge-blocking issue is established; the change is mergeable after normal checks.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description explains the change, scope, testing, and validation in detail, but it omits several required template sections. It does not provide ELI5, Why, Linked Issue with an issue number, Visual… Complete the missing template sections. Add an ELI5 summary, explain why this approach was chosen, provide a linked issue such as Fixes #<number> or document the applicable maintainer exception, add Visual Proof with N/A and a reason if…
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly describes the primary change: splitting oversized files to satisfy lint line limits.
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 change, scope, testing, and validation in detail, but it omits several required template sections. It does not provide ELI5, Why, Linked Issue with an issue number, Visual Proof or the required N/A statement, AI Disclosure, Agent skill upstream boundary, Notes, or the Checklist responses.

Resolution

Complete the missing template sections. Add an ELI5 summary, explain why this approach was chosen, provide a linked issue such as Fixes #&lt;number&gt; or document the applicable maintainer exception, add Visual Proof with N/A and a reason if there is no UI change, complete AI Disclosure as applicable, mark the Agent skill upstream boundary, address Notes, and complete the Checklist items.

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.

Actionable comments posted: 1


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: 9fd8dc75-99a1-4bea-911d-c378c88749e8
Commits

Reviewing files that changed from the base of the PR and between d58ab97 and 9fa0cc4.

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-pr-conflicts.test.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: 2
  • src/main/runtime/runtime-local-worktree-create.test.ts
  • 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; 6 remain after this review.

OrcaWin added a commit that referenced this pull request Oct 26, 2026
## ELI5

Orca can remember one release's ZIP filename and later follow “latest” into a newer release where that file does not exist. Resolve “latest” once, then keep the manifest and download on that concrete release.

## What Changed

- Replace the default-channel moving-feed fallback with a validated stable tag resolved from GitHub's `/releases/latest` redirect.
- Reuse the existing Electron `net.request` HEAD handling and platform manifest/asset readiness probes. `net.fetch` cancels manual redirects in real Electron, so it is not used for redirect discovery.
- Return a retryable check failure when a ready concrete fallback cannot be resolved, and reject fallback results belonging to an expired check.
- Update existing feed expectations and installer fixtures; cover stable fallback, Atom outages, unavailable fallback, late completions, redirect validation, and platform manifest selection.

## Why

The normal path already pins a tag, but Atom outages and no-newer results still installed a `/releases/latest/download` provider. That provider retains relative filenames while GitHub's redirect can move between checking and downloading. Correct release manifests alone cannot prevent the mismatch.

Credit to @brennanb2025 for the original tag-pinning fix in #1797, and @nwparker for the attempt-ownership guard in #23160, which this change extends across the fallback lookup. Also reviewed @sechan-netizen's #30952 and its review thread: its release-manifest validation is a complementary safeguard and remains separate because this race reproduces with correct manifests. No commits from that PR are copied here.

This PR adopts @brennanb2025's audited #34075 lint fix (splitting three files that already exceeded main's line limits), with Brennan retained as a co-author. Independent byte-level audits preserve the moved runtime bodies and test groups; the follow-up replaces five test-only assertions with typed calls and emits identical JavaScript. The standalone older PR remains unmerged after repeated daemon-test CI/order sensitivity; the combined tree here passed all CI, including that exact daemon test file (16 tests) in run 40398604134, job 121839803430.

## Linked Issue

Fixes #34034

Related reports: #15921 and #22621. The controlled race matches their URL signature and retry behavior; the reporter's original feed selection cannot be established without its logs.

## Visual Proof

N/A — updater feed selection only; no presentation change. Verified the HTTP behavior using the production fallback resolver and electron-updater 6.8.10 with unmodified v1.4.240/v1.4.241 manifests and a controlled local release server:

| Scenario | Result |
| --- | --- |
| Old moving provider: read 240 manifest, advance latest to 241, download | `v1.4.241/Orca-1.4.240-arm64-mac.zip`: 404 |
| Retry the old download without a new check | Same 404 |
| Fresh check | Correct 241 ZIP: 200 |
| Fixed fallback: resolve 240 tag, advance latest to 241, download | Correct 240 ZIP under tag 240: 200 |

No installer was executed and no app window was opened.

## Testing

- [x] I manually tested these changes locally
- [x] Automated tests added/updated

`ORCA_BACKGROUND_LAUNCH=1 pnpm check:changed --maxWorkers=2`: all 26 checks pass on the combined branch, including formatting, lint, typechecks, affected tests, and ratchets. The earlier updater-only run also passed all 20 selected checks.

The controller regression run against the original implementation produces five failures with passing controls. The fixed implementation passes. Resolver tests exercise macOS arm64, Windows x64, Linux x64/arm64 manifest selection, invalid redirects, missing assets, and recovery after network failure; these platform variants use mocked transport.

A separate background Electron 43.8.1 smoke on macOS arm64 uses the production resolver and real Electron networking against GitHub, resolving the ready `v1.4.241` tag. The controlled before/after reproduction also exercises the production resolver and actual GenericProvider. Neither proof exercises native installation.

All non-skipped GitHub CI checks pass for combined head `c04a6ca95604e064fb4f91adb1a57ea3dcf9adf0`: all five full unit shards, relay integration, Linux/Windows package checks, macOS updater regression tests, static analysis/typechecks, and the required aggregate check. Final independent review recommends merging that exact head as low risk with no code blockers.

## AI Disclosure

## Review

Independent sub-agent review found no actionable issues and rated the updater change low risk; 57 relevant tests passed independently. The prerequisite received two independent refactor audits, with identical moved runtime/test bodies and a merge-preservation gate reporting zero unexplained deletions and zero unrelated files. The five typed mock changes produce identical JavaScript. Also self-reviewed the feed-selection paths, timeout ownership, transport cleanup, and release-channel filtering. The added lookup runs only on the existing fallback path, uses HEAD for redirect discovery, retains five-second request deadlines, and reuses manifest/asset probes. No new polling, subprocess, persistent cache, or per-workspace work is introduced. Native Windows/Linux networking and installer execution were not exercised locally.

Review disposition for [the DMG-only manifest comment](#34076 (comment)): an independent executable comparison of the original and fixed implementations returned the same `ready` Atom result for a DMG-only manifest; the old fallback already handed that manifest directly to MacUpdater, which cannot select its required ZIP. This is an existing release-integrity limitation, not introduced or worsened by tag pinning. It remains outside this race fix; a complete integrity change must validate the native files list and architecture selection rather than merely finding any ZIP-like name.

## Agent skill upstream boundary

- [x] Not applicable; no upstream skill source or fixtures copied.

## Notes

Desktop updater implementation is shared with headless serve. No IPC/RPC contract, remote version requirement, mobile client code, filesystem path, or workspace-kind assumption changes. Existing RC/perf selection remains in place. If fallback discovery also fails, checks use the existing retry/error flow instead of launching a moving feed.

## Checklist

- [x] This PR is focused on consistent release selection
- [x] Problem, behavior, and mechanism explained
- [x] Visual proof N/A with network verification recorded
- [x] Self-reviewed for correctness, security, and performance
- [x] Cross-platform, remote, mobile, and folder-workspace impact considered
- [x] Required changed-code checks pass


Co-authored-by: Brennan Benson <[email protected]>
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Main's file-size limits were exceeded in the native-chat context menu and two worktree-creation test files, blocking otherwise unrelated PR checks. This PR restores the checks by moving the existing pane-menu component and two complete test groups into purpose-named files. User-visible behavior and appearance are unchanged.

One adversarial light-path review found no actionable issues. All moved production statements and test bodies match their originals; all assertions and 106 cases are preserved (IPC 27 → 22 + 5, runtime 50 → 37 + 13, menu 29 → 29). The typed importOriginal follow-up changes types only. No review fixes or deferrals remain.

Main was merged once as 1efc6e6; all six PR files and the PR diff remained identical, and the narrow merge review and prescribed merge check passed. Whole-mechanism comparison is complete. The existing workspace split/close behavior and host-owned session-ID copy are intended, unchanged requirements of the workspace and mixed-host model; no new difference was introduced.

Validation: final-head CI passed, including all five unit shards, static analysis/typecheck, relay integration, packaging and selection evidence; the daemon test plus both new split files passed together through tc-gate (3 files, 34 tests). The earlier daemon-installation assertion failed twice; it did not recur on this head, and actual CI artifacts place the daemon and label split in different runner processes with per-file isolation while the runtime split is on another shard. Direct mock leakage is unsupported; the precise intermittent cause remains unknown and was reported to the coordinator. No running-app QA or screenshots were needed because this is an exact component extraction with no appearance or interaction change. Existing renderer coverage and CI cover the moved component.

For Brennan's review: no screenshot applies to this unchanged screen. The main judgment points are the extracted menu and unchanged menu call site.

@OrcaWin

OrcaWin commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Closing as adopted by merged #34076. The audited file splits and typed mock cleanup landed there, with Brennan Benson credited as a co-author. The combined tree passed all CI checks, including the daemon test file that failed on the earlier standalone tree.

Thank you for the original fix and the additional validation here. Please reopen if a remaining change is still needed or the line-limit problem recurs on a version containing the merged fix.

@OrcaWin OrcaWin closed this Oct 26, 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.

2 participants