test(proxy): pin the request-body rules proxy/_types.py enforces - #37811
Merged
yuneng-berri merged 1 commit intoAug 22, 2026
Merged
Conversation
Contributor
Greptile SummaryThis test-only PR adds direct model-validation coverage for request-body rules enforced by
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| tests/test_litellm/proxy/test_proxy_types.py | Adds isolated regression tests that accurately reflect existing request-model validation and authentication-marker contracts. |
Reviews (2): Last reviewed commit: "test(proxy): pin the request-body rules ..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Aug 21, 2026
yuneng-berri
force-pushed
the
litellm_proxy_types_validator_tests
branch
from
August 21, 2026 10:58
4d6a868 to
89186e6
Compare
Eight validators in that module decide what a request body may say, and none of them was asserted anywhere. Reversing any one of the eight left the file green. Cover them at the API boundary: a JWT issuer must pick audience validation or opt out, a temp budget needs both halves, an empty max budget reads as no limit, an organization member can only take a role the organization has, an LLM-backed injection check needs the call it would make, and four server-only markers are never taken from the caller. The injection case builds each incomplete body as its own value rather than deleting a key out of the one it is iterating.
yuneng-berri
force-pushed
the
litellm_proxy_types_validator_tests
branch
from
August 21, 2026 10:58
89186e6 to
0f5580d
Compare
Contributor
Author
ryan-crabbe-berri
approved these changes
Aug 22, 2026
yucheng-berri
approved these changes
Aug 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Problem this solves:
proxy/_types.pyis 4,945 lines of accepted request bodiesHow it solves it:
User Flow
No end-user behavior changes. A management API caller sending a body one of
these rules refuses keeps getting the same refusal, and now a change to that
refusal has to be deliberate.
Relevant issues
Linear ticket
Pre-Submission checklist
Screenshots / Proof of Fix
Shared setup: each of the eight rules is rewritten to its opposite in
litellm/proxy/_types.py, one at a time, and the mapped test file is runagainst it. A rule is pinned when the run fails.
The eight rewrites: the JWT audience requirement, the audience-and-opt-out
conflict, the temp-budget pairing, the empty
max_budgetstring, theorganization role list, the
llm_api_namerequirement, thevia_virtual_keystrip, and
extra: forbidonJWTIssuerConfig.Before (ff02d5c)
uv run pytest tests/test_litellm/proxy/test_proxy_types.py -qAfter (0f5580d)
uv run pytest tests/test_litellm/proxy/test_proxy_types.py -qType
✅ Test
Caveats (if any)
JWTIssuerConfighad no test anywhere in the suite before thisFinal Attestation