Skip to content

test(e2e): repair completion, SAIL, and spend-log fixtures - #43902

Merged
yuneng-berri merged 1 commit into
mainfrom
litellm_e2e_fixture_contracts_20260930
Sep 30, 2026
Merged

yuneng-berri merged 1 commit into
mainfrom
litellm_e2e_fixture_contracts_20260930

Conversation

@yuneng-berri

@yuneng-berri yuneng-berri commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Retired completion model prevents the legacy endpoint test running
  • SAIL rejection fixture conflicts with global parameter dropping
  • Spend-log decoder rejects supported guardrail modes before attribution checks

How it solves it:

  • Keep prompt-style completion coverage using a supported model
  • Assert dropped tiers bill correctly; retain strict rejection controls
  • Decode supported modes while preserving attribution and privacy assertions

Causes and scope

These are three test/harness repairs from E2E build 336, which tested b370996b9d2fc9aaec356013a698711ee3e127cc. Product code is unchanged. Fresh main was checked at 264b09ac8d5753f157ad65b529adf6f52ce869b7; relevant open PRs and subsequent main changes were checked for overlap

Completion: the original fixture receives an explicit retired-model 404 for gpt-3.5-turbo-instruct. Main also marks babbage-002 and davinci-002 retired on September 28, so substituting either would keep a dead fixture. gpt-5.4-nano is supported through the existing chat-to-text bridge. The test still calls /v1/completions with prompt, uses the real OpenAI SDK, and requires choices containing nonempty text. Explicit reasoning_effort: none keeps its small output budget available for visible text. This exercises the gateway's legacy endpoint compatibility, not a retired native OpenAI upstream

SAIL: the original PR #42840 says: “Under drop_params the value is dropped and the call runs and bills at asap”. Its preceding bullet covers unknown strings and non-string values. The pinned external harness enables global dropping. SAIL combines global and request settings, so request-level false cannot make that stack strict. The repaired live case explicitly enables dropping for bogus and 5, computes the distinct base-tier price from returned usage, and checks both the cost header and persisted spend. Existing strict 400/no-upstream tests remain and gain bogus; drop tests now cover both global and request settings, parameter removal, and billing

The coverage registry gains a drop-mode entry and retains the strict-mode requirement as a visible gap. It does not claim strict proxy E2E coverage from unit tests

Decoder: the E2E schema only accepted strings, while the production contract accepts strings, lists, and structured modes. The observed ['post_call'] aborted page decoding before health-key attribution. The repair models those shapes and tests paginated and unpaginated payloads with neighboring health rows and masked responses. Malformed numeric values still produce validation failures. Attribution and Presidio privacy assertions are unchanged; this does not establish the cause of the separate Presidio failures

Validation

Check Result
make check Passed; E2E basedpyright reports zero errors; raw-client ban, test-tree lint and test-quality budget passed
Decoder, proxy-client neighbors, SAIL chat tests, retries disabled 384 passed
Coverage registry tests 13 passed; both strict and drop entries load
SAIL chat suite on failed product SHA b370996 66 passed with repaired test parameters
Original/repaired decoder on b370996 and base 264b09a Original list payload fails; repaired payload reaches the unchanged attribution assertion
Wrong health-key attribution Existing assertion fails, restored control passes
SAIL strict-rejection mutation All 6 invalid-tier cases fail; restoration passes
SAIL forwarded-tier mutation All 6 drop cases fail on upstream parameter presence; restoration passes
SAIL incorrect billed cost All 6 drop cases fail on cost equality; restoration passes
Real completion E2E Original fixture gets retired-model 404; repaired fixture passes
Live empty-completion mutation Repaired test fails on empty text; restoration passes

Mutation edits and qualification scripts remain local and are absent from this diff

Screenshots / Proof of Fix

Real OpenAI calls through an isolated local proxy. Register each deployment with POST http://127.0.0.1:54682/model/new, api_key: os.environ/OPENAI_API_KEY, and the backend named below. Temporary deployments were deleted afterward

Before (264b09a)

  1. Register completion-before with text-completion-openai/gpt-3.5-turbo-instruct, then run curl -sS http://127.0.0.1:54682/v1/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H "Content-Type: application/json" -d '{"model":"completion-before","prompt":"Finish this sentence in a few words: the capital of France is","max_tokens":32,"cache":{"no-cache":true}}'
  2. HTTP 404, model_not_found: “The model gpt-3.5-turbo-instruct has been deprecated”

After (18f4a93)

  1. Register completion-after with openai/gpt-5.4-nano, then run the same curl request using completion-after and adding "reasoning_effort":"none"
  2. HTTP 200, object: text_completion, choices[0].text: "Paris.", prompt tokens 19, completion tokens 5

Current-head CI

At 18f4a9311608f4900ab7dd7cd15576b3547d085b, OSV scanning fails on vulnerabilities in unchanged lockfiles (pyjwt 2.14.0, urllib3 2.7.0, Next 16.3.3). Dependency updates are outside this PR. GitHub changed-E2E and OAuth await environment approval. Buildkite E2E #1215 started automatically with this product SHA and harness ce5cc5b08c5f92e864f32845a23afa89a944ba54; its image builds are still running. Other CI and review remain pending, so this draft is not qualified for merge

Pre-Submission checklist

  • Meaningful tests and negative controls added or retained
  • Focused local checks passed
  • Required current-head CI completed
  • Scope limited to the three requested fixture contracts
  • Current-head Greptile review completed

Type

Test

Caveats

Medium

  • Live SAIL billing/readback remains blocked locally: no SAIL_API_KEY
  • Strict proxy E2E needs a separately configured strict stack
  • Full deployed attribution and Presidio scenarios were not rerun
  • Existing SAIL flex/default-tier and Together issues remain outside scope

QA runbook

  1. On a credentialed permissive stack, run the repaired SAIL invalid-tier cases with retries disabled
  2. Confirm base-tier header costs and persisted spend for both values
  3. Run the unchanged health attribution and Presidio privacy scenarios
  4. Keep this PR draft until current-head CI and review qualify it

@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@yuneng-berri
yuneng-berri marked this pull request as ready for review September 30, 2026 19:43
@yuneng-berri
yuneng-berri requested a review from a team September 30, 2026 19:43
@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Low risk] Test fixtures and test data for e2e and unit tests.

The reviewed changes appear safe to merge from a code-review standpoint, subject to the current-head CI qualification noted in the PR.

Summary

The PR repairs three E2E fixtures without changing product code:

  • Replaces a retired completion model while retaining a prompt-style /v1/completions assertion.
  • Tests permissive SAIL tier dropping and base-tier billing, while recording strict proxy rejection as a coverage gap.
  • Expands spend-log decoding tests to cover supported guardrail-mode shapes.

Reviews (1) · Last reviewed commit: "test(e2e): align completion, SAIL, and s..."

@yuneng-berri
yuneng-berri merged commit e61733b into main Sep 30, 2026
92 of 97 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_e2e_fixture_contracts_20260930 branch September 30, 2026 21:21
yuneng-berri added a commit that referenced this pull request Oct 3, 2026
)

* test(e2e): align completion, SAIL, and spend-log fixtures with supported contracts (#43902)

Partial backport to rc/1.104.0: only the text completion endpoint test moves off the deprecated gpt-3.5-turbo-instruct to openai/gpt-5.4-nano. The SAIL, spend-log and coverage registry repairs target tests or behavior this line does not need for the e2e suite

(cherry picked from commit e61733b)

* test(ci): repair stale tests and flaky CI infrastructure (#43983)

Partial backport to rc/1.104.0: only the Together AI structured-output e2e case moves to the hybrid reasoning backend with reasoning off, since the reasoning-only model it picked returned no content. The CI infrastructure and other test repairs are not needed for this line's e2e suite

(cherry picked from commit 6ca90b9)
haowang1013 pushed a commit to directivegames/litellm that referenced this pull request Oct 12, 2026
…ted contracts (BerriAI#43902)

Partial backport to stable/1.103.x: only the text completion endpoint test moves off the retired gpt-3.5-turbo-instruct to openai/gpt-5.4-nano with reasoning off. This line predates the OpenAI SDK rewrite of the test, so reasoning_effort goes through EndpointsClient.text_completions instead of extra_body. The SAIL, spend-log and coverage registry repairs are not needed for this line's e2e suite

(cherry picked from commit e61733b)

This branch had an error being deployed

1 failed deployment
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