test: injectable quota-call pacing; smaller profile rotation test
Merged
AN
5h ago+219+219+012345678901234567890123456789-24-24-01234567890123456789
Lets tests replace the real wait between quota usage calls, and fixes a test that couldn't fit its time limit under load. Production timing is unchanged.
- Quota-call pacing:
QuotaManagerspaces physical usage GETs by about a second with a real, unref'd timer. A newpauseBetweenQuotaCallsoption replaces that wait; it's called only when the remaining gap is positive and defaults to the same timer as before, returned without an async wrapper so it takes the same turns. Production passes nothing. OpenCode test fixtures pass it through a runtime override and Pi tests through a test-only setter; 7 OpenCode and several Pi rate-limit tests now assert the requested gap instead of spending real time. The existing real-clock spacing test runs unchanged, and a new mutation row proves the default wait is still exercised. - Profile rotation test:
completed profile hydration does not refetch later token generationsran 66 dependent token generations, a count left from when attempts were keyed by access-token fingerprint. It now covers the boundary generations that prove the property, with the same assertions.
No global timers are mocked, no deadline changed.
Summary by cubic
Makes the wait between quota usage polls injectable so rate-limit tests record the requested pause instead of spending real time on it, and shrinks a profile rotation test that ran far more generations than needed. Production timing is unchanged.
QuotaManagergains apauseBetweenQuotaCallsoption that replaces the real unref'd timer only when set; production passes nothing and keeps the same one-second gap.- OpenCode and Pi tests pass a recording pause and assert each requested gap is between 0 and 1,000 ms.
- The profile rotation test now runs 3 token generations instead of 66; the higher count was left over from an older token-keyed attempt map, and the assertions are unchanged.