The refusal reports the wait left in a ten-minute window that starts at the
burst's first attempt, so its retry_after is ceil(600 - elapsed). The two
notice tests pinned that to [599, 600], which leaves under two seconds for a
burst of six (account) or eleven (address) round trips that each hash a
password: alone the burst fits, with the rest of the suite loading the machine
it does not. The whole suite then failed on retry_after 598 and 596 while the
product itself was correct.
Measure the burst inside the test and derive the lower bound from it, keeping
the upper bound at 600. A window that is actually wrong still fails: forcing
BOTSOCIAL_AUTH_RATE_LIMIT_WINDOW_SECONDS=300 yields retry_after 300 and both
tests stay red.
Changing an imported file also has to be recorded in the upstream migration
manifest: the verifier pins the census by sha256, so the test leaves
docs/upstream/bot-social-files.json and gains a modified_files entry with its
original and new digest.
Related #3468
The two rate-limit notice tests pinned the refusal's
retry_afterto[599, 600]. That number isceil(600 - elapsed), whereelapsedruns from the burst's first attempt (src/auth-limit.ts:87, ten-minute window at:23), so the bound left under two seconds for a burst of six round trips (account test) or eleven (address test), each of them hashing a password. Run alone the burst fits; run with the rest of the suite loading the machine it does not, and the tests failed withretry_after 598and596while the product was correct.What changes
services/bot-social/test/console_rate_limit_notice.test.ts(+11/-3, no product code):assertWaitLeft(retryAfter, elapsedMs)helper derives the lower bound from the burst's own duration (600 - ceil(elapsed/1000) - 1) and keeps the upper bound at 600;Date.now()immediately before its first login attempt and passes the difference in;>= 599 && <= 600assertions and the "a slow runner may already be a second into it" comment are gone; the rendered-sentence assertions are untouched.The bound still fails on a wrong value: the wait is pinned from above at exactly 600 s, and from below at one second's slack under the burst's own duration.
Provenance
That test file is imported from Bot Social and pinned by sha256 in
docs/upstream/bot-social-files.json, so editing it also edits the census: the entry leavesbot-social-files.json(437 -> 436 entries,components['bot-social'].file_countfollows) and amodified_filesentry appears indocs/upstream/migration-manifest.jsonwith the original sha256 and git blob, the new sha256, the byte count and a reason. Those two files are the only other changes in the diff.Locally
python3 scripts/verify-upstream-migration.pyreportsok (flybot 46 files, bot-social 436 files)andpython3 -m unittest tests.test_upstream_migrationpasses 7/7. Without this record both theprovenancejob andManagement APIfail on the manifest hash check, which is what the previous head showed.Evidence (local readings, not CI)
Taken at the test-file-only head; the test bytes are byte-identical at the current head, the added commit only carries the manifest records.
node --import tsx --test test/console_rate_limit_notice.test.tson the patched tree: 3/3 pass, twice.--test-concurrency=1each, appended only because this host saturates on the default): 18/18 pass, 0 fail.retry_after 597, elapsed 3367 ms, lowest 595(account) andretry_after 599, elapsed 1307 ms, lowest 597(address).BOTSOCIAL_AUTH_RATE_LIMIT_WINDOW_SECONDS=300givesretry_after 300and both tests fail on the new bound (error: 'retry_after 300 after 494 ms'/'retry_after 300 after 634 ms'), while the third test stays green.git applyon the base blob produces exactlyc955c76b, byte-identical to the tree that was tested.Out of scope
src/auth-limit.tsis unchanged: it reports the true remaining wait. Shortening the window through the env override instead was rejected, because the same two tests assert the rendered sentence "Try again in about 10 minutes.".Related #3468