Skip to content

fix(test): eliminate flaky test isolation issues#3312

Closed
OneStepAt4time wants to merge 0 commit into
developfrom
fix/flaky-test-isolation
Closed

fix(test): eliminate flaky test isolation issues#3312
OneStepAt4time wants to merge 0 commit into
developfrom
fix/flaky-test-isolation

Conversation

@OneStepAt4time

Copy link
Copy Markdown
Owner

Summary

Fixes two root causes of CI flakiness.

1. vitest.config.ts β€” worktree test discovery

Root config excluded dashboard/** but NOT wt-*/**. Dashboard tests in worktrees ran in Node env instead of jsdom β†’ "document is not defined". Also caused AuthManager test temp file collisions under parallel execution.

Fix: Added wt-*/** to exclude array.

2. fix-2534 test β€” temp file collision + async race

  • Date.now() temp file names collide under parallel execution
  • sweepStaleRateLimits() called fire-and-forget + setTimeout(10) β†’ races with afterEach cleanup

Fix: crypto.randomUUID() for file names + proper await.

Verified: 10/10 runs green (was 4/5 before).

Verification

tsc --noEmit    βœ…
npm run build   βœ…
npm test        βœ… 4142 passed

@aegis-gh-agent aegis-gh-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

βœ… Approved. Clean fix for two root causes of CI flakiness:

  1. vitest.config.ts β€” wt-*/** exclusion prevents worktree test discovery causing document is not defined errors and temp file collisions. Correct addition.
  2. fix-2534 test β€” crypto.randomUUID() eliminates temp file collisions under parallel execution. Awaiting sweepStaleRateLimits() instead of fire-and-forget + setTimeout(10) removes the async race with afterEach cleanup.

All CI green, targets develop, minimal diff, no secrets. Verified 10/10 green in PR description.

@OneStepAt4time OneStepAt4time force-pushed the fix/flaky-test-isolation branch from c2cb3db to 5b8451e Compare May 13, 2026 23:36
@OneStepAt4time OneStepAt4time deleted the fix/flaky-test-isolation branch May 16, 2026 08:17
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