Repository navigation
test(integration): endpoint, breakdown component and failure support in the cost harness - #41999
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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)".
|
|
|
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
Pushed dccb1b5 adding the failure status range check Greptile asked for. Rebutted the upstream-equals-proxy status equality since the proxy remaps some codes |
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 dccb1b5. Configure here.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…t_shard_responses_messages
…pectations Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…essages test(integration): native responses and messages cost cases
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
TLDR
Problem this solves:
/v1/chat/completionsx-litellm-response-cost-*headers are never assertedHow it solves it:
endpointon each case, defaulting to chat completionscache_read_cost,cache_creation_cost,reasoning_cost,tool_usage_costexpectationsstatuson JSON scripted responses plus afailureexpected variant/v1/responses, upstream 500, upstream 429) and 8 existing cases now carry component expectationsUser Flow
Before: a maintainer wants to pin the cache-read component of a Claude call and the zero-spend row of a failed call, and the suite has nowhere to put either
cache_read_costto an entry intests/integration/cost_calculation/cost_tracking_cases.jsonassert response.is_successbefore looking at the spend rowAfter: both expectations are plain data in the same file
"cache_read_cost": 0.00405504next toinput_coston the Bedrock cache-read casex-litellm-response-cost-cache-readagainst that value, andx-litellm-response-cost-inputagainstinput_costminus the cache components"response": {"content_type": "application/json", "status": 500, "body": {...}}and"expected": {"failure": {"status": 500}}status = failurespend row withspend = 0"endpoint": "/v1/responses"to a case and the run posts to that path instead of chat completionsRelevant issues
Affected release
Linear ticket
Resolves LIT-8185
Pre-Submission checklist
uv run pytest tests/test_litellm/<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@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
The deliverable is the integration shard itself, run through
tests/integration/run.pyagainst a live proxy, Postgres, Redis and the scripted upstreamBefore (659cef0)
python tests/integration/run.py --group coston the merge base: 363 cases, none can post to another endpoint, script a non-200 upstream, or name a breakdown componentAfter (9bd648b)
10 passed, 356 deselected in 13.59s, thendeepseek-v4p1-flash-fallback_cache_read_at_half_input_ratealone:1 passed, 365 deselected in 2.85s1 failed, 365 passed in 856.31s, the failure being the Fireworks case fixed in the last commitType
✅ Test
Caveats (if any)
Low
Link to Devin session: https://app.devin.ai/sessions/5425681f498543a19de84adcf8daeed8
Open in Devin Desktop: https://app.devin.ai/desktop/session/5425681f498543a19de84adcf8daeed8?variant=devin