You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any provider can change any of this without notice. The failure appears per-user at runtime, never in CI.
Part 1 — visible failure (the part that matters)
A quota chip exists so someone notices they are near a limit. A chip that silently disappears when its fetcher breaks is worse than no chip, because the user has been trained to look there and now reads absence as "plenty left".
Needs verifying before fixing: does every fetcher failure render a labelled degraded state on the Limits page and the provider card — "Cursor limits: token expired" — or does the chip just vanish? LimitChips returns a status line on data.error and null on !data.configured, so the shape exists; what is untested is whether every fetcher's failure path actually sets error rather than returning an unconfigured-looking object.
To verify: force each fetcher to fail (bad token, mocked 500, missing binary, timeout) and observe both surfaces.
Part 2 — schema-snapshot fixtures
Commit one sanitized real response per provider and test each normalizer against it.
This does not detect upstream drift — nothing short of live credentials does, and that is not worth it (see below). It does stop our own refactors from silently breaking parsing, which is the failure we can actually prevent. The test header should say so plainly rather than implying more coverage than it has.
Note for whoever collects these: responses contain account identifiers and plan details. Sanitize before committing, and treat the fixtures as public.
Explicitly not proposed
A live quota canary in CI. It needs real credentials for ~9 providers in repository secrets, with the rotation burden and the disclosure surface that implies, for a solo maintainer, to detect drift that a user hitting the Limits page detects anyway — provided Part 1 is done. Part 1 is the higher-value half for that reason.
Definition of done
Every fetcher's failure path produces a user-visible labelled state on both the Limits page and the provider card
A test per provider asserting that a failing fetch surfaces an error rather than an absent chip
One sanitized response fixture per provider, with the normalizer tested against it
Test header states what the fixtures do and do not protect against
src/lib/usage-limits.js(~2,050 lines) is the most fragile code in the repo and the least verifiable.It talks to ~9 providers' undocumented private endpoints, including some genuinely heroic work:
extractGeminiOauthClientCredentials(:711) — pulls OAuth client credentials out of the installed Gemini binaryparseKiroUsageOutput(:1029) — screen-scrapes thekiroCLI's text outputdetectAntigravityProcess(:1538) — finds the app bylsof-ing listening portsfetchCopilotLimits— had zero tests until feat(limits): show Copilot premium-request counts, not just a percentage #98 added the firstAny provider can change any of this without notice. The failure appears per-user at runtime, never in CI.
Part 1 — visible failure (the part that matters)
A quota chip exists so someone notices they are near a limit. A chip that silently disappears when its fetcher breaks is worse than no chip, because the user has been trained to look there and now reads absence as "plenty left".
Needs verifying before fixing: does every fetcher failure render a labelled degraded state on the Limits page and the provider card — "Cursor limits: token expired" — or does the chip just vanish?
LimitChipsreturns a status line ondata.errorandnullon!data.configured, so the shape exists; what is untested is whether every fetcher's failure path actually setserrorrather than returning an unconfigured-looking object.To verify: force each fetcher to fail (bad token, mocked 500, missing binary, timeout) and observe both surfaces.
Part 2 — schema-snapshot fixtures
Commit one sanitized real response per provider and test each normalizer against it.
This does not detect upstream drift — nothing short of live credentials does, and that is not worth it (see below). It does stop our own refactors from silently breaking parsing, which is the failure we can actually prevent. The test header should say so plainly rather than implying more coverage than it has.
Note for whoever collects these: responses contain account identifiers and plan details. Sanitize before committing, and treat the fixtures as public.
Explicitly not proposed
A live quota canary in CI. It needs real credentials for ~9 providers in repository secrets, with the rotation burden and the disclosure surface that implies, for a solo maintainer, to detect drift that a user hitting the Limits page detects anyway — provided Part 1 is done. Part 1 is the higher-value half for that reason.
Definition of done