Skip to content

test(integration): exact four-part translation cases on a shared fake provider and shared YAML deployment - #44451

Merged
litellm-stampbot merged 8 commits into
mainfrom
litellm_translation_integ_example
Oct 4, 2026
Merged

litellm-stampbot merged 8 commits into
mainfrom
litellm_translation_integ_example

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Translation regressions slip through because tests check only a few fields
  • Each wire test builds its own deployment and fake server

How it solves it:

  • TranslationTestCase holds client request, provider request, provider reply, client response
  • The runner compares the provider request body, client response body and non-transport provider headers in full
  • Shared deployments for anthropic/claude-opus-5-5 and anthropic/claude-sonnet-4-6 in tests/integration/proxy_config.yaml, pointing at 127.0.0.1:8191
  • One shared fake provider fixture on :8191, checked between tests for stray or unused calls
  • First cases: Anthropic /v1/messages basic on Opus 5.5 and Sonnet 4.6, and the LIT-4957 thinking budget on Sonnet 4.6

User 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

  1. They start a wire_server on a random port and register a deployment for it with POST /model/new under a random name
  2. They send the client request and assert two or three provider fields, such as thinking
  3. A field that LiteLLM adds, drops or renames elsewhere in the body goes unnoticed

After: the developer writes one literal and the whole round trip is pinned

  1. They add a case under tests/integration/translation/<endpoint>/<feature>/ with dataclasses.replace(BASE, ...) listing only the fields that change
  2. The client request names the shared deployment, for example "model": "anthropic/claude-sonnet-4-6"
  3. The runner sends it through the proxy and diffs the whole provider body and the whole client body against the literals
  4. Any added, removed, renamed or moved field fails the test with a full dict diff

Linear ticket

Covers LIT-4957 (the existing LIT-4957 wire test stays)

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review

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.yaml with Postgres and Redis, as the providers CircleCI job does

Before (fd14e51, with the LIT-4957 fix in litellm/llms/anthropic/common_utils.py reverted)

thinking budget on /v1/messages

  1. pytest tests/integration/translation tests/integration/messages_endpoint/providers/anthropic/test_anthropic_legacy_thinking_budget_wire.py against that proxy
  2. test_messages_basic_anthropic[anthropic/claude-sonnet-4-6-basic] passes and test_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

  1. Not present: each wire test starts its own fake server on a random port

After (502f51a)

thinking budget on /v1/messages

  1. Same command
  2. Both cases pass, as does the existing messages_endpoint/providers/anthropic/test_anthropic_legacy_thinking_budget_wire.py

shared provider between tests

  1. Shared-provider checks, each tried with a throwaway test: a queued reply nobody requested fails with 1 queued provider replies were never requested, an unread request fails with the test never read the provider requests ['/x'], and a request landing after a test ends fails the next test with the shared fake provider got ['/late'] after ...::test_c_late finished

Type

✅ Test

Caveats (if any)

Low

  • Captured Anthropic replies are verbatim, including the opaque thinking signature
  • Every group's proxy now loads the shared Anthropic deployments; existing tests filter models by their own names
  • The shared provider refuses pytest-xdist, so mcp and cost cannot use it
  • Moving the existing per-test /model/new deployments to the YAML is a follow-up PR

Note

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 literal TranslationTestCase records and a runner that diffs the entire provider body, non-transport provider headers, and LiteLLM response.

Shared fake provider: one in-process wire_server on :8191 with provider / shared_provider_server fixtures that queue replies with expect, drain with received, and fail on stray traffic, unread requests, or unused queued replies; it refuses pytest-xdist. proxy_config.yaml now declares shared Anthropic deployments (anthropic/claude-opus-5-5, anthropic/claude-sonnet-4-6) aimed at that URL. The providers group and manifest own the new directory.

Initial cases: Anthropic /v1/messages basic 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.

… provider and shared YAML deployment

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

devin-ai-integration Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@litellm-stampbot

Copy link
Copy Markdown
Contributor

@greptileai

@litellm-stampbot

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds integration test framework for provider request translation.

The PR appears safe to merge based on the reviewed changes and previous threads.

Findings

  1. P2 Inline fallback sentinel ▶

Summary

The PR adds exact request-and-response translation tests for Anthropic Messages using shared YAML deployments and a shared fake provider.

  • The changes since the previous review move translation-specific contributor guidance into the translation directory without changing its requirements.
  • No new actionable issue was identified.

Reviews (7) · Last reviewed commit: "docs(integration): move translation test..."

Comment thread tests/integration/translation/runner.py Outdated
Comment thread tests/integration/conftest.py
@codecov

codecov Bot commented Oct 3, 2026

Copy link
Copy Markdown

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>
@litellm-stampbot

Copy link
Copy Markdown
Contributor

@greptileai

@litellm-stampbot

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

…provider sides and drop regressions

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@litellm-stampbot

Copy link
Copy Markdown
Contributor

@greptileai

@litellm-stampbot

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

litellm-stampbot and others added 2 commits October 3, 2026 23:36
…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>
@litellm-stampbot

Copy link
Copy Markdown
Contributor

@greptileai

@litellm-stampbot

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous 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"}')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Inline fallback sentinel

_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!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@litellm-stampbot

Copy link
Copy Markdown
Contributor

@greptileai

@litellm-stampbot

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

…ent the naming rule

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@litellm-stampbot

Copy link
Copy Markdown
Contributor

@greptileai

@litellm-stampbot

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

…/translation

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@litellm-stampbot

Copy link
Copy Markdown
Contributor

@greptileai

@litellm-stampbot

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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.

@litellm-stampbot
litellm-stampbot enabled auto-merge (squash) October 4, 2026 00:03
@litellm-stampbot
litellm-stampbot merged commit f850b2c into main Oct 4, 2026
91 of 92 checks passed
@litellm-stampbot
litellm-stampbot deleted the litellm_translation_integ_example branch October 4, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants