Skip to content

test(integration): port langfuse callbacks-in-db coverage to the local harness (#43282) - #43284

Open
devin-ai-integration[bot] wants to merge 1 commit into
rc/1.104.0from
litellm_backport_43282_rc_1_104_0
Open

devin-ai-integration[bot] wants to merge 1 commit into
rc/1.104.0from
litellm_backport_43282_rc_1_104_0

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

How it solves it:

User Flow

Before: an admin on the rc line turns Langfuse on at runtime and the suite guarding this path is red for reasons unrelated to the proxy

  1. They send POST http://localhost:4000/config/update with success_callback: ["langfuse"] and LANGFUSE_* env vars and get 200
  2. They send POST http://localhost:4000/v1/chat/completions and get a 200 with a chatcmpl-... id
  3. CI asks a hosted mock at https://exampleopenaiendpoint-production-c715.up.railway.app/langfuse/trace/<id>, which always answers {"exists": false}, so the job is red

After: the same runtime configuration is proven against a local Langfuse fake in the integration suite

  1. They send the same POST http://localhost:4000/config/update and get 200
  2. They send the same POST http://localhost:4000/v1/chat/completions and get a 200 with a chatcmpl-... id
  3. Within seconds the Langfuse host receives exactly one POST /api/public/otel/v1/traces carrying a generation observation whose response_id metadata equals that id, authenticated with the keys from step 1, with no provider or virtual key in the payload

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)

Screenshots / Proof of Fix

Tests-only backport, so the proof is the pick applying cleanly and the ported test green on the rc line. The full Before and After legs, including the two mutation runs, are in #43282

Shared setup: integration Postgres and Redis from .circleci/scripts/run_integration.sh, scripted upstream on 8190, integration proxy on 4000 booted from this branch

Before (rc/1.104.0 tip)

  1. curl -s -o /dev/null -w '%{http_code}' -X POST https://exampleopenaiendpoint-production-c715.up.railway.app/api/public/otel/v1/traces -H 'content-type: application/x-protobuf' --data-binary '' prints 404: the mock the legacy test depends on has no v4 OTLP ingest route, so test_e2e_langfuse_callbacks_in_db cannot pass

After (5acdc1a)

  1. git cherry-pick -x e11c3f5815b54a3bf76ace48bfead4f2bf0f8da0 applies with no conflicts and the commit carries (cherry picked from commit e11c3f5815b54a3bf76ace48bfead4f2bf0f8da0)
  2. pytest tests/integration/observability/test_langfuse_delivery.py -k stored_in_the_db: 1 passed, 2 deselected in 14.79s
  3. SELECT param_name, param_value FROM "LiteLLM_Config" WHERE param_name IN ('litellm_settings', 'environment_variables') before and after both print (0 rows), diff is empty
  4. ruff check --config ruff-tests.toml on the test file: All checks passed!; basedpyright: 0 errors, 0 warnings, 0 notes

Type

✅ Test

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/e8a4cf844b854f00ac366862831d87f2
Open in Devin Desktop: https://app.devin.ai/desktop/session/e8a4cf844b854f00ac366862831d87f2?variant=devin

…l harness (#43282)

* test(integration): port langfuse callbacks-in-db coverage to the local harness

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

* test(integration): assert the langfuse db rows after the exported span

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

---------

Co-authored-by: yuneng <yuneng@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit e11c3f5)
@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

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Low risk] Moves test coverage between test files.

The PR appears safe to merge; no outstanding finding or new actionable issue remains.

Summary

This test-only backport replaces the Railway-dependent Langfuse callback test with a local integration test that checks runtime configuration, DB persistence, and OTLP delivery.

  • Removes the legacy hosted-mock test.
  • Restores the affected configuration rows after the new test.

Reviews (2) · Last reviewed commit: "test(integration): port langfuse callbac..."

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai

This branch has not been deployed

No deployments
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.

1 participant