fix(api-keys): backfill new limit usage#748
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a57cfba708
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ef82e9dcd6
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Merge-gate hold: code/tests look good, but this appears to resolve #518 while the PR body only says Given the repo merge gate for issue-resolving PRs, please add |
|
Merge-gate blocker: the implementation/tests look good, but the OpenSpec delta leaves the API-key SSOT contradictory after archive/sync. Evidence:
So the code would satisfy #518, but the spec archive would leave two normative requirements saying opposite things for the same PATCH behavior. Please update the OpenSpec change to also modify the existing “Limit update with usage state preservation” requirement so the “New rule” case reflects backfill behavior, with |
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Addressed in b826e9e.
This keeps the archive result consistent: new unmatched limits backfill current-window successful request-log usage unless |
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Revives #522 on a maintainer-owned branch because the original PR head has
maintainerCanModify=false.Credit: original implementation by @mgwals in #522; this branch rebases and updates that work on current
main.resetUsagebehavior and updates the backfill to sum per-request truncated microdollars so historical cost counters match stored request accounting.Validation
uv run pytest tests/integration/test_api_keys_trends_api.py -qpassed: 13 passeduv run pytest tests/unit/test_api_keys_service.py -qpassed: 47 passeduv run pytest tests/unit/test_api_keys_repository.py -qpassed: 6 passeduv run ruff check app/modules/api_keys tests/integration/test_api_keys_trends_api.py tests/unit/test_api_keys_service.pypassedgit diff --check origin/main...HEADpassedOpenSpec
backfill-api-key-limit-current-usageremains included and updated.Revives #522
Fixes #518