diff --git a/tests/cache-refresh-lock.test.ts b/tests/cache-refresh-lock.test.ts index aac8b50..a8fc163 100644 --- a/tests/cache-refresh-lock.test.ts +++ b/tests/cache-refresh-lock.test.ts @@ -204,7 +204,11 @@ describe('warm session-cache refresh lock', () => { expect(sessionCachePath()).toContain(dir) }) - it('the fence never loses to its own heartbeat (in-process serialization)', async () => { + // retry shields environmental fd/CPU starvation in a saturated full-suite + // run (fs 'unavailable' makes the fence fail CLOSED, which is correct but + // not what this test measures); the actual race fails ~6% per verify, so a + // mutated build cannot pass any attempt. + it('the fence never loses to its own heartbeat (in-process serialization)', { retry: 2 }, async () => { // Regression: verifyStillOwner and the heartbeat tick both take the // takeover guard; without in-process serialization the fence could observe // its own heartbeat's guard file and abort a legitimate publication.