From ba2bc7c9fe7bbf55600dd6a6f106e8ec7099aa54 Mon Sep 17 00:00:00 2001 From: Vivek1898 <72497717+Vivek1898@users.noreply.github.com> Date: Mon, 12 Oct 2026 18:10:16 +0530 Subject: [PATCH] fix(guardrails): put the cast-ok marker on the cast's own line The type-discipline gate then failed where the basedpyright one had passed: LIT006 wants `# cast-ok: ` on the cast call's first line, and my reason sat four lines above it, so LIT013 also fired -- a marker that suppresses nothing. Matches the existing cast in this file, which puts the marker as a trailing comment on `cast(`. Verified with the repo's own scripts/check_type_discipline.py against the gate's base SHA: LIT006 and LIT013 are back to the base count and LIT011 is one lower, so no rule grows. 39 tests pass; ruff clean. --- .../unified_guardrail/unified_guardrail.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/litellm/proxy/guardrails/guardrail_hooks/unified_guardrail/unified_guardrail.py b/litellm/proxy/guardrails/guardrail_hooks/unified_guardrail/unified_guardrail.py index fa6d190c3c9..03e86c346fc 100644 --- a/litellm/proxy/guardrails/guardrail_hooks/unified_guardrail/unified_guardrail.py +++ b/litellm/proxy/guardrails/guardrail_hooks/unified_guardrail/unified_guardrail.py @@ -245,11 +245,9 @@ def _ensure_litellm_metadata(data: dict, user_api_key_dict: UserAPIKeyAuth) -> N ) BaseTranslation.merge_user_api_key_metadata_into_request( - # cast-ok: `data` is the request payload, annotated here as a bare - # dict, so passing it on is an unknown argument type. _RequestData is - # this module's own alias for it and keeps the argument fully known - # without widening three signatures or naming Any again. - cast(_RequestData, data), + cast( # cast-ok: _RequestData is this module's own alias for the bare-dict request payload + _RequestData, data + ), user_api_key_dict, )