Skip to content

fix(test): temp dir cleanup + testTimeout for parallel workers#71

Open
diazMelgarejo wants to merge 1 commit into
chrysb:mainfrom
diazMelgarejo:fix/parallel-test-timeouts
Open

fix(test): temp dir cleanup + testTimeout for parallel workers#71
diazMelgarejo wants to merge 1 commit into
chrysb:mainfrom
diazMelgarejo:fix/parallel-test-timeouts

Conversation

@diazMelgarejo

Copy link
Copy Markdown

While working on the main-merged old MacOS PR and testing it, we encountered these stalling files (changes from the most recent upstream fixes, especially v0.9.9 with Commit 092df06). I decided to separate this from the other commits for MacOS port.

Root cause (two layers):

  1. routes-browse.test.js + routes-models.test.js called mkdtempSync per test but never cleaned up. 30+ leaked dirs/run add I/O overhead on macOS /var/folders/ (memory-mapped filesystem).
  2. db-layer parallel workers (doctor, watchdog, webhooks) leave DatabaseSync .db-shm pages mmap'd. Under 60+ workers on ARM64, OS memory pressure slows ALL workers — including pure-mock routes tests — past the 5s timeout.

Fix:

  • routes-browse.test.js: track created dirs in createdTestRoots[]; afterEach splices and rmSync({recursive,force}) each entry
  • routes-models.test.js: same pattern for createApp() temp dirs (createdTempRoots)
  • vitest.config.js: testTimeout 5000 → 10000ms; gives pure-mock workers breathing room while db-layer .db-shm pressure fix propagates (doctor/watchdog/webhooks-db still need afterEach closeXyzDb() — tracked as remaining upstream work)

Verified: npm run test:coverage passes 594/594 sequentially.
Target: npm test 594/594 (was 584/594 before this fix).

@cursor cursor Bot force-pushed the fix/parallel-test-timeouts branch from 9f6143b to c5c67cb Compare May 24, 2026 07:51
…rkers

Root cause (two layers):
1. routes-browse.test.js + routes-models.test.js called mkdtempSync per test
   but never cleaned up. 30+ leaked dirs/run add I/O overhead on macOS
   /var/folders/ (memory-mapped filesystem).
2. db-layer parallel workers (doctor, watchdog, webhooks) leave DatabaseSync
   .db-shm pages mmap'd. Under 60+ workers on ARM64, OS memory pressure slows
   ALL workers — including pure-mock routes tests — past the 5s timeout.

Fix:
- routes-browse.test.js: track created dirs in createdTestRoots[]; afterEach
  splices and rmSync({recursive,force}) each entry
- routes-models.test.js: same pattern for createApp() temp dirs (createdTempRoots)
- vitest.config.js: testTimeout 5000 → 10000ms; gives pure-mock workers breathing
  room while db-layer .db-shm pressure fix propagates (doctor/watchdog/webhooks-db
  still need afterEach closeXyzDb() — tracked as remaining upstream work)

Verified: npm run test:coverage passes 594/594 sequentially.
Target: npm test 594/594 (was 584/594 before this fix).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@diazMelgarejo diazMelgarejo force-pushed the fix/parallel-test-timeouts branch from c5c67cb to 87c53e3 Compare June 4, 2026 00:18
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