You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
src/main/ipc/pty.ts was a file that only re-exported names from about a dozen real terminal modules. Every caller now imports from the module that actually owns the name, and the pass-through file is gone.
What Changed
Deleted src/main/ipc/pty.ts (33 lines of re-exports). There was no logic in it.
20 production files (startup, updater, daemon, orcad, worktree removal, window wiring) now import directly from ipc/pty/provider/registry, ipc/pty/kill-all, ipc/pty/register-handlers, ipc/pty/register-headless-runtime, ipc/pty/pane/key-state, ipc/pty/provider/state-cleanup, ipc/pty/provider/listener-lifecycle, ipc/pty/host-env/* and so on. This includes the two dynamic await import(...) calls in orcad.
Tests that called vi.mock on the barrel now mock the module the code under test really imports. The shared mock factories were split to match: ipcPty became ptyKillAll in the updater harness, ptyProviderRegistry and ptyListenerLifecycle in the daemon-init mocks, and ptyRegistryModuleMock and ptyStateCleanupModuleMock in the worktree mocks.
The SSH IPC tests mocked the barrel and reset three PTY mocks, but nothing in that graph imports PTY code since the SSH terminal stack was removed. That mock, its type slot and the resets are deleted. workspace-cleanup.test.ts had an empty vi.mock('./pty', () => ({})), which is deleted too.
The WSL hook-relay benchmark script, and two quit-teardown tests that list modules by path, now name the concrete modules.
Users see no difference. The same functions run in the same order; only the import paths changed.
Why
AGENTS.md and the Phase 3.99 design (K30) forbid barrels. Mocking a barrel hid which module a test really depended on. One example: the SSH tests kept stubbing PTY ownership for a code path that no longer exists. Mocking the owning module makes those dependencies visible.
I considered keeping one combined mock that covers several modules, but that hides the dependency again. Splitting each mock along module lines is what makes stale mocks like the SSH ones show up.
Net lines: production −21 (+47/−68), tests +119 (+349/−230). Nearly all of the test growth comes from one-line barrel mocks becoming two module mocks, which the formatter wraps across lines.
Linked Issue
Phase 3.99 cleanup, PR 2.9 (internal plan). No issue.
Visual Proof
N/A. This is an import-path refactor with no UI or behaviour change.
Testing
Dead-code proof: a resolver script followed every relative specifier in src, config, tests and mobile (this includes the @ts-nocheck files, vi.mock, vi.importActual and dynamic imports) and found 0 references to src/main/ipc/pty left. A string sweep also checked .github.
pnpm tc: clean
pnpm test on all 135 touched or affected test files: 1282 tests passed. This covers every rewritten vi.mock site plus tests/e2e/terminal-account-restart.unit.test.ts.
config/scripts/pr-e2e-gate-contract.test.mjs: passed. node --check on the benchmark script: passed.
pnpm run build:electron-vite, build:cli and build:orcad all succeed. orcad reports zero electron imports.
oxlint on changed files and pnpm run check:code-quality:changed: 0 new findings. pnpm lint: passed.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Independent read-only P0/P1 review run in parallel with self-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
Cross-platform, SSH, mobile, wire: no runtime behaviour, wire format or platform branch changes. The module graph is the same set of modules minus one pass-through file.
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)
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
Walkthrough
The src/main/ipc/pty.ts re-export module was removed. Production code, tests, fixtures, and mock factories now import or mock PTY functionality through dedicated modules, including handler registration, provider registry, state cleanup, listener lifecycle, and kill-all modules. The WSL reattach benchmark now imports PTY registration and cleanup directly. Test behavior is otherwise described as unchanged.
Priority: ⬇️ Low
Merge Risk:⚪ Minimal · up to 4ba6c
This change redirects PTY imports to their owning modules without changing the reviewed startup ordering. No material user-facing risk remains, so the PR is mergeable.
Pre-merge checks | 4 | 1
❌ Failed checks (1 inconclusive)
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 50 files. (105 skipped…
Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name
Status
Explanation
Title check
The title clearly identifies the main change: removal of the src/main/ipc/pty.ts barrel.
Description check
The description is comprehensive. It covers the change, rationale, affected areas, testing, compatibility considerations, and checklist. It states that no linked issue exists, which is acceptable only…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 50 files. (105 skipped: 105 over the file limit.)
✨ 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
src/main/ipc/pty.tswas a file that only re-exported names from about a dozen real terminal modules. Every caller now imports from the module that actually owns the name, and the pass-through file is gone.What Changed
src/main/ipc/pty.ts(33 lines of re-exports). There was no logic in it.ipc/pty/provider/registry,ipc/pty/kill-all,ipc/pty/register-handlers,ipc/pty/register-headless-runtime,ipc/pty/pane/key-state,ipc/pty/provider/state-cleanup,ipc/pty/provider/listener-lifecycle,ipc/pty/host-env/*and so on. This includes the two dynamicawait import(...)calls in orcad.vi.mockon the barrel now mock the module the code under test really imports. The shared mock factories were split to match:ipcPtybecameptyKillAllin the updater harness,ptyProviderRegistryandptyListenerLifecyclein the daemon-init mocks, andptyRegistryModuleMockandptyStateCleanupModuleMockin the worktree mocks.workspace-cleanup.test.tshad an emptyvi.mock('./pty', () => ({})), which is deleted too.Users see no difference. The same functions run in the same order; only the import paths changed.
Why
AGENTS.md and the Phase 3.99 design (K30) forbid barrels. Mocking a barrel hid which module a test really depended on. One example: the SSH tests kept stubbing PTY ownership for a code path that no longer exists. Mocking the owning module makes those dependencies visible.
I considered keeping one combined mock that covers several modules, but that hides the dependency again. Splitting each mock along module lines is what makes stale mocks like the SSH ones show up.
Net lines: production −21 (+47/−68), tests +119 (+349/−230). Nearly all of the test growth comes from one-line barrel mocks becoming two module mocks, which the formatter wraps across lines.
Linked Issue
Phase 3.99 cleanup, PR 2.9 (internal plan). No issue.
Visual Proof
N/A. This is an import-path refactor with no UI or behaviour change.
Testing
Dead-code proof: a resolver script followed every relative specifier in
src,config,testsandmobile(this includes the@ts-nocheckfiles,vi.mock,vi.importActualand dynamic imports) and found 0 references tosrc/main/ipc/ptyleft. A string sweep also checked.github.pnpm tc: cleanpnpm teston all 135 touched or affected test files: 1282 tests passed. This covers every rewrittenvi.mocksite plustests/e2e/terminal-account-restart.unit.test.ts.config/scripts/pr-e2e-gate-contract.test.mjs: passed.node --checkon the benchmark script: passed.pnpm run build:electron-vite,build:cliandbuild:orcadall succeed. orcad reports zero electron imports.oxlinton changed files andpnpm run check:code-quality:changed: 0 new findings.pnpm lint: passed.I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Independent read-only P0/P1 review run in parallel with self-review.
Agent skill upstream boundary
Notes
Cross-platform, SSH, mobile, wire: no runtime behaviour, wire format or platform branch changes. The module graph is the same set of modules minus one pass-through file.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)