Repository navigation
test(decisions): audit #47508 - #48777
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@litereview code-review |
[Low impact] The PR appears safe to merge, with no new actionable issues found SummaryThis test-only PR adds coverage for malformed Decisions replies and returned-model pricing
mateo-berri accepted scripted proof for the malformed-reply case because real Perplexity cannot be made to send that reply. No new actionable issues were found. Tests were not run during this review Reviews (2) · Last reviewed commit: "test(decisions): price the Databricks de..." · Reviewed by Greptile |
|
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 a7ba8de. Configure here.
Post-merge audit of #47508, which bills a TypeSafe decisions reply at the requested model's price when the version it answered as has no prices in the cost map, and turns an upstream 200 reply that fails the response schema into a 500 naming the bad field. Every audited behavior holds at the merge commit, and the bugs it fixed still show up at its parent
This adds a timeout-text case to the malformed reply test and a priced returned-version cost case, and points the Databricks decisions cell at its cost-map row, since #48694 priced that model on main. No product code changes
Original
TLDR
Problem this solves:
How it solves it:
User Flow
This PR only adds tests. The flow below is the one #47508 changed
Before (06d56eb): a developer whose TypeSafe deployment answers as a newer version is not billed, and a malformed reply comes back with a guessed status
typesafe/jev-latestand onenoulquestionjev-1.13.0, a version with no prices in the cost mapx-litellm-response-costheader, so the request is not billedanswersfield is a 500 naming no field, and an answer reading "Request timed out" is a 408After (81d8c9a): the request is billed at
typesafe/jev-latest's price, and a malformed reply is a 500 that names the fieldtypesafe/jev-latestand onenoulquestionjev-1.13.0, a version with no prices in the cost mapx-litellm-response-costistypesafe/jev-latest's input price times the input tokens, and the spend log row matchesanswersis a 500 naminganswers, the timeout-like answer is a 500 naminganswers.defectRelevant issues
Follow-up audit of #47508
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
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 moreDelays 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
Audit verdict PASS. Base is #47508's parent
06d56eb6d7, head is its merge commit81d8c9af38, and tip is this branch'sa7ba8de4e0, which carries main up to1176e608b1. Each leg had its own proxy, database, Redis and scripted upstream, with CircleCI's settings, and the head ran twice with the same seedsanswersis a 500 naming itEvery case runs
uv run --no-sync python tests/integration/run.py <group> <node ids>against the leg's proxyBefore (06d56eb)
An unpriced returned version is billed at the requested model
run.py cost 'tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[typesafe/jev-latest-decisions]' '...[typesafe/jev-latest-systemone]'x-litellm-response-cost None != expected 1.197e-05A returned version with its own prices
Steps
run.py cost '...::test_case_bills_expected_cost[typesafe/jev-preview-answered-as-priced-version-systemone]'typesafe/jev-latest's priceA reply with no answers field
Steps
run.py providers 'tests/integration/providers/test_decisions_wire.py::test_a_malformed_upstream_success_is_a_server_error_naming_the_field[missing_answers]'Input should be a valid dictionaryand names no fieldAn answer whose text reads like a timeout
Steps
run.py providers '...::test_a_malformed_upstream_success_is_a_server_error_naming_the_field[answer_type_timeout_text]'assert 408 == 500, the reply beinglitellm.Timeoutwith code408Unchanged behavior
Steps
run.py providerson the 401, 429 and 500 status cells, both unreachable-upstream cells, and the per-provider cell for every providerrun.py coston the threetest_base_model_cross_provider_spend.pyparamsAfter (81d8c9a)
An unpriced returned version is billed at the requested model
A returned version with its own prices
Steps
A reply with no answers field
Steps
answersand the spend row is a failureAn answer whose text reads like a timeout
Steps
answers.defectand the spend row is a failureUnchanged behavior
Steps
At the tip
a7ba8de4e0every cell passes again. The Databricks per-provider cell failed atc7239bdf02because #48694 priced that model on main, and now passes at the base, the head twice and the tipType
✅ Test
Caveats (if any)
Low
Final Attestation
Bugbot summary