Skip to content

fix(rust): clear the two rust-test failures on main - #53776

Closed
yujonglee-berri wants to merge 1 commit into
mainfrom
litellm_budgets_seed_failure_stamps
Closed

yujonglee-berri wants to merge 1 commit into
mainfrom
litellm_budgets_seed_failure_stamps

Conversation

@yujonglee-berri

@yujonglee-berri yujonglee-berri commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Handwritten 1-3 sentence description

[insert handwritten description here]

Details

TLDR

Problem this solves:

  • The rust-test job fails on main and stops at the first failure
  • Since Nov 21 about 12,000 of 13,500 Rust tests have not run on main
  • Two tests fail on main, the second hidden behind the first
  • The job only runs with the rust-tests label, so neither was caught

How it solves it:

  • The budgets charge test expects the stamp the step actually writes
  • The bridge's user repository parses JSON through litellm-host-python
  • litellm-host-python gets a json_from_str helper next to json_dumps

The budgets test, a_customer_counter_that_cannot_be_seeded_fails_the_step_with_the_rest, came in with #52166 and fails at that commit too. It expected the reservation to stay unstamped. The step stamps it and then reports the seeding failure, which is what the Python step it ports does: increment_spend_counters_batched calls stamp_budget_reservation_actual_cost before it raises the first scope error. The other three assertions in the test already held

The second test, marshal_boundary::serialization_uses_the_interop_boundary, scans the bridge's sources for serde_json::from_str. #52756 added one in db_repository/user.rs

User Flow

Before: a maintainer who labels a Rust PR rust-tests sees rust-test fail on tests their PR never touched

  1. They add the rust-tests label to their pull request
  2. rust-test starts cargo nextest run --workspace --locked
  3. It fails after about 1,400 tests on the budgets charge test and skips the rest

After: the run gets past both tests

  1. They add the rust-tests label to their pull request
  2. rust-test starts cargo nextest run --workspace --locked
  3. The budgets charge test and the bridge's boundary scan both pass

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • 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
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings 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

E2E exception at 3669599. One change is a test expectation. The other moves a serde_json::from_str call behind a helper that makes the same call, so the error text and the parsed value are unchanged and no request can behave differently. The two tests that fail in CI are the proof. Run from litellm/rust, with Docker running for the Redis container the budgets test starts

cargo test -p litellm-callbacks-budgets --test charge --locked
cargo test -p litellm-python-bridge --test marshal_boundary --locked

Main (6a6c90a)

thread 'a_customer_counter_that_cannot_be_seeded_fails_the_step_with_the_rest' panicked at crates/callbacks-budgets/tests/charge.rs:864:5:
assertion `left == right` failed
  left: [Some(-3.0)]
 right: [None]

thread 'serialization_uses_the_interop_boundary' panicked at crates/python-bridge/tests/marshal_boundary.rs:44:13:
.../crates/python-bridge/src/db_repository/user.rs bypasses litellm-host-python with `serde_json::from_str`

This PR (3669599)

test result: ok. 24 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.88s

test serialization_uses_the_interop_boundary ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

The first failure is the one in main's scheduled run https://github.com/BerriAI/litellm/actions/runs/44984312162

To find what the first failure was hiding, I ran the whole workspace on main plus the budgets fix with cargo nextest run --workspace --locked --no-fail-fast on a Mac: 13,746 run, 13,734 passed, 12 failed. One is the boundary scan fixed here. The other 11 are local to my machine: 7 compare a Linux errno (111, mine is 61) and 4 Bedrock region tests pick up the default region in my ~/.aws/config

cargo fmt --all --check and cargo clippy -p litellm-host-python -p litellm-python-bridge -p litellm-callbacks-budgets --all-targets --locked -- -D warnings are clean

Type

🐛 Bug Fix

Caveats (if any)

Medium

  • The full suite has not passed on Linux yet
    • My full run was on a Mac, where 11 unrelated tests fail for local reasons
    • This PR carries the rust-tests label, so its own rust-test run is the Linux answer
  • The budgets fix changes the test, not the step
    • I read the Python step as the reference, and it stamps before raising
    • If the port meant to leave the reservation unstamped here, the step is what needs changing

Low

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

The budgets charge test expected a step whose customer counter cannot be seeded to leave the reservation unstamped. The step stamps it and then reports the failure, as the Python step it ports does, so the test has failed since it landed.

The bridge's boundary scan rejects serde_json::from_str outside litellm-host-python, and the user repository parsed its JSON arguments with it. It now goes through a json_from_str helper in that crate
@veria-ai

veria-ai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

No security issues were found in this pull request.

Reviews

@devin-ai-integration devin-ai-integration 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.

🔍 Devin Review: 2 flags

Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@yujonglee-berri yujonglee-berri added the autoapprove This PR may be autoapproved by greptile. The author thinks that it does not need human review. label Nov 24, 2026
@yujonglee-berri

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #53922, which landed the same four fixes plus the stub update on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autoapprove This PR may be autoapproved by greptile. The author thinks that it does not need human review. rust-tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant