Skip to content

fix(quota): keep the Mistral budget helper off the core load path - #8498

Merged
lidge-jun merged 2 commits into
devfrom
codex/fix-quota-core-boundary
Nov 10, 2026
Merged

lidge-jun merged 2 commits into
devfrom
codex/fix-quota-core-boundary

Conversation

@lidge-jun

Copy link
Copy Markdown
Owner

Summary

dev fails tests/usage/quota-reset-core-boundary.test.ts (4 cases) since #8295 landed. #8295 added a static import { mistralUnknownBudgetWindows } from "../quota/window-mapping" to src/providers/quota.ts, which src/router.ts, src/server/responses/core.ts and src/server/management-api.ts reach 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's test 5/5 shard is red for the same reason.

  • mistralUnknownBudgetWindows is a pure function with one caller. It moves unchanged to src/providers/quota-mistral-budget.ts, beside its caller, with a structural parameter type in place of the private ProviderLikeQuota.
  • src/providers/quota.ts imports it from there. Its only src/quota edges are again the lazy import() calls the guard requires.
  • structure/dashboard-and-usage.md records where the helper lives and why.

No behavior change: same regex, same filtering, same output.

Verification

  • Fail-first: on origin/dev 6364d9898, bun test tests/usage/quota-reset-core-boundary.test.ts gives 10 pass / 4 fail; with this change, 14 pass / 0 fail.
  • Mistral budget and reset tests (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.
  • NOT RUN: bun run test:changed, full bun run test, macOS/Windows.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Maintainer judgment

  • Value: restores the core/quota load boundary and turns the test 5/5 shard green for every open pull request.
  • UX change scope: none.
  • Regression evidence for existing users: the function body is unchanged; the Mistral budget tests pass.
  • Windows impact: none.
  • Verification scope / NOT RUN: see above.

#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.
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 10, 2026 18:54
@github-actions github-actions Bot added the intake: hygiene-blocked Deterministic PR hygiene checks failed label Nov 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Deterministic hygiene checks failed.

  • missing_regression_test — Behavior changed under src/ or gui/src/ without a test change. Add focused coverage or obtain test-exception-approved.

@github-actions github-actions Bot added the bug Something isn't working label Nov 10, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T18:55:54.292513Z 80572f5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ READY

  • this PR is ready for review.

Hygiene

✅ Deterministic PR hygiene checks passed.

@github-actions
github-actions Bot marked this pull request as draft November 10, 2026 18:54
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@github-actions github-actions Bot removed the intake: hygiene-blocked Deterministic PR hygiene checks failed label Nov 10, 2026
@github-actions
github-actions Bot marked this pull request as ready for review November 10, 2026 18:56
@lidge-jun
lidge-jun merged commit 3dcdc49 into dev Nov 10, 2026
24 of 25 checks passed
@lidge-jun
lidge-jun deleted the codex/fix-quota-core-boundary branch November 10, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant