From 3bd212a3fa6c8533b23ea0ea5e55c5e9bba9ed03 Mon Sep 17 00:00:00 2001 From: jesus Date: Tue, 8 Sep 2026 22:54:46 +0000 Subject: [PATCH] fix(proxy): freeze merged user-filter where, format create key test Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../management_endpoints/internal_user_endpoints.py | 12 +++++++----- .../organisms/create_key_button.integration.test.tsx | 7 +++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/litellm/proxy/management_endpoints/internal_user_endpoints.py b/litellm/proxy/management_endpoints/internal_user_endpoints.py index 7c7636a7981..7d63f611876 100644 --- a/litellm/proxy/management_endpoints/internal_user_endpoints.py +++ b/litellm/proxy/management_endpoints/internal_user_endpoints.py @@ -2694,11 +2694,13 @@ async def ui_view_users( if org_filter_ids is not None: where_conditions["organization_memberships"] = {"some": {"organization_id": {"in": org_filter_ids}}} - where: Final[Mapping[str, object]] = { - key: value - for key, value in (*where_conditions.items(), *_user_search_where(search).items()) - if value is not None - } + where: Final[Mapping[str, object]] = MappingProxyType( + { + key: value + for key, value in (*where_conditions.items(), *_user_search_where(search).items()) + if value is not None + } + ) # Query users with pagination and filters users: Final = await _user_table(prisma_client).find_many( diff --git a/ui/litellm-dashboard/src/components/organisms/create_key_button.integration.test.tsx b/ui/litellm-dashboard/src/components/organisms/create_key_button.integration.test.tsx index daf80ffefde..c1de7f049e1 100644 --- a/ui/litellm-dashboard/src/components/organisms/create_key_button.integration.test.tsx +++ b/ui/litellm-dashboard/src/components/organisms/create_key_button.integration.test.tsx @@ -189,7 +189,8 @@ const openModal = async (props: Partial> return view; }; -const userSearchInput = (): Promise => screen.findByPlaceholderText("Type email or user ID to search for users"); +const userSearchInput = (): Promise => + screen.findByPlaceholderText("Type email or user ID to search for users"); const openSection = async (name: RegExp) => { await userEvent.click(await screen.findByRole("button", { name })); @@ -1022,9 +1023,7 @@ describe("CreateKey", () => { ]; vi.mocked(userFilterUICall).mockImplementation( (_accessToken, params) => - Promise.resolve( - directory.filter((entry) => entry.user_email.includes(params.get("search") ?? "")), - ) as never, + Promise.resolve(directory.filter((entry) => entry.user_email.includes(params.get("search") ?? ""))) as never, ); const user = userEvent.setup({ advanceTimers: vi.advanceTimersByTime });