test(logging): pin routing_decision and internal_call_origin in the gcs pubsub spend log fixture - #35506
Merged
yuneng-berri merged 1 commit intoAug 1, 2026
Conversation
…cs pubsub spend log fixture
Contributor
Greptile SummaryThe PR refreshes the GCS Pub/Sub spend-log golden fixture to match the current metadata schema without changing runtime behavior.
Confidence Score: 5/5The PR appears safe to merge because it only synchronizes a strictly compared test fixture with the demonstrated spend-log payload. The added fields match the current payload for the fixture’s request scenario, remain subject to strict comparison, and do not alter production code.
|
| Filename | Overview |
|---|---|
| tests/logging_callback_tests/gcs_pub_sub_body/spend_logs_payload.json | Updates the serialized metadata fixture with two stable null fields now emitted for the tested non-router, non-internal request. |
Reviews (1): Last reviewed commit: "test(logging): pin routing_decision and ..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
tin-berri
approved these changes
Aug 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Problem this solves:
test_async_gcs_pub_sub_v1fails onlitellm_internal_stagingSpendLogsMetadatafields never reached the golden fixtureHow it solves it:
routing_decisionandinternal_call_originto the fixturenull, matching a real proxy requestignored_keysso drift still failsRelevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)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
This PR changes a golden test fixture only; there is no runtime diff, so there is no before/after behavior to exercise on a proxy. What is worth proving is that the two keys the fixture now pins are genuinely what a live proxy emits, and that the fixture still catches drift rather than tolerating it. Both are shown below
1. A real request through a live proxy emits both keys
Proxy started against this branch at
aaf619c270, real OpenAI call, real spend{ "id": "chatcmpl-E8Bgj253c9SgKKWgFfRorp1COZ2GE", "model": "gpt-4o", "choices": [{"finish_reason": "stop", "index": 0, "message": {"content": "Fixture.", "role": "assistant"}}], "usage": {"completion_tokens": 2, "prompt_tokens": 13, "total_tokens": 15} }That request's spend log row, read straight out of Postgres:
Both keys are present and
nullon a plain non-router call, which is exactly what the fixture now asserts2. The fixture still fails on drift
Temporarily setting the fixture's
routing_decisionto a non-null value ataaf619c270reproduces a real failure, so the added keys are being compared rather than waved through:3. Before and after on the failing test
At
b1fd20f4cd(staging HEAD, before this commit):At
aaf619c270, both tests in the file passType
✅ Test
Changes
_get_spend_logs_metadatabuilds the spend log metadata blob by iteratingSpendLogsMetadata.__annotations__, so every field added to that TypedDict automatically lands in the emitted payload. Two feature PRs added a field without updating the golden fixture thattest_async_gcs_pub_sub_v1diffs against: #35016 addedrouting_decisionand #35300 addedinternal_call_origin. The fixture has been failing onlitellm_internal_stagingever sinceThe fix adds both keys to the
metadatablob intests/logging_callback_tests/gcs_pub_sub_body/spend_logs_payload.jsonwithnullvalues. They are deliberately not added toignored_keys; that list exists for values that genuinely vary per run, and both of these are stablenullfor a request that goes through neither the auto-router nor an internal classifier call. Putting them in the ignore list would silence the fixture on two fields that consumers of the spend log schema depend onFinal Attestation