Repository navigation
refactor(traces): type the ClickHouse query help response - #44285
Merged
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Contributor
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
…und trips 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>
yujonglee-berri
approved these changes
Oct 3, 2026
7 tasks done
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:
json!, so key typos and wrong types compiledHow it solves it:
query_helpreturns aQueryHelpstruct; the bridge serializes it to a Python valueJsonKind,MapValueTypeandTraceTableenums replace string literalsDiscovery::{Observed, Unavailable}makes the error and sample fields mutually exclusiveREAD_LIMITSandREADER_LIMITSfeed the HTTP settings, the reader user and the Askama guideLiteraltypes andextra="forbid"so contract drift fails loudlyThe serialized JSON shape is unchanged: discovery still flattens
fields,truncatedand the optionalerrorinto the catalog object, and Askama still renders the guide, examples and gotchasUser Flow
Before: an agent asking the proxy how to query traces gets a guide whose limits text could drift from what the reader enforces
After: the same call returns the same shape, and the guide numbers come from the limits the reader enforces
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 more@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
No LLM call is involved; this is a contract refactor of the trace query help response. Proof is the real ClickHouse integration run plus validating its output against the Python models
After (8c7e348)
cargo test -p litellm-traces-clickhouse -p litellm-storage-clickhouseagainst a live ClickHouse container: all suites pass, includingquery_help_discovers_live_schema_and_runs_its_examplesandquery_help_preserves_schema_and_guide_when_discovery_hits_reader_limitsTypeAdapter(TraceQueryHelp).validate_python, and both validated withextra="forbid":uv run pytest tests/unit/proxy/test_tracing_endpoints.py tests/unit/rust_bridge: 1229 passedClickHouseStorage.query_help: a valid payload comes back asTraceQueryHelp, while aboolenmetadata kind, atracestable name or an unknown top-level key each raiseRuntimeError(46 passed intests/unit/proxy/test_tracing_endpoints.py)Type
🧹 Refactoring
Caveats (if any)
Medium
truncated: truein that caseextra="forbid"means a new Rust field needs a matching Python fieldmaincurrently failsrust-testincrates/traces/tests/query/named.rsbecause the round-trip fixtures predate theagent_names,frameworksandframeworkfields; 54d1ce6 adds them so this branch is greenLink to Devin session: https://app.devin.ai/sessions/4c9710dc56ac43a99ec98515b219636d
Open in Devin Desktop: https://app.devin.ai/desktop/session/4c9710dc56ac43a99ec98515b219636d?variant=devin
Requested by: @yujonglee-berri