From 070158bac1802e701f90d27e44493c139edaeb40 Mon Sep 17 00:00:00 2001 From: Bytechoreographer Date: Thu, 30 Apr 2026 11:13:42 +0800 Subject: [PATCH] fix(review): address Greptile P2 findings - test: add group_by_mock.assert_awaited_once() before await_args access so a non-call produces a clear AssertionError rather than AttributeError - ui: wrap tagListCall IIFE in try/catch; log error on failure instead of silently leaving the tag dropdown stale Co-Authored-By: Claude Sonnet 4 (1M context) --- .../test_tag_management_endpoints.py | 1 + .../UsagePage/components/UsagePageView.tsx | 22 ++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/test_litellm/proxy/management_endpoints/test_tag_management_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_tag_management_endpoints.py index 1bcfd0f97e0..ee2d72d2dd4 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_tag_management_endpoints.py +++ b/tests/test_litellm/proxy/management_endpoints/test_tag_management_endpoints.py @@ -445,6 +445,7 @@ async def test_list_tags_without_date_range_omits_date_filter(): response = client.get("/tag/list", headers=headers) assert response.status_code == 200 + group_by_mock.assert_awaited_once() where = group_by_mock.await_args.kwargs["where"] assert "date" not in where diff --git a/ui/litellm-dashboard/src/components/UsagePage/components/UsagePageView.tsx b/ui/litellm-dashboard/src/components/UsagePage/components/UsagePageView.tsx index 01906e1c867..04f0902c26d 100644 --- a/ui/litellm-dashboard/src/components/UsagePage/components/UsagePageView.tsx +++ b/ui/litellm-dashboard/src/components/UsagePage/components/UsagePageView.tsx @@ -162,14 +162,20 @@ const UsagePage: React.FC = ({ teams, organizations }) => { if (!accessToken) return; let cancelled = false; (async () => { - const tags = await tagListCall(accessToken, startTime, endTime); - if (cancelled) return; - setAllTags( - Object.values(tags).map((tag: Tag) => ({ - label: tag.name, - value: tag.name, - })), - ); + try { + const tags = await tagListCall(accessToken, startTime, endTime); + if (cancelled) return; + setAllTags( + Object.values(tags).map((tag: Tag) => ({ + label: tag.name, + value: tag.name, + })), + ); + } catch (e) { + if (!cancelled) { + console.error("Failed to fetch tag list", e); + } + } })(); return () => { cancelled = true;