Repository navigation
test(startup): stop paying the ready graph's cold transform inside the first test - #33925
Merged
Merged
Conversation
…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.
Contributor
|
Warning Review limit reachedYou'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. View limit details
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. Comment |
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tsgets one staticimport './main-process-ready'. The tests are unchanged and still callvi.resetModules()and re-importmain-process-readyper test. They need that to reset the browser session startup's one-shotinitializedlatch, 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'sresetModulesclears 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: 4161msSo 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)failssets Windows app identity on win32 (packaged=false).pnpm tc:node, oxfmt, oxlint (default, js-plugins, type-aware), ast-grep andcheck-changed-code-qualityall 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
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)