Repository navigation
test(layout): stop rebuilding the runtime and RPC registry per test - #33919
Conversation
The layout-owner tests reset modules and re-imported orca-runtime, the dispatcher and the full RPC registry inside each test. Under CI load the cold transform of that graph exceeds the 30s test timeout. The capability check reads the switch at call time, so it only needs a flipped getter; the window-owned registration check uses the default (switch-off) registry.
|
No actionable comments were generated in the recent review.
|
ELI5
A test in the layout area kept timing out in CI because each test loaded the whole app runtime from scratch. Now the runtime loads once per file, and the test finishes in milliseconds.
What Changed
workspace-layout-paired-desktop.test.tsno longer callsvi.resetModules()and re-importsorca-runtime, the dispatcher and the full RPC registry inside every test. That was about 25 rebuilds per file, and two in "is advertised only by a layout-owner build". It now imports them once.ORCA_LAYOUT_OWNER_IS_MAINgetter.darkSwitchRuntimeCapabilities()reads the switch on everygetStatus(), so the real switch read is still exercised.layout.reopenHeldPanesandlayout.reportViewmoved into the existing window-owned check inworkspace-layout-apply.test.ts, next tolayout.apply. That file now pins the switch off with a plainvi.mock, uses the default registry, and takes thelayout.applydeclaration fromLAYOUT_APPLY_METHODS, as its other tests already do. It no longer rebuilds the registry per test.No production code changed.
Why
The registry and runtime graph is several thousand source modules. When a test re-imports it after
resetModules, the cold transform runs inside the 30s test timeout. Under CI load that transform took longer than the timeout, which is why the "tests node 24 1/5" shard failed on every PR (runs 40298169077, 40299880320, 40299905238). Static imports move the transform to collection, which has no per-test timeout. I didn't raise the timeout or add retries.Linked Issue
N/A, CI flake. No issue.
Visual Proof
N/A. Test-only change.
Testing
Both files pass locally at load average 60-150. Before the change, the paired-desktop file timed out on every test at the same load.
Mutations: making
darkSwitchRuntimeCapabilitiesalways advertise the layout capabilities fails the capability test. RegisteringLAYOUT_APPLY_METHODS/LAYOUT_VIEW_REPORT_METHODSunconditionally inrpc/methods/index.tsfails the window-owned registration test.pnpm tc:node, oxfmt, oxlint (default, js-plugins, type-aware), ast-grep andcheck-changed-code-qualityall pass.Codex review is clean, and an independent review found no P0, P1 or P2 issues.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
Test-only. No impact on platforms, SSH, mobile or compatibility.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)