Repository navigation
test(integration): exact four-part translation cases on a shared fake provider and shared YAML deployment - #44451
Conversation
… provider and shared YAML deployment Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
|
|
bugbot run |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…eck for late provider requests at session end Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
…provider sides and drop regressions Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
…ected_ and name the fake reply mock_provider_response Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… README Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
|
|
||
| PROVIDER_PORT: Final = 8191 | ||
| PROVIDER_URL: Final = f"http://127.0.0.1:{PROVIDER_PORT}" | ||
| _UNQUEUED: Final = Reply(status=500, body=b'{"error": "the shared fake provider has no reply queued for this request"}') |
There was a problem hiding this comment.
_UNQUEUED is defined in this module and returned when no provider reply is queued. The repository requires sentinel-like variables to be defined in constants.py instead. Please satisfy that requirement before merging.
Rule Used: What: Require sentinel-like variables (e.g., _NEGATIVE_TEAM_SENTINEL) to be defined in constants.py instead of inline or in other modules. Why: Centralizing shared constants prevents duplication, inconsistencies, and makes future changes safer ... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
This is a test-only fake reply, so litellm/constants.py would ship it in the package; tests/integration/_support keeps private constants local, like _NO_MARKER
There was a problem hiding this comment.
You're right. _UNQUEUED is private state for the integration-only fake provider, and moving it into litellm/constants.py would unnecessarily ship a test sentinel with the package. The existing _NO_MARKER pattern in tests/integration/_support supports keeping these test-only constants local, so this comment can be disregarded.
…t to claude-sonnet-4-6 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
…ent the naming rule Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
…/translation Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 502f51a. Configure here.
TLDR
Problem this solves:
How it solves it:
TranslationTestCaseholds client request, provider request, provider reply, client responseanthropic/claude-opus-5-5andanthropic/claude-sonnet-4-6intests/integration/proxy_config.yaml, pointing at127.0.0.1:8191/v1/messagesbasic on Opus 5.5 and Sonnet 4.6, and the LIT-4957 thinking budget on Sonnet 4.6User Flow
This PR adds tests only, so there is no end-user change. The flow below is a developer adding a translation case
Before: a developer covering a translation bug writes a new fake server, a new deployment and hand-picked field asserts
wire_serveron a random port and register a deployment for it with POST /model/new under a random namethinkingAfter: the developer writes one literal and the whole round trip is pinned
tests/integration/translation/<endpoint>/<feature>/withdataclasses.replace(BASE, ...)listing only the fields that change"model": "anthropic/claude-sonnet-4-6"Linear ticket
Covers LIT-4957 (the existing LIT-4957 wire test stays)
Pre-Submission checklist
Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Run against a local proxy started from
tests/integration/proxy_config.yamlwith Postgres and Redis, as theprovidersCircleCI job doesBefore (fd14e51, with the LIT-4957 fix in
litellm/llms/anthropic/common_utils.pyreverted)thinking budget on /v1/messages
pytest tests/integration/translation tests/integration/messages_endpoint/providers/anthropic/test_anthropic_legacy_thinking_budget_wire.pyagainst that proxytest_messages_basic_anthropic[anthropic/claude-sonnet-4-6-basic]passes andtest_messages_reasoning_anthropic[anthropic/claude-sonnet-4-6-thinking_budget]fails: the provider body has'thinking': {'type': 'adaptive'}and an extra'output_config': {'effort': 'low'}instead of{'type': 'enabled', 'budget_tokens': 1024}shared provider between tests
After (502f51a)
thinking budget on /v1/messages
messages_endpoint/providers/anthropic/test_anthropic_legacy_thinking_budget_wire.pyshared provider between tests
1 queued provider replies were never requested, an unread request fails withthe test never read the provider requests ['/x'], and a request landing after a test ends fails the next test withthe shared fake provider got ['/late'] after ...::test_c_late finishedType
✅ Test
Caveats (if any)
Low
mcpandcostcannot use it/model/newdeployments to the YAML is a follow-up PRNote
Low Risk
Test-only changes with no production code paths; shared YAML deployments are additive and the provider fixture is serial-only.
Overview
Adds a
translation/integration shard that pins full proxy round-trips via literalTranslationTestCaserecords and a runner that diffs the entire provider body, non-transport provider headers, and LiteLLM response.Shared fake provider: one in-process
wire_serveron:8191withprovider/shared_provider_serverfixtures that queue replies withexpect, drain withreceived, and fail on stray traffic, unread requests, or unused queued replies; it refuses pytest-xdist.proxy_config.yamlnow declares shared Anthropic deployments (anthropic/claude-opus-5-5,anthropic/claude-sonnet-4-6) aimed at that URL. Theprovidersgroup and manifest own the new directory.Initial cases: Anthropic
/v1/messagesbasic for both models plus a thinking budget variant on Sonnet 4.6 (LIT-4957). Docs (translation/README.md, integration README) describe case layout and capture rules.Reviewed by Cursor Bugbot for commit 502f51a. Bugbot is set up for automated code reviews on this repo. Configure here.