Skip to content

test(startup): stop paying the ready graph's cold transform inside the first test - #33925

Merged
nwparker merged 2 commits into
mainfrom
nwparker/flake-ready-identity-oct26
Oct 26, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/flake-ready-identity-oct26

Conversation

@nwparker

@nwparker nwparker commented Oct 26, 2026 •

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

ELI5

The startup identity test had to load the whole app-startup code fresh. That loading happened inside the first test's time limit, so under a busy CI machine the first tests timed out. Now the code is prepared before any test starts.

What Changed

main-process-ready-identity-write.test.ts gets one static import './main-process-ready'. The tests are unchanged and still call vi.resetModules() and re-import main-process-ready per test. They need that to reset the browser session startup's one-shot initialized latch, which has no reset hook. The difference is that the cold transform of that graph now happens at collection, which has no per-test timeout. Later re-imports reuse the transformed code: vitest 5's resetModules clears evaluated state only, and keeps fetched code.

No production code changed.

Why

On origin/main at load average ~100, these were the per-test times:

  • win32 packaged=true: 30008ms (timed out)
  • win32 packaged=false: 30003ms (timed out)
  • darwin: 4161ms
  • each of the remaining four: 140-335ms

So only the cold transform was slow; a warm re-evaluation fits well inside 30s. The alternative was removing resetModules, which would mean adding a new production test-reset export for the browser session startup latch. 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

  • All 7 tests pass locally at load average 60-150, in a run that spent 2078s on collection-time transform.

  • Mutation: making foundation always call setAppUserModelId(identity.appUserModelId) fails sets Windows app identity on win32 (packaged=false).

  • pnpm tc:node, oxfmt, oxlint (default, js-plugins, type-aware), ast-grep and check-changed-code-quality all pass.

  • Codex review is clean. An independent review approved with one P3 note: per-test re-evaluation remains, but costs about 100x less than the timeout.

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

…e first test

Each test resets modules and re-imports main-process-ready to reset the
browser session registry's one-shot latch. Without a static import, the first
tests paid the cold transform of that graph inside the 30s test timeout and
timed out under CI load; later tests re-evaluate cached transforms in ~200ms.
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 3 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 6a03eabf-6729-4a8c-ab71-f47beb3964d8
Commits

Reviewing files that changed from the base of the PR and between 1a77543 and 00c42b3.

Files selected for processing: 1
  • src/main/startup/main-process-ready-identity-write.test.ts
  • 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 4a37a6b into main Oct 26, 2026
33 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