[scanner] fix: resolve systemic test failures from #21283 regression#21296
Conversation
Update the afterAll comment in setup.ts to accurately describe the current isolate:true behaviour (afterAll runs once per FILE, correctly cleaning up vi.stubGlobal() stubs) and to warn that setting isolate:false causes afterAll to run only once per shard — the root cause of 1598 test failures in Coverage Suite run #4339. Root-cause summary for #21284: PR #21283 set isolate:process.env.CI?false:true to work around suspected OOM crashes from chunk-splitting (#21083). With isolate:false all test files in a shard share one Vitest worker process. vi.stubGlobal() calls made at module scope in one file leaked into every subsequent file; the afterAll vi.unstubAllGlobals() in setup.ts ran only once at the end of the shard, not once per file, so contamination accumulated. Restoring isolate:true (PR #21290, commit 0f81cb0) fixed the failures. This commit updates setup.ts to make that constraint explicit and to point future maintainers at the full explanation in vite.config.ts. Fixes #21284 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Scanner <scanner@kubestellar.io>
✅ Deploy Preview for kubestellarconsole ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
👋 Hey @clubanderson — thanks for opening this PR!
This is an automated message. |
|
🐝 Hi @clubanderson! I'm Trusted users — org members and contributors with write access — can mention Automation may take a moment to start, and follow-up happens through workflow activity rather than chat replies. |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
There was a problem hiding this comment.
Pull request overview
Updates the Vitest global-stub cleanup documentation in web/src/test/setup.ts to reflect the restored isolate: true behavior in CI and to warn against reintroducing isolate:false, which previously caused widespread cross-file vi.stubGlobal() leakage and mass test failures.
Changes:
- Rewrites the
afterAllcomment insetup.tsto describe current per-file isolation semantics. - Adds an explicit warning not to disable
isolateagain, referencing the prior failure incident.
| // Clear global stubs when this test file finishes. | ||
| // With isolate:true (current setting in vite.config.ts), the setupFile runs inside | ||
| // each test file's own subprocess, so this afterAll executes once per FILE — |
✅ Post-Merge Verification: passedCommit: |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
Fixes #21284
Root Cause
PR #21283 (commit
294a689) setisolate: process.env.CI ? false : trueinweb/vite.config.tsto work around suspected OOM crashes from chunk-splitting (#21083). Withisolate: false, all test files in a CI shard share one Vitest worker process. Thevi.stubGlobal()calls made at module scope in individual test files leaked into every subsequent file — becauseafterAllinsetup.ts(which callsvi.unstubAllGlobals()) ran only once at the end of the shard, not once per file. This cross-file contamination caused 1598 test failures in Coverage Suite run #4339.Fix
The
isolate: truerestoration was applied in commit0f81cb019(PR #21290). This PR completes the fix by updatingweb/src/test/setup.tsto:afterAllblock (which described the brokenisolate: falsebehaviour) with accurate documentation of the currentisolate: truesemantics.DO NOT set isolate:falsewarning that references this issue to prevent recurrence.Why
isolate: falsebroke 1598 testsisolate:true(correct)isolate:false(broken by #21283)setup.tsre-imported per file →afterAllruns per filesetup.tsloaded once →afterAllruns once at end of shardvi.stubGlobal()cleaned up after each file