Repository navigation
fix(quota): keep the Mistral budget helper off the core load path - #8498
Merged
Merged
Conversation
#8295 imported mistralUnknownBudgetWindows statically from src/quota/window-mapping.ts into src/providers/quota.ts, which the core request path loads, breaking tests/usage/quota-reset-core-boundary.test.ts. Move the pure helper beside its caller.
Contributor
|
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
✅ READY
Hygiene✅ Deterministic PR hygiene checks passed. |
Contributor
Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
Summary
devfailstests/usage/quota-reset-core-boundary.test.ts(4 cases) since #8295 landed. #8295 added a staticimport { mistralUnknownBudgetWindows } from "../quota/window-mapping"tosrc/providers/quota.ts, whichsrc/router.ts,src/server/responses/core.tsandsrc/server/management-api.tsreach at load time. That puts the optional quota-reset subsystem on the core request path, the exact chain the guard exists to stop (src/router.ts -> src/routing/evaluator.ts -> src/routing/quota.ts -> src/providers/quota.ts -> src/quota/window-mapping.ts). Every pull request'stest 5/5shard is red for the same reason.mistralUnknownBudgetWindowsis a pure function with one caller. It moves unchanged tosrc/providers/quota-mistral-budget.ts, beside its caller, with a structural parameter type in place of the privateProviderLikeQuota.src/providers/quota.tsimports it from there. Its onlysrc/quotaedges are again the lazyimport()calls the guard requires.structure/dashboard-and-usage.mdrecords where the helper lives and why.No behavior change: same regex, same filtering, same output.
Verification
origin/dev6364d9898,bun test tests/usage/quota-reset-core-boundary.test.tsgives 10 pass / 4 fail; with this change, 14 pass / 0 fail.tests/usage/mistral-budget-reset-identity.test.ts,tests/providers/mistral-budget-quota.test.ts,tests/cli/cli-account-key-quota.test.ts) plus the boundary test: 89 pass, 0 fail.bun run typecheck,bun run structure:check,bun run privacy:scan; layout, file-size ratchet, Lab boundary and structure guards: 87 pass, 0 fail.bun run test:changed, fullbun run test, macOS/Windows.Checklist
Maintainer judgment
test 5/5shard green for every open pull request.