Skip to content

refactor(ipc): import worktree, watcher and runtime-environment helpers from their owning modules - #30375

Merged
nwparker merged 1 commit into
mainfrom
nwparker/r2-debarrel-ipc-2
Oct 18, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/r2-debarrel-ipc-2

Conversation

@nwparker

@nwparker nwparker commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 32 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​77 $\color{#cf222e}{\Huge{\mathbf{−}}}$​67 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​10
Prod 27 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​34 $\color{#cf222e}{\Huge{\mathbf{−}}}$​66 $\color{#cf222e}{\Huge{\mathbf{−}}}$​32

ELI5

Four IPC modules were forwarding names that are defined in other files. Some tests mocked those names through the forwarding module. This PR imports each name from the file that defines it, moves those mocks to the same file, and removes the forwarding lines. Nothing the app does changes.

What Changed

  • Re-export lines removed from four modules:
    • ipc/worktree-logic.ts: computeBranchName and related names, plus mergeWorktree and the display-name helpers
    • ipc/worktree-base-directory-poller.ts: WORKTREE_BASE_BACKSTOP_TICKS
    • ipc/filesystem-watcher.ts: the local/remote removal helpers, registerFilesystemWatcherHandlers and closeAllWatchers
    • ipc/runtime-environments/runtime-environment-transport-routing.ts: getRuntimeEnvironmentStatus
  • Importers rewritten across ipc, agent-hooks, skills, startup, runtime and two top-level src/main modules.
  • Test mocks retargeted, so each mock still reaches the code under test:
    • Mocks that supplied only re-exported names now mock the defining module. These are worktree-branch-name, filesystem-watcher-handlers and runtime-environment-status-probe, across six tests.
    • Mocks that mixed the barrel's own names with re-exported ones are split into two vi.mock calls: runtime-environment-host-dispatch, runtime-environment-managed-host-disconnect and folder-repo-git-upgrade-lifetime. The new marker-poller mock keeps the real module and overrides only the constant.
  • Size: production +34/−66, tests +77/−67.

Why

The user's rule is that no module re-exports another module's names. These four needed the mock moves, so they got their own PR instead of riding along with the mechanical one (#30369).

Three ipc modules are still pending, all for the same mock reason: filesystem-auth, which also has import * as namespace users in tests, markdown-documents and preflight. dashboard-payload-validation is skipped because open PRs #30145, #29953 and #28445 edit it.

Linked Issue

N/A (SSH hardening round 2, de-barrel follow-up).

Visual Proof

N/A: an import-only refactor.

Testing

  • typecheck:ci is clean.
  • src/main/ipc, agent-hooks, skills, startup and runtime/workspaces, plus every touched runtime and top-level module's tests and every changed test file, pass single-worker: 852 files, 8,091 tests.
  • The full local "static analysis and typecheck" job is clean.
  • Codex review (gpt-6.1-sol, high) is clean.

…rs from their owning modules

Removes the re-export lines in worktree-logic, worktree-base-directory-poller, filesystem-watcher and
runtime-environment-transport-routing. Test mocks that supplied a re-exported name now mock the
module that defines it, so they still reach the code under test.
@coderabbitai

coderabbitai Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5b4ecce1-bcbb-4d09-9ea6-7feeabbf72d4
📥 Commits

Reviewing files that changed from the base of the PR and between b1adb89 and 4183dfc.

📒 Files selected for processing: 59
  • src/main/agent-hooks/first-work-branch-rename-wsl-move.test.ts
  • src/main/agent-hooks/first-work-branch-rename.test.ts
  • src/main/agent-hooks/first-work-branch-rename.ts
  • src/main/ipc/filesystem-watcher-document-lifetime.test.ts
  • src/main/ipc/filesystem-watcher-dormant-rearm.test.ts
  • src/main/ipc/filesystem-watcher-large-batch.test.ts
  • src/main/ipc/filesystem-watcher-local-unsubscribe.test.ts
  • src/main/ipc/filesystem-watcher-native-capacity.test.ts
  • src/main/ipc/filesystem-watcher-real.test.ts
  • src/main/ipc/filesystem-watcher-remote-batch.test.ts
  • src/main/ipc/filesystem-watcher-remote-cancellation.test.ts
  • src/main/ipc/filesystem-watcher-remote-capacity.test.ts
  • src/main/ipc/filesystem-watcher-remote-rearm.test.ts
  • src/main/ipc/filesystem-watcher-removal-deadline.test.ts
  • src/main/ipc/filesystem-watcher-terminal-resync.test.ts
  • src/main/ipc/filesystem-watcher-unwatchable-roots.test.ts
  • src/main/ipc/filesystem-watcher.test.ts
  • src/main/ipc/filesystem-watcher.ts
  • src/main/ipc/folder-repo-git-upgrade-lifetime.test.ts
  • src/main/ipc/folder-repo-git-upgrade.ts
  • src/main/ipc/register-core-handlers/register-core-handlers.test.ts
  • src/main/ipc/register-core-handlers/register-core-handlers.ts
  • src/main/ipc/runtime-environments/runtime-environment-browser-client-host-handler.test.ts
  • src/main/ipc/runtime-environments/runtime-environment-browser-client-host-handler.ts
  • src/main/ipc/runtime-environments/runtime-environment-connectivity-handlers.ts
  • src/main/ipc/runtime-environments/runtime-environment-federated-read-routing.test.ts
  • src/main/ipc/runtime-environments/runtime-environment-host-dispatch.test.ts
  • src/main/ipc/runtime-environments/runtime-environment-managed-host-disconnect.test.ts
  • src/main/ipc/runtime-environments/runtime-environment-session-tabs-delta.integration.test.ts
  • src/main/ipc/runtime-environments/runtime-environment-status-connection.test.ts
  • src/main/ipc/runtime-environments/runtime-environment-status-recovery.test.ts
  • src/main/ipc/runtime-environments/runtime-environment-status-retirement.test.ts
  • src/main/ipc/runtime-environments/runtime-environment-transport-routing-tailscale-hint.test.ts
  • src/main/ipc/runtime-environments/runtime-environment-transport-routing.ts
  • src/main/ipc/runtime-environments/runtime-environments.ts
  • src/main/ipc/workspace-cleanup-folder-workspaces.ts
  • src/main/ipc/workspace-cleanup-scan.ts
  • src/main/ipc/worktree-base-directory-poller.test.ts
  • src/main/ipc/worktree-base-directory-poller.ts
  • src/main/ipc/worktree-logic.test.ts
  • src/main/ipc/worktree-logic.ts
  • src/main/ipc/worktree-remote.ts
  • src/main/ipc/worktrees/create/folder-workspace-creation.ts
  • src/main/ipc/worktrees/listing/detected-worktree-classification.test.ts
  • src/main/ipc/worktrees/listing/ssh-worktree-fallback.ts
  • src/main/provisioned-root-checkout.ts
  • src/main/runtime/repo-worktree-row-resolution.ts
  • src/main/runtime/runtime-folder-worktree-create.ts
  • src/main/runtime/runtime-local-worktree-create-candidate.ts
  • src/main/runtime/runtime-local-worktree-materialization.ts
  • src/main/runtime/runtime-managed-worktree-queries.ts
  • src/main/runtime/runtime-worktree-create-git.ts
  • src/main/runtime/workspaces/workspace-selectors.ts
  • src/main/skills/skill-cloud-grant-installation.test.ts
  • src/main/skills/skill-cloud-grant-installation.ts
  • src/main/skills/skill-runtime-capability.test.ts
  • src/main/skills/skill-runtime-capability.ts
  • src/main/startup/main-process-quit.ts
  • src/main/workspace-space-repo-scan.ts
💤 Files with no reviewable changes: 4
  • src/main/ipc/worktree-base-directory-poller.ts
  • src/main/ipc/filesystem-watcher.ts
  • src/main/ipc/worktree-logic.ts
  • src/main/ipc/runtime-environments/runtime-environment-transport-routing.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.

📝 Walkthrough

The diff redirects imports and test mocks from aggregate modules to dedicated filesystem watcher, runtime environment, and worktree helper modules. It removes the corresponding aggregate re-exports and updates imports of the worktree backstop-tick constant. The summaries report no runtime behavior or test-logic changes.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 4183d

The refactor relocates imports without a reported app-behavior change, and no remaining code imports the removed exports. No concrete product risk remains; the PR appears ready to merge after normal checks.

Pre-merge checks: Passed 3 · Failed 1 · Inconclusive 1

Failed Failed checks: 1 warning · 1 inconclusive

Check name Status Explanation Resolution
Description check Warning The description explains the refactor, motivation, scope, visual impact, and testing results. However, it lists N/A under Linked Issue despite the template requiring an actual issue link, and it omi… Add the required linked issue, or document the applicable maintainer exception. Include the Review, Notes, and Checklist sections from the repository template, with completed items or explicit explanations where applicable.
Docstring Coverage Inconclusive 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 4 functions across 50 files. (5 skipped: 5… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: importing worktree, watcher, and runtime-environment helpers from their defining modules.
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 refactor, motivation, scope, visual impact, and testing results. However, it lists N/A under Linked Issue despite the template requiring an actual issue link, and it omits the Review, Notes, and Checklist sections.

Resolution

Add the required linked issue, or document the applicable maintainer exception. Include the Review, Notes, and Checklist sections from the repository template, with completed items or explicit explanations where applicable.

Full details: Docstring Coverage

Explanation

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 4 functions across 50 files. (5 skipped: 5 over the file limit.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
✨ 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.

@nwparker
nwparker merged commit 447c4a0 into main Oct 18, 2026
41 checks passed
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