litellm/scripts/trace_codegen
Yujong Lee 97ded17960 feat(tracing): shared signed pagination for trace list and detail reads
Add the litellm-pagination crate (Page envelope, signed expiring cursors bound to resource, scope, query and revision, stable failure codes) and move the trace list, trace detail and span error reads onto it. The list pins a publication fence through a new ReceivedMs rollup column so continuation pages exclude later-received rows. The Python bridge raises TraceReadError(code, message), the proxy maps codes to 400/409/410/413/503 with Retry-After, cursor keys come from tracing.store.cursor_keys with LITELLM_SALT_KEY and LITELLM_MASTER_KEY fallbacks, and Lens consumes the items envelope and shows Refresh instead of Retry when a traversal is gone.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-03 22:56:14 +00:00
..
schemas feat(tracing): shared signed pagination for trace list and detail reads 2026-10-03 22:56:14 +00:00
templates feat(traces): tracing development seed (#44363) 2026-10-03 09:59:51 +00:00
config.json feat(traces): tracing development seed (#44363) 2026-10-03 09:59:51 +00:00
README.md feat(traces): tracing development seed (#44363) 2026-10-03 09:59:51 +00:00

Run uv run scripts/generate_trace_types.py from the repository root to export Rust schemas and regenerate the Python trace contracts. Run the same command with --check to compare fresh output with the committed schemas and Python files

The script pins datamodel-code-generator in its inline dependency metadata. Rust uses the workspace's locked Schemars version through each owning crate's optional schema feature. Neither tool is a Python runtime dependency

Each crate exports its own roots using JSON Schema 2020-12. Request parameters use Schemars' deserialization contract. Trace views and query help use its serialization contract. Lens rows use their ClickHouse deserialization schemas, including quoted numbers and numeric boolean flags

The templates preserve tuple conversion, immutable tuple defaults, and bounded ReadOnly TypedDict fields. Pydantic models use the generator's frozen-model option and each schema's extra-field policy. ClickHouse numeric schemas select bounded, normalized Python scalar types through schema metadata consumed by the model template

Edit the owning Rust contract, schema annotation, or generation configuration, then regenerate. Never edit litellm/rust_bridge/trace/generated/ manually. The SQL response envelope remains handwritten in queries.py