Repository navigation
refactor(renderer): remove the web-session-tabs-sync barrel - #27969
Conversation
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to The test may clean up before its post-create refresh finishes, risking intermittent test interference. No production behavior regression is established. Pre-merge checks |
|
310d694 to
f84cfe2
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
1c4cdffa-2680-4d44-8ecd-4e112bff2965
📥 Commits
Reviewing files that changed from the base of the PR and between 310d6940a7c1666893ba2fb8b4e2fa8f3a862dde and f84cfe2.
📒 Files selected for processing (4)
src/renderer/src/lib/worktree-activation-empty-remote.test.tssrc/renderer/src/runtime/web-runtime-session-snapshot.tssrc/renderer/src/runtime/web-runtime-session-tab-activate-close.test.tssrc/renderer/src/runtime/web-runtime-session-terminal-host-authority.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/renderer/src/runtime/web-runtime-session-snapshot.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.
| await vi.waitFor(() => | ||
| expect(callRuntimeEnvironment).toHaveBeenCalledWith( | ||
| expect.objectContaining({ method: 'session.tabs.list' }) | ||
| ) |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
rg -n -C 5 'callRuntimeEnvironment|session\.tabs\.list|afterEach|beforeEach' \
src/renderer/src/lib/worktree-activation-empty-remote.test.ts \
src/renderer/src/runtime/web-runtime-session-snapshot.ts
rg -n -C 4 'callRuntimeEnvironment' src/renderer/src --glob '*.ts' --glob '*.tsx'Repository: stablyai/orca
Length of output: 41475
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- test helpers and changed test ---'
sed -n '1,135p' src/renderer/src/lib/worktree-activation-empty-remote.test.ts
printf '%s\n' '--- bridge stub definition ---'
rg -n -F --glob '*.ts' --glob '*.tsx' 'function stubRuntimeEnvironmentBridge|const stubRuntimeEnvironmentBridge|export .*stubRuntimeEnvironmentBridge' src/renderer/src
printf '%s\n' '--- wake helper and snapshot callers ---'
rg -n -C 8 -F --glob '*.ts' --glob '*.tsx' 'ensureWebRuntimeWorktreeTerminalAfterWake' src/renderer/src
rg -n -C 8 -F --glob '*.ts' --glob '*.tsx' 'refreshWebRuntimeSessionTabsSnapshot' src/renderer/srcRepository: stablyai/orca
Length of output: 4690
🏁 Script executed:
set -euo pipefail
sed -n '1,135p' src/renderer/src/lib/worktree-activation-empty-remote.test.ts
rg -n -C 10 -F --glob '*.ts' --glob '*.tsx' 'stubRuntimeEnvironmentBridge' src/renderer/src
rg -n -C 10 -F --glob '*.ts' --glob '*.tsx' 'ensureWebRuntimeWorktreeTerminalAfterWake' src/renderer/src
rg -n -C 10 -F --glob '*.ts' --glob '*.tsx' 'refreshWebRuntimeSessionTabsSnapshot' src/renderer/srcRepository: stablyai/orca
Length of output: 45667
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- bridge fixture ---'
sed -n '1,240p' src/renderer/src/runtime/runtime-environment-bridge-fixture.ts
printf '%s\n' '--- wake helper ---'
sed -n '1,280p' src/renderer/src/lib/web-runtime-worktree-terminal-after-wake.ts
printf '%s\n' '--- snapshot refresh ---'
sed -n '1,180p' src/renderer/src/runtime/web-runtime-session-snapshot.tsRepository: stablyai/orca
Length of output: 14045
🏁 Script executed:
set -euo pipefail
rg -n -F --glob '*.ts' --glob '*.tsx' 'export async function createWebRuntimeSessionTerminal' src/renderer/src
rg -n -C 20 -F --glob '*.ts' --glob '*.tsx' 'refreshWebRuntimeSessionTabsSnapshot' src/renderer/src/runtime/web-runtime-terminal-creation.ts src/renderer/src/lib src/renderer/src/runtimeRepository: stablyai/orca
Length of output: 42862
🏁 Script executed:
set -euo pipefail
printf '%s\n' '--- terminal creation wrapper ---'
sed -n '1,220p' src/renderer/src/runtime/web-runtime-terminal-creation.ts
printf '%s\n' '--- terminal create operation ---'
sed -n '1,180p' src/renderer/src/runtime/web-runtime-terminal-create-operation.tsRepository: stablyai/orca
Length of output: 10989
🏁 Script executed:
set -euo pipefail
rg -n -C 18 -F -- 'refreshWebRuntimeSessionTabsSnapshot(' src/renderer/src/runtime/web-runtime-terminal-create-operation.tsRepository: stablyai/orca
Length of output: 2078
Await the post-create refresh before cleanup.
toHaveBeenCalledWith only observes the session.tabs.list dispatch. ensureWebRuntimeWorktreeTerminalAfterWake discards the terminal-creation promise, while terminal creation awaits the refresh after that request. The test can finish and run synchronous cleanup before the refresh completes.
Expose the terminal-creation completion promise to this test, then await it instead of waiting only for the recorded request.
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
…n-tabs-sync modules Why: upstream removed both barrels (stablyai#27967, stablyai#27969).
ELI5
src/renderer/src/runtime/web-session-tabs-sync.tsonly re-exported names from the files in itsweb-session-tabs-sync/folder. This PR points every importer at the file that defines what it uses, and deletes the forwarding file. It is the second of the six barrel PRs, after #27967.What Changed
Users see no difference.
import()calls in the runtime session code, now import fromweb-session-tabs-sync/{snapshot-api,tracking-lifecycle,tracking-mappings,tracking-decisions,store-patch,mirror-settle,state,use-web-session-tabs-sync}.refreshWebRuntimeSessionTabsSnapshotused to load the barrel's namespace with oneawaitat the top and destructure from it later. It now loads its four modules with onePromise.allat the same spot. That keeps the later "record the list's receipt, then apply it" step free of any newawait, so the receipt order is unchanged.vi.mockof the barrel is split into one mock per defining module, with the same values.worktree-activation-empty-remote.test.ts: the first test now waits for its post-create snapshot refresh to finish. With direct imports that refresh runs sooner, and if left running it could reach the next test's bridge. The later tests keep their exact call-count assertions.tracking-decisionsnow keep the module's real exports (importOriginal), so the staticWEB_SESSION_TABS_FRAME_OUTRANKEDimport in the snapshot refresh still resolves.use-web-session-tabs-sync,snapshot-apiorstore-patch. The restart-survival route already matched the whole folder.Net: production −52 (+37/−89), tests +131 (+307/−176; the split mocks).
Why
Phase 3.99 / AGENTS.md rule: no barrels. With direct imports, a test mocks exactly the module the code under test calls, and the import line says which part of the session mirror a file depends on.
Linked Issue
N/A, internal Phase 3.99 cleanup (PR 3.5b).
Visual Proof
N/A, no UI or behaviour change.
Testing
No import, mock or
import()ofruntime/web-session-tabs-sync(the file) remains insrc tests mobile config .github.pnpm test src/rendererplus the PR routing config tests: 4740 files and 41388 tests pass. The local failures are an environment-only config test (pr-auxiliary-preflight-admission, which also fails on main here) and one alt-screen test that timed out under machine load and passes when run alone.pnpm tc,pnpm lint,pnpm run check:code-quality:changed(0 findings).I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
P0/P1 review: my own review plus an independent reviewer.
Agent skill upstream boundary
Notes
Renderer-only import changes. SSH, wire, mobile and platforms are not affected.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)