Skip to content

test(layout): stop rebuilding the runtime and RPC registry per test - #33919

Merged
nwparker merged 1 commit into
mainfrom
nwparker/flake-layout-registry-oct26
Oct 26, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/flake-layout-registry-oct26

Conversation

@nwparker

@nwparker nwparker commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​25 $\color{#cf222e}{\Huge{\mathbf{−}}}$​49 $\color{#cf222e}{\Huge{\mathbf{−}}}$​24
Prod 0 0 0 0

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.ts no longer calls vi.resetModules() and re-imports orca-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.
  • The capability on/off check flips the mocked ORCA_LAYOUT_OWNER_IS_MAIN getter. darkSwitchRuntimeCapabilities() reads the switch on every getStatus(), so the real switch read is still exercised.
  • The window-owned registration checks for layout.reopenHeldPanes and layout.reportView moved into the existing window-owned check in workspace-layout-apply.test.ts, next to layout.apply. That file now pins the switch off with a plain vi.mock, uses the default registry, and takes the layout.apply declaration from LAYOUT_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 darkSwitchRuntimeCapabilities always advertise the layout capabilities fails the capability test. Registering LAYOUT_APPLY_METHODS / LAYOUT_VIEW_REPORT_METHODS unconditionally in rpc/methods/index.ts fails the window-owned registration test.

  • pnpm tc:node, oxfmt, oxlint (default, js-plugins, type-aware), ast-grep and check-changed-code-quality all 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

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

Notes

Test-only. No impact on platforms, SSH, mobile or compatibility.

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)

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.
@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1fb2bc98-9062-46b4-9ca4-f08fa02e9d5d
Commits

Reviewing files that changed from the base of the PR and between 34f55ca and 9c25187.

Files selected for processing: 2
  • src/main/runtime/rpc/methods/workspace-layout-apply.test.ts
  • src/main/runtime/rpc/methods/workspace-layout-paired-desktop.test.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.

Walkthrough

The workspace layout RPC tests now use directly imported modules instead of rebuilding modules with different layout-owner settings. The apply tests check that selected layout methods are absent from the default window-owned registry and look up layout.apply directly from LAYOUT_APPLY_METHODS. The paired desktop tests retain dispatch, streaming, and reporting checks with direct imports and update capability checks to use the current layout-owner configuration.

Priority: Low

Merge Risk: Minimal · up to 9c251

This test-only change is mergeable; its optimized setup retains coverage of both layout-owner registry branches and call-time capability behavior.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning 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 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "test(layout): stop rebuilding the runtime and RPC registry per test" matches the main change. The diff removes per-test vi.resetModules() and re-imports of orca-runtime, the dispatcher, and…
Description check Passed The description follows the repository template closely. It includes ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, AI Disclosure section (left blank, which is allowed for internal cont…
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.
Full details: Title check

Explanation

The title "test(layout): stop rebuilding the runtime and RPC registry per test" matches the main change. The diff removes per-test vi.resetModules() and re-imports of orca-runtime, the dispatcher, and the RPC registry in the layout test files, and imports them once per file. The title is short, single-sentence, and specific. It uses a conventional commit prefix, which is consistent with a test-only change.

Full details: Description check

Explanation

The description follows the repository template closely. It includes ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing, AI Disclosure section (left blank, which is allowed for internal contributors), Review, Agent skill upstream boundary, Notes, and Checklist. The What Changed section gives the before and after and the mechanism. The Why section explains the 30s cold-transform timeout and why static imports were chosen over raising the timeout. Testing lists local runs, mutation checks, and lint and typecheck results. The Linked Issue section says N/A with a reason, but the template says outside contributors must link an actual issue. The author appears to be a maintainer, so this is a minor gap, not a failure. The Visual Proof section gives an N/A reason as required.

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.

@nwparker
nwparker merged commit 5652de8 into main Oct 26, 2026
32 checks passed
nwparker added a commit that referenced this pull request Oct 26, 2026
#33919 and #33923 both fixed this file's cold-import timeout and crossed: #33923's beforeAll calls switchedBuild, which #33919 replaced with static imports. Main fails typecheck (TS2304). The static imports already pay the transform once.
nwparker added a commit that referenced this pull request Oct 26, 2026
…3934)

#33919 and #33923 both fixed this file's cold-import timeout and crossed: #33923's beforeAll calls switchedBuild, which #33919 replaced with static imports. Main fails typecheck (TS2304). The static imports already pay the transform once.
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