From 52cf58288320823a54eb0a738c8c30695dbdda7f Mon Sep 17 00:00:00 2001 From: leilei3167 Date: Wed, 16 Sep 2026 15:41:31 +0000 Subject: [PATCH] fix(proxy): annotate list() warnings boundary for LIT002 mutable-ok at API boundary so list payloads stay test-compatible. --- .../management_endpoints/key_management_endpoints.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py index db3bb10e9ee..e29c6cab3ad 100644 --- a/litellm/proxy/management_endpoints/key_management_endpoints.py +++ b/litellm/proxy/management_endpoints/key_management_endpoints.py @@ -1569,7 +1569,7 @@ def _maybe_add_key_team_limit_warnings( warnings = _collect_key_team_limit_warnings(data=data, team_table=team_table) if not warnings: return payload - return MappingProxyType({**payload, "warnings": list(warnings)}) + return MappingProxyType({**payload, "warnings": list(warnings)}) # mutable-ok: GenerateKeyResponse/tests expect list warnings async def _check_team_key_limits( @@ -2005,7 +2005,7 @@ async def generate_key_fn( team_table=team_table, ) if team_limit_warnings: - response.warnings = list(team_limit_warnings) + response.warnings = list(team_limit_warnings) # mutable-ok: GenerateKeyResponse/tests expect list warnings return response except Exception as e: @@ -2177,7 +2177,7 @@ async def generate_service_account_key_fn( team_table=team_table, ) if team_limit_warnings: - response.warnings = list(team_limit_warnings) + response.warnings = list(team_limit_warnings) # mutable-ok: GenerateKeyResponse/tests expect list warnings return response @@ -3274,7 +3274,7 @@ async def update_key_fn( updated_key_info: Final[Mapping[str, object]] = MappingProxyType({"key": key, **response["data"]}) if team_limit_warnings: - return MappingProxyType({**updated_key_info, "warnings": list(team_limit_warnings)}) + return MappingProxyType({**updated_key_info, "warnings": list(team_limit_warnings)}) # mutable-ok: key/update response tests expect list warnings return updated_key_info # update based on remaining passed in values except Exception as e: