test: retry-shield the fence-heartbeat stress test against fs starvation

Under a saturated full-suite run, fd/CPU starvation can make the
takeover-guard fs ops report unavailable, which the fence correctly
treats as fail-closed; the 1ms-heartbeat stress test misread that as the
serialization race. Retries rescue environmental noise only: the real
race fails roughly 6 percent per verify across 300 verifies, so a
mutated build cannot pass any attempt.
This commit is contained in:
reviewer 2026-07-20 18:25:23 +02:00
parent be748c81aa
commit 1f5fe6c5ec

View file

@ -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.