Skip to content

test: reuse modules across host snapshot recovery cases - #29471

Merged
OrcaWin merged 4 commits into
mainfrom
OrcaWin/test-audit-host-snapshot-module-reuse
Oct 16, 2026
Merged

OrcaWin merged 4 commits into
mainfrom
OrcaWin/test-audit-host-snapshot-module-reuse

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

The three remote snapshot recovery tests now load their application modules once per file. Each case still gets its own runtime, transport, pane, store and terminal buffers.

What Changed

Remove the per-case module-cache reset and await the existing asynchronous terminal environment setup before starting each case. Keep the dynamic imports, fresh fixtures, cleanup and every case body/assertion unchanged. No application code changes.

Why

Reloading the full host and renderer graph for every case costs time without adding isolation to these already separate objects. Waiting for setup explicitly prevents a cached import from letting a case start before its fake browser API and startup snapshot are ready. Existing transport disposal releases the last multiplexer stream; existing teardown disposes startup snapshots and restores mocks. This uses those lifecycle boundaries rather than adding a test-only production reset.

Linked Issue

Maintainer-requested test audit; no separate issue.

Visual Proof

N/A — test setup only; no application behavior or UI changes.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Linux, Bun 1.4.3 / Node 24.21.0, one worker and background launch: three alternating full-file pairs pass the same three cases. Median module time 11.919 → 9.898 s (16.96% lower; ranges 11.822–11.949 vs 9.540–9.946 s). Median process wall 13.437 → 11.521 s (14.25% lower; ranges 13.405–13.628 vs 11.434–11.674 s). Full-file measurements include imports; no whole-PR gain claimed.

Ignoring the actual replay painter's history flag makes both original and candidate fail the same existing assertion: recovered normal history lacks MISSED-299. Production bytes restored exactly. All 59 owner/replay/history/paint sibling cases pass; shuffled owner passes all three. Web typecheck, normal and anti-slop lint, formatting, diff and all changed-code quality checks pass. Independent final review approved fixture isolation, awaited setup, unchanged case bodies and caught history regression; Hosted original exact source qualified at run 38850544014 / merge ebd94e7: all three cases passed, module 9.711 s on Blacksmith X64 four workers / Node 24.19.0 / Bun 1.4.3. Candidate hosted result is reported below; this historical unpaired original is not a controlled whole-PR baseline.

These cases exercise the real host headless model, snapshot publisher, wire codec, remote transport, pane replay and xterm buffer results through in-process boundary fixtures. They do not exercise a physical SSH connection, OS PTY or rendered Electron window. Existing baseline sometimes logs a missing fake Codex account API from a late sweep; candidate runs have no such warning after explicitly awaited setup. No warning suppression was added.

Review

Cross-platform, SSH and mixed-version contracts remain in the unchanged tests. All three test bodies and their assertions are byte-identical. Preserve live-TUI alternate-frame/covered-history parity, exited-TUI normal recovery and missed history between two TUI sessions.

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.

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)

Refresh validation: Refreshed onto main 723c258 after #29499 repaired inherited CI failures. Candidate bytes remain identical to the approved patch. Refreshed target passes all three cases (official module 9,609 ms); five recovery/snapshot sibling suites pass 55 cases. Fresh exact-head run 38866749458 has passed.

Hosted validation: Exact-head full PR run 38866749458 passed, including aggregate PR checks passed and all five clean unit shards. All three target cases passed; official module cost 6,387 ms versus historical original 9,711 ms. This 34.2% lower observation is descriptive: main, dependencies, runner and scheduling differ, so no causal or whole-PR saving is claimed.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 50a32fcd-8abc-4363-a771-b2b1c4b519b2
📥 Commits

Reviewing files that changed from the base of the PR and between a8f2c65 and df7ef2d.

📒 Files selected for processing: 1
  • src/renderer/src/components/terminal-pane/remote-snapshot-alt-screen-host-chain.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

📝 Walkthrough

The test suite’s beforeEach hook is now asynchronous and awaits terminal-global installation. It no longer calls vi.resetModules().

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to df7ef

This test-only change has no identified actionable merge-blocking risk; the cases reset their fixtures and clean up relevant state.

Pre-merge checks: Passed 5
Check name Status Explanation
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
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 main change: reusing modules across host snapshot recovery test cases.
Description check Passed The description covers the required sections, explains the change and rationale, documents testing and limitations, and identifies the visual proof as not applicable. The missing issue link is reasona…
Full details: Description check

Explanation

The description covers the required sections, explains the change and rationale, documents testing and limitations, and identifies the visual proof as not applicable. The missing issue link is reasonably explained by the maintainer exception, and CI validation is documented later in the description.

✨ Finishing Touches: 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • 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.

@OrcaWin
OrcaWin merged commit 1a95149 into main Oct 16, 2026
31 checks passed
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