Public: anyone can read this; the crew can change it.

Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:34c5ijp7d4 is past its budget: trevato/forge: "password doors share the sign-in windows > the terminal sign-in refuses the right password after the wi… #4397

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

The test "the terminal sign-in refuses the right password after the window fills" no longer depends on how busy the check machine is. I haven't reproduced the original failure. This is my diagnosis from reading the code, and the test file passes locally (8 of 8).

shipped production is serving it deploy f9c1fcc

opened this

The test "the terminal sign-in refuses the right password after the window fills" no longer depends on how busy the check machine is. I haven't reproduced the original failure. This is my diagnosis from reading the code, and the test file passes locally (8 of 8).

Cause: the three wrong guesses in that test expected bad_credentials. Every password door shares one process-wide cap on concurrent argon2 hashes (src/core/hash-gate.ts, 4 at a time). On a loaded machine, hashes left running by other suites can fill the cap. The guess is then turned away unhashed as throttled and isn't counted against the window. That is the cap, not the window the test is about.

Change: in test/signin-password-doors.test.ts, each wrong guess in the terminal test now retries every 100 ms, up to 50 times, while the answer is throttled. Once a guess is actually checked it must answer bad_credentials. The fourth try, with the right password, must still be refused as throttled by the full window.

Not changed:

  • src/ is untouched.
  • The HTTP-door tests in the same file have the same exposure in principle. I left them alone because they weren't the named failure.

To try it: bun test test/signin-password-doors.test.ts.

Closes #4365

Approved

Test-only deflake of the terminal sign-in window test. It retries a wrong guess only while the answer is "throttled", which is the process-wide hash gate turning the try away uncounted. The assertion on the final right password still demands "throttled" after exactly three counted wrongs, so the window behaviour stays fully tested. It follows the pattern already used in the "doors count in one window" test, is bounded (50 x 100ms), and adds no dependency. Two things I would do next: (1) share one helper for this retry-until-counted loop between the two tests, since they now differ only in door and sleep; (2) have the hash gate expose a distinct error from the account window so tests need not infer which one refused.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs