fix(reset_budget_job): write minimal reset updates - #28453
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Greptile SummaryThis PR fixes a Prisma
Confidence Score: 4/5Safe to merge — the change is narrowly scoped to the budget reset write path, the root-cause fix is correct, and live k8s validation plus 63 passing tests back it up. The core fix is sound: extracting a minimal dict before the DB write prevents Prisma from receiving unexpected JSON/relation fields. One cosmetic issue exists in utils.py — data_json["token"] = token is assigned redundantly after jsonify_object already includes it from the dict comprehension — but this has no effect on runtime behaviour. No logic regressions were identified. litellm/proxy/utils.py — the redundant token reassignment on line 3885 is worth cleaning up, but it has no runtime impact.
|
| Filename | Overview |
|---|---|
| litellm/proxy/common_utils/reset_budget_job.py | Projects only token/team_id, spend, and budget_reset_at into minimal dicts before calling update_data, fixing the Prisma DataError caused by unexpected fields like object_permission_id and budget_limits. |
| litellm/proxy/utils.py | Adds dict-payload branch to update_many for key and team tables; contains a redundant data_json["token"] = token assignment after the token is already present from the dict comprehension passed to jsonify_object. |
| tests/test_litellm/proxy/common_utils/test_reset_budget_job.py | Adds token/team_id fields to test fixtures, updates assertions to reflect dict-payload shape, and adds four new direct unit tests for the update_data dict and object paths for both key and team tables. |
| tests/litellm_utils_tests/test_proxy_budget_reset.py | Test fixtures updated to include token/team_id fields; assertions changed from id-based checks to token/team_id with key-set assertions that verify no extra fields leak into the DB payload. |
Reviews (1): Last reviewed commit: "test(reset_budget_job): cover update_dat..." | Re-trigger Greptile
|
🤖 litellm-agent: This PR is currently BLOCKED from merge. Score: 3/5 ❌ Why blocked:
Details: Score docked for: 1 PR-related CI failure (Size gate: tests (+286) exceed code (+75) by more than 3× — over-specified or feature too thin. Add the Fix the issues above and push an update — the bot will re-review automatically.
|
|
All previously reported blockers are addressed on the latest commit: the size gate is within bounds (code +74, tests +222), Codecov patch coverage passes, and all GitHub checks are green. Requesting a fresh LiteLLM agent review. |
|
@krrish-berri any chance to have this merged? thanks. |
|
Fixed by #29358. |
Summary
Fixes #27730.
Testing