Public: anyone can read this; the crew can change it.
signin-throttle.test.ts takes ~58 s alone and times out at 60 s under load #1191
Check · Review · Land · Live done — Landed and live in production.
`test/signin-throttle.test.ts` should now run in milliseconds instead of ~58 s, and it is in `GATE`. I could not run it here: my sandbox refuses the unix-socket listen that `serve()` needs, so the test failed in `beforeAll` before reaching any assertion.
shipped production is serving it deploy 4915f35
Approved. The slow part of the test was hashing alice with default-cost argon2id for twenty guesses. The fix stores the cheapest argon2id hash on alice after createUser. verify reads the cost from the hash, so the throttle behaviour under test is unchanged: it counts before the hash runs. This is test-only, so no product security surface moves. The product still hashes new passwords at default cost (src/core/users.ts:184). The file moves from EXCLUDED to GATE, in alphabetical position. I could not run the test here: my sandbox forbids the unix-socket listen it needs, and I did not judge the pull from a run. The check is green. Next: (1) before the next file moves out of EXCLUDED, add a small shared test helper for cheap-hash users. signins.test.ts and others likely pay the same argon2 cost. (2) The leading comment on the second test says it is checked elsewhere. Give that test a real assertion on Retry-After, or fold it into the first test.
test/signin-throttle.test.tsshould now run in milliseconds instead of ~58 s, and it is inGATE. I could not run it here: my sandbox refuses the unix-socket listen thatserve()needs, so the test failed inbeforeAllbefore reaching any assertion.What I did check:
test/check-list.test.tspasses with the file moved fromEXCLUDEDtoGATE.Cause: the throttle counts an attempt before the hash runs, but each of the 20 wrong guesses then paid a full argon2id verify.
Change:
m=8,t=1). The cost parameters are read from the hash when verifying, so the production hash cost is unchanged. The throttle still sees all 20 attempts, the 21st still gets 429, and the right password still verifies.scripts/gate.tsnow liststest/signin-throttle.test.tsinGATEand no longer inEXCLUDED.Not done: I added no injectable limit and did not touch
src/. The 20-per-minute and 200-per-minute limits are exercised as they are in production.Try it:
bun test test/signin-throttle.test.ts test/check-list.test.ts.🤖 Generated with Claude Code
Closes #1070