test(auth): stop pinning the MFA burst to its size #508
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-753-mfa-burst-test-flake"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
concurrent_wrong_mfa_codes_all_countfired 20 concurrent wrong second-factor codes and assertedmfa_failed_attempts >= 20. That holds only when all 20 racers clear the lockout gate before the third failure commits. The gate is checked before any code is verified, so a racer arriving after the lockout arms getsRateLimitedand returns without spending a guess or ticking the counter (src/modules/auth/service.rs:670). Which racers land on each side is pure scheduling, so the assertion was load-dependent: integration.yml run #3783 recorded 17.Assert the invariant PMS-693 actually protects instead: the counter equals the number of attempts that reached the verifier. Each racer now reports its error variant,
Unauthorizedcounts as evaluated,RateLimitedcounts as refused, and anOkstill fails the test. A stale-read regression leaves 20 evaluated failures against a counter of 1 and fails the equality, so the original defect stays pinned. The lockout only arms at 3, so the burst always reaches the threshold and the trailing 21st-attempt probe stays deterministic.Verified by reproduction: under
nprocbusy loops the old assertion failed 9 of 10 runs with counts of 16 to 18, matching CI; the new one passed 10 of 10 under the same load and 15 of 15 idle.#PMS-753