Skip to content

refactor(renderer): remove the web-session-tabs-sync barrel - #27969

Merged
OrcaWin merged 1 commit into
mainfrom
OrcaWin/p399-3-5b
Oct 12, 2026
Merged

OrcaWin merged 1 commit into
mainfrom
OrcaWin/p399-3-5b

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 50 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​312 $\color{#cf222e}{\Huge{\mathbf{−}}}$​175 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​137
Prod 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​39 $\color{#cf222e}{\Huge{\mathbf{−}}}$​91 $\color{#cf222e}{\Huge{\mathbf{−}}}$​52

ELI5

src/renderer/src/runtime/web-session-tabs-sync.ts only re-exported names from the files in its web-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.

  • Production importers, including the app-shell hook and five lazy import() calls in the runtime session code, now import from web-session-tabs-sync/{snapshot-api,tracking-lifecycle,tracking-mappings,tracking-decisions,store-patch,mirror-settle,state,use-web-session-tabs-sync}.
  • refreshWebRuntimeSessionTabsSnapshot used to load the barrel's namespace with one await at the top and destructure from it later. It now loads its four modules with one Promise.all at the same spot. That keeps the later "record the list's receipt, then apply it" step free of any new await, so the receipt order is unchanged.
  • Tests: every vi.mock of 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.
  • Two tests that mock tracking-decisions now keep the module's real exports (importOriginal), so the static WEB_SESSION_TABS_FRAME_OUTRANKED import in the snapshot refresh still resolves.
  • CI routing: the e2e routes and their contract tests named the barrel file. They now name the module that does the work: use-web-session-tabs-sync, snapshot-api or store-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() of runtime/web-session-tabs-sync (the file) remains in src tests mobile config .github.

  • pnpm test src/renderer plus 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

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

Notes

Renderer-only import changes. SSH, wire, mobile and platforms are not affected.

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)

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough
📝 Walkthrough

Walkthrough

Production code now imports web-session tab synchronization APIs from focused modules instead of the former re-export file, which was removed. Tests and mocks use those module paths. Routing rules and their tests now identify specific synchronization files. The empty-remote activation test also waits for the subsequent session.tabs.list call.


Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to f84cf

The test may clean up before its post-create refresh finishes, risking intermittent test interference. No production behavior regression is established.

Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.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. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check Passed The title clearly and concisely describes the primary change: removing the web-session-tabs-sync barrel.
Description check Passed The description is complete and aligned with the template. It explains the change, rationale, testing, scope, visual impact, review status, and checklist items. It also discloses known test limitation…

  • 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.

@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
  • 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.ts
  • src/renderer/src/runtime/web-runtime-session-snapshot.ts
  • src/renderer/src/runtime/web-runtime-session-tab-activate-close.test.ts
  • src/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.

Comment on lines +121 to +124
await vi.waitFor(() =>
expect(callRuntimeEnvironment).toHaveBeenCalledWith(
expect.objectContaining({ method: 'session.tabs.list' })
)

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.

🩺 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/src

Repository: 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/src

Repository: 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.ts

Repository: 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/runtime

Repository: 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.ts

Repository: 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.ts

Repository: 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.

@OrcaWin
OrcaWin merged commit f8daed0 into main Oct 12, 2026
45 checks passed
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 27, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 27, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 27, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 27, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 27, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 28, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 28, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 28, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 28, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 30, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 30, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 30, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 30, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 31, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 31, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 31, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 31, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 31, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 31, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 31, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 31, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 31, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 31, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 31, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 31, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Oct 31, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Nov 1, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Nov 1, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Nov 1, 2026
lucacri pushed a commit to lucacri/orca that referenced this pull request Nov 3, 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.

1 participant