Skip to content

test(logging): add autorouter estimate keys to the GCS pub/sub spend-log golden - #42061

Merged
yuneng-berri merged 1 commit into
mainfrom
litellm_fix_gcs_pub_sub_autorouter_golden
Sep 20, 2026
Merged

yuneng-berri merged 1 commit into
mainfrom
litellm_fix_gcs_pub_sub_autorouter_golden

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • logging_testing CI job fails on main in test_async_gcs_pub_sub_v1
  • Spend-log metadata now always stamps two autorouter keys the golden lacks

How it solves it:

  • Add autorouter_savings_estimate and autorouter_baseline_observation as null to the golden
  • Same key order as the sibling goldens in test_spend_management_endpoints.py

User Flow

Test-only change, no user-facing behavior changes

Relevant issues

Unblocks the logging_testing job on main, red since the autorouter baseline metadata keys started being stamped into every spend-log row

Affected release

Linear ticket

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/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
  • 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
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to 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

Golden-file test fix, so the proof is the test itself

Before (1f28813)

  1. LITELLM_LOCAL_MODEL_COST_MAP=True uv run --no-sync pytest tests/logging_callback_tests/test_gcs_pub_sub.py -q
  2. 1 failed, 1 passed: Dictionary mismatch: ['Extra key in actual: metadata.autorouter_savings_estimate', 'Extra key in actual: metadata.autorouter_baseline_observation']

After (144cf9a)

  1. Same command
  2. 2 passed

Type

✅ Test

Caveats (if any)

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

Link to Devin session: https://app.devin.ai/sessions/4b5ecf854386459db5a166663a7f642c
Open in Devin Desktop: https://app.devin.ai/desktop/session/4b5ecf854386459db5a166663a7f642c?variant=devin
Requested by: @mateo-berri

…log golden

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@greptile-apps

greptile-apps Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge because the golden now matches the intentional spend-log metadata contract without weakening assertions

Summary

This test-only change updates the GCS Pub/Sub spend-log golden to match the metadata contract already produced by the application

  • Adds autorouter_savings_estimate with a null default
  • Adds autorouter_baseline_observation with a null default
  • Preserves strict comparison of missing and unexpected metadata fields

Reviews (1) · Last reviewed commit: "test(logging): add autorouter estimate k..."

@codecov

codecov Bot commented Sep 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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