From 71ec3ca6b39acb8642876f1451b53fdffa5d2a65 Mon Sep 17 00:00:00 2001 From: Deepanshu Date: Thu, 27 Aug 2026 19:11:00 -0400 Subject: [PATCH] fix(lint): suppress genuine LIT002 hits instead of padding the ceiling My earlier rebase conflict resolution for type-discipline-budget.json's LIT002 limit was too low, then overcorrected by padding it well above the actual measured count. Root-caused instead: _independent_snapshot and the PATCH-endpoint rollback path legitimately construct plain, mutable request-payload/config dicts (matching this file's existing precedent for the same shape), so suppress those four sites with `# mutable-ok:` rather than reshaping code that must stay a plain dict by contract. Set the limit to the exact current measured total; the small remaining gap vs upstream's own committed ceiling is pre-existing drift in litellm_internal_staging itself (its own tree already measures over its committed limit), not attributable to this PR. --- litellm/proxy/guardrails/guardrail_endpoints.py | 5 ++++- litellm/proxy/utils.py | 13 +++++++++---- type-discipline-budget.json | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/litellm/proxy/guardrails/guardrail_endpoints.py b/litellm/proxy/guardrails/guardrail_endpoints.py index 3d00d9a0025..2b04828f0f2 100644 --- a/litellm/proxy/guardrails/guardrail_endpoints.py +++ b/litellm/proxy/guardrails/guardrail_endpoints.py @@ -1231,7 +1231,10 @@ async def patch_guardrail( guardrail_id=guardrail_id, guardrail_name=existing_guardrail.get("guardrail_name") or "", litellm_params=LitellmParams(**existing_litellm_params), - guardrail_info=existing_guardrail.get("guardrail_info", {}), + guardrail_info=existing_guardrail.get( + "guardrail_info", + {}, # mutable-ok: Guardrail's own constructor takes a plain dict + ), ), prisma_client=prisma_client, ) diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 42e94df6a64..5093e3128e7 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -476,9 +476,9 @@ def _independent_snapshot( need to be genuinely independent, and those are plain, cleanly-copyable structures. """ - sanitized: Final = { + sanitized: Final = { # mutable-ok: same request-payload shape as data key: ( - { + { # mutable-ok: same request-payload shape as data inner_key: ("placeholder" if inner_key == "litellm_parent_otel_span" else inner_value) for inner_key, inner_value in value.items() } @@ -500,10 +500,15 @@ def _independent_snapshot( and isinstance(original_value, dict) and "litellm_parent_otel_span" in original_value ): - return {**copied_value, "litellm_parent_otel_span": original_value["litellm_parent_otel_span"]} + return { # mutable-ok: same request-payload shape as data + **copied_value, + "litellm_parent_otel_span": original_value["litellm_parent_otel_span"], + } return copied_value - return {key: _copied_value(key, value) for key, value in sanitized.items()} + return { # mutable-ok: same request-payload shape as data + key: _copied_value(key, value) for key, value in sanitized.items() + } def _prompt_block_text(block: object) -> str: diff --git a/type-discipline-budget.json b/type-discipline-budget.json index 2b62c6cf4ca..a7dec330a26 100644 --- a/type-discipline-budget.json +++ b/type-discipline-budget.json @@ -3,7 +3,7 @@ "limit": 22727 }, "LIT002": { - "limit": 26900 + "limit": 26873 }, "LIT003": { "limit": 269