fix(ui): use sanitizeNumeric for team_member_budget in team edit form - #23505
Conversation
The team edit form (TeamInfo.tsx) used Number() to convert the team_member_budget field value, which silently converts null/undefined/"" to 0. When an admin edits a team for any reason without touching the budget field, this sends team_member_budget=0 to the backend, creating a shared budget row with max_budget=0.0 that blocks all team members. Use sanitizeNumeric (already used for tpm_limit, rpm_limit, soft_budget in the same form) which correctly returns null for empty/null/undefined values, preventing accidental zero-budget creation.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR fixes a UI bug in Key changes:
Note: The added tests exercise existing backend logic rather than the new UI path — an end-to-end or snapshot test covering the form submission would strengthen coverage, but is not strictly required given the simplicity of the one-line change. Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/src/components/team/TeamInfo.tsx | Single-line fix replacing Number(values.team_member_budget) with sanitizeNumeric(values.team_member_budget), consistent with how tpm_limit, rpm_limit, and soft_budget are already handled in the same function. Prevents accidental zero-budget creation. |
| tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py | Adds 3 pure unit tests for TeamMemberBudgetHandler.should_create_budget() covering None-all-params → False, explicit-zero → True, and any-valid-value → True. No real network calls; tests import the class directly. |
Sequence Diagram
sequenceDiagram
participant Admin as Admin (UI)
participant Form as TeamInfo Form
participant Handler as onFinish handler
participant API as /team/update API
participant DB as Database
Admin->>Form: Edit team (leave budget field blank)
Form->>Handler: values.team_member_budget = null / ""
Note over Handler: BEFORE fix
Handler->>Handler: Number(null) → 0
Handler->>API: team_member_budget = 0
API->>DB: CREATE BudgetRow(max_budget=0.0) ❌
Note over Handler: AFTER fix
Handler->>Handler: sanitizeNumeric(null) → null
Handler->>API: team_member_budget = null
API->>API: should_create_budget(None) → False
API->>DB: No budget row created ✅
Last reviewed commit: 897b863
239edc4
into
BerriAI:litellm_oss_staging_03_13_2026
The team edit form (TeamInfo.tsx) used Number() to convert the team_member_budget field value, which silently converts null/undefined/"" to 0. When an admin edits a team for any reason without touching the budget field, this sends team_member_budget=0 to the backend, creating a shared budget row with max_budget=0.0 that blocks all team members.
Use sanitizeNumeric (already used for tpm_limit, rpm_limit, soft_budget in the same form) which correctly returns null for empty/null/undefined values, preventing accidental zero-budget creation.
Relevant issues
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/test_litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewCI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Type
🐛 Bug Fix
Changes
ui/litellm-dashboard/src/components/team/TeamInfo.tsx: ChangedNumber(values.team_member_budget)tosanitizeNumeric(values.team_member_budget)in the team edit form handler.sanitizeNumericis already defined and used fortpm_limit,rpm_limit, andsoft_budgetin the same function — it was just missing forteam_member_budget.tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py: Added 3 tests forTeamMemberBudgetHandler.should_create_budget():test_should_create_budget_with_none_values— returns False when all params are Nonetest_should_create_budget_with_zero_budget— returns True for explicit 0 (valid use case via API)test_should_create_budget_with_valid_values— returns True when any param is provided