From ae60ef5a07c77822f3f15bc78f267733fe1f8254 Mon Sep 17 00:00:00 2001 From: ryan-crabbe-berri Date: Wed, 19 Aug 2026 18:36:22 -0700 Subject: [PATCH] test(ui): pin that throttling scopes to one row, never to the key Only a key's own max_budget throttles; its team, user, org and window budgets still hard-block on the same key. Pin that a throttled key row and a blocking team row coexist, with the highlight landing on the team row alone, so nothing can later promote the mode from a row to a property of the key. --- .../key_info_view.budgets_tab.test.tsx | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/ui/litellm-dashboard/src/components/templates/key_info_view.budgets_tab.test.tsx b/ui/litellm-dashboard/src/components/templates/key_info_view.budgets_tab.test.tsx index 9f910941d60..d9f846f6c58 100644 --- a/ui/litellm-dashboard/src/components/templates/key_info_view.budgets_tab.test.tsx +++ b/ui/litellm-dashboard/src/components/templates/key_info_view.budgets_tab.test.tsx @@ -564,6 +564,45 @@ describe("KeyInfoView Budgets tab", () => { expect(positions[0]).toBeLessThan(positions[2]); }); + it("throttles only the key's own budget, leaving every other scope on that key a real blocker", async () => { + const throttledKey: KeyBudgetEntry = { + ...UNCONFIGURED_BUDGET, + entity_id: "ci-runner", + entity_label: "ci-runner", + enforcement: "throttled", + max_budget: 100, + spend: 140, + remaining: -40, + source: "key.max_budget", + status: "exceeded", + notes: [{ code: "throttled_instead_of_blocked", severity: "info", text: noteText("throttled") }], + }; + const teamStillBlocks: KeyBudgetEntry = { + ...UNCONFIGURED_BUDGET, + scope: "team", + entity_type: "team", + entity_id: "team-123", + entity_label: "Platform", + max_budget: 500, + spend: 600, + remaining: -100, + source: "team.max_budget", + status: "exceeded", + }; + mockBudgets([throttledKey, teamStillBlocks]); + const panel = await renderAndOpenBudgetsTab(); + + // A throttling key is not a throttling key everywhere: the mode rides on one row, never the key. + const blocking = panel.getAllByTestId("key-budget-blocking"); + expect(blocking).toHaveLength(1); + expect(rowFor(panel, "Platform")).toContainElement(blocking[0]); + + const throttledRow = rowFor(panel, "ci-runner"); + expect(within(throttledRow).getByText("Throttles requests")).toBeInTheDocument(); + expect(within(throttledRow).queryByTestId("key-budget-blocking")).not.toBeInTheDocument(); + expect(within(rowFor(panel, "Platform")).getByText("Blocks requests")).toBeInTheDocument(); + }); + it("says a throttled budget slows requests rather than claiming it blocks them", async () => { const throttled: KeyBudgetEntry = { ...UNCONFIGURED_BUDGET,