litellm/tests/test_litellm/router_utils
Cursor Agent 40db114a23
fix(router): accept Pydantic LiteLLM_Params in encryption-boundary key lookup
Greptile flagged that the strict isinstance(dict) guard in
_encryption_boundary_key would silently return None for any non-dict input,
including a LiteLLM_Params Pydantic instance, which exposes a custom .get()
method and is intended to be used dict-style in some router paths. If such
an instance ever flowed into healthy_deployments, the guard would drop every
candidate from boundary matching and fall through to the full deployment
pool, i.e. trigger the exact invalid_encrypted_content failure this check
exists to prevent.

Loosen the guard to accept any object exposing a callable .get(): plain
dicts (the common case) and LiteLLM_Params-style Pydantic instances. The
function still returns None for non-dict-like values (None, lists, strings,
ints, bare objects).

Adds regression tests covering:
  - LiteLLM_Params Pydantic instance resolves to the same boundary tuple as
    an equivalent plain dict
  - non-dict-like values and dicts missing required fields still return None
2026-05-12 03:09:08 +00:00
..
pre_call_checks fix(router): accept Pydantic LiteLLM_Params in encryption-boundary key lookup 2026-05-12 03:09:08 +00:00
test_cooldown_cache.py fix(cooldown_cache.py): mask error string to avoid leaking sensitive prompt data 2025-08-11 18:37:57 -07:00
test_health_check_allowed_fails_integration.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_health_state_cache.py feat(router): add health-check-driven routing behind opt-in flag 2026-03-27 20:57:08 +05:30
test_router_health_check_routing.py Litellm ishaan april4 2 (#25150) 2026-04-04 23:09:42 +00:00
test_router_interactions_endpoints.py style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
test_router_utils_common_utils.py Merge branch 'litellm_internal_staging' into litellm_access-group-routing-fix 2026-05-01 23:07:37 +00:00