Repository navigation
test: injectable quota-call pacing; smaller profile rotation test - #387
Merged
Merged
Conversation
…ion test QuotaManager gains an optional pauseBetweenQuotaCalls(ms). Unset, it uses pauseOnRealTimer, the same unreferenced native setTimeout promise that was inline before, returned directly so awaiting it takes the same turns. OpenCode (runtime override quotaCallPause) and Pi (__setPiQuotaCallPauseForTest) pass it only from test fixtures; production passes undefined. OpenCode and Pi provider-error rate-limit tests now record the requested wait instead of sleeping ~1 s, and assert each requested gap is in (0, 1000]. A new Core test asserts the second GET requests exactly the remaining gap. "completed profile hydration does not refetch later token generations" runs 3 rotations instead of 66. Same assertion (one profile call). The 66 came from an older token-keyed attempt map; today attempts and completed checks are keyed by route ID and account identity, a fresh stored profile skips the account first, and nothing in that path counts or caps rotations. mutations.toml: two Core rows (default pause skips the wait; gap set to 0), both proved CAUGHT with ckdev-mutate prove.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
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.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.Written for commit 3385caf. Summary will update on new commits.