Repository navigation
A paired server's workspace never gets main's layout commands: a pinning test (dark, layout-owner build only) - #30430
Conversation
…ayout.apply Every renderer sender of layout.apply (sendLayoutApply, recordLayoutApply, the activation terminal create and the live terminal adoption) returns before the call for a worktree or folder workspace a paired server owns, and a source census pins that no other renderer file sends layout.apply.
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
🧹 Nitpick comments: 1
src/renderer/src/runtime/layout-apply-paired-server-guard.test.ts: 1
112-143: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCount all valid
layout.applystring spellings.The census splits only on
'layout.apply'. A new renderer sender that uses"layout.apply"would be omitted, and the assertion would still pass. The layout-writer ratchet does not inspect RPC method names.Suggested fix
- const count = readFileSync(full, 'utf8').split(`'layout.apply'`).length - 1 + const count = readFileSync(full, 'utf8').match(/(['"`])layout\.apply\1/g)?.length ?? 0
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4ee479c2-d80f-4e87-8de7-5f0ac3e9c431
📒 Files selected for processing: 1
src/renderer/src/runtime/layout-apply-paired-server-guard.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
ELI5
When Orca is paired with another Orca server, the tabs and panes of a workspace on that server belong to the server. In the build where this app's background process owns the layout, the window must never send that workspace's layout changes to its own background process. This PR adds a test that fails if any code path ever does.
What Changed
Test only. No product code changes, and nothing users see changes.
The new test
src/renderer/src/runtime/layout-apply-paired-server-guard.test.tsuses the real owner lookup (not a mock) with a worktree and a folder workspace that a paired server owns, and checks that:sendLayoutApplyreturns false and sends nothing for pane, tab, terminal-create, sleep and default-tabs commands, andrecordLayoutApplysends nothing either.as-today.layout.applynamed only inlayout-apply-send.ts(once) andterminal-tab-create-through-layout-owner.ts(twice). Every other sender goes throughsendLayoutApply, so a new direct sender fails this test until it carries the same check and a case here.Why
Paired servers keep their own layout and the window mirrors it, before and after main takes over the layout. That rule rests on one owner check (
runtimeEnvironmentIdUnlessTwin) at three call sites. The existing tests mock that check, so nothing pinned that a real paired-server workspace is caught, or that no sender bypasses it. A source scan was chosen over a per-caller test of all ~30 callers because the callers all funnel into the three checked sites; pinning the sites and the funnel covers every caller with one small test.Linked Issue
N/A (maintainer, internal refactor step).
Visual Proof
N/A: test-only change, no UI or behaviour change.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
New test: 23 cases pass. With the owner check removed from
sendLayoutApplyand both terminal-create paths, 20 of 23 fail (the other 3 are the owner lookup and the source scan), so the test bites.pnpm exec vitest run --maxWorkers=4 --config config/vitest.config.tson the new test,layout-apply-send.test.tsandterminal-tab-create-through-layout-owner.test.ts: 46 passed.pnpm tc: pass.pnpm run check:code-quality:changed: pass.check:layout-writer-ratchets,check:focus-read-ratchet,audit:anti-slop: pass.Shipped build: unchanged by construction (only a
.test.tsfile is added, which no bundle includes). Save-divergence detector: not applicable (no runtime change).Review
Agent skill upstream boundary
Notes
No security, platform, SSH, mobile, compatibility or performance impact: test only.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)