Problem
tests/search/embedding-regression.test.ts intermittently fails on Windows with:
Error: EBUSY: resource busy or locked, unlink 'C:\Users\RUNNER~1\AppData\Local\Temp\codegraph-embed-regression-XXXXX\.codegraph\graph.db'
The test already has a 3-attempt retry loop in afterAll (added previously) and calls flushDeferredClose() before attempting deletion, but the file lock is not always released in time even with the retry logic.
Evidence
Root Cause
SQLite WAL mode on Windows holds file locks longer than the 3×100ms retry budget allows. The better-sqlite3 db.close() call triggers a WAL checkpoint that can take several hundred milliseconds on Windows.
Fix Direction
Options:
- Increase the retry count or delay (e.g., 5 attempts × 200ms)
- Use
process.on('exit', ...) to defer cleanup to process exit instead of afterAll
- Use a retry-based
rmSync helper that can wait longer on Windows (up to 2–3s)
Problem
tests/search/embedding-regression.test.tsintermittently fails on Windows with:The test already has a 3-attempt retry loop in
afterAll(added previously) and callsflushDeferredClose()before attempting deletion, but the file lock is not always released in time even with the retry logic.Evidence
fix/native-prototype-extraction-1327also has a CI run (27055128276) with a different failure, confirming this is pre-existingRoot Cause
SQLite WAL mode on Windows holds file locks longer than the 3×100ms retry budget allows. The
better-sqlite3db.close()call triggers a WAL checkpoint that can take several hundred milliseconds on Windows.Fix Direction
Options:
process.on('exit', ...)to defer cleanup to process exit instead ofafterAllrmSynchelper that can wait longer on Windows (up to 2–3s)