You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
testConcurrentStealContentionPreservesMutualExclusion asserted a hard
mutual-exclusion invariant (overlaps == 0, maxInside == 1) that the
FileTokenStore cross-process lock does not provide. stealIfStale is
best-effort by design and documents a three-actor residual - a peer
recreating the lock while a second captures that fresh live lock and a
third claims the freed path - under which two holders briefly run at
once, degrading only to one extra token refresh (Layer-1 atomic rename
keeps the credential intact). Under four-way contention that residual is
reachable, so the test failed intermittently on CI.
A stress harness confirmed the mechanism: 8 contenders overlapped in 12
of 700 iterations (maxInside 2), while 2 contenders never overlapped in
800 iterations.
Split the one over-strict test in two:
- testConcurrentStealContentionTwoWayPreservesMutualExclusion runs two
contenders and keeps the strict overlaps == 0 / maxInside == 1
assertions. The three-actor residual cannot arise with two threads, so
this is deterministic and still pins the exclusion the atomic capture
guarantees.
- testConcurrentStealContentionDegradesCleanly runs four contenders and
asserts only the benign invariants - every contender runs its section
and no capture temp leaks - tolerating the documented residual.
No production change. Full FileTokenStoreTest is 40/40 green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments