Skip to content

fix: preserve custom ID case in exported span parents - #1020

Closed
Gareth.Y (linjiaye929) wants to merge 1 commit into
braintrustdata:mainfrom
linjiaye929:codex/preserve-exported-custom-id-case
Closed

Gareth.Y (linjiaye929) wants to merge 1 commit into
braintrustdata:mainfrom
linjiaye929:codex/preserve-exported-custom-id-case

Conversation

@linjiaye929

Copy link
Copy Markdown
Contributor

Summary

Preserve custom hexadecimal-looking span and root IDs when exporting and importing a V4 parent slug. Binary compression currently accepts uppercase/mixed-case hex strings, but decoding with bytes.hex() lowercases them. The original parent log keeps the supplied IDs while a child created from the exported slug logs different parent/root identifiers.

Only compress strings whose binary roundtrip is lossless. Noncanonical strings use the existing JSON representation; ordinary lowercase OpenTelemetry IDs keep their current compact encoding. This does not make uppercase W3C traceparent values valid or change W3C parsing.

Regression coverage

Seven parameterized cases use the real public logger, span.export(), logger.start_span(parent=...), and the repository's native in-memory logging fixture. They compare the actual parent/child log records and decoded slug IDs. Cases cover uppercase span only, uppercase root only, both mixed-case, lowercase hex, decimal-only hex, arbitrary strings and uppercase UUID strings.

The tests do not call Braintrust or an LLM/provider API. Backend case handling has not been tested; the demonstrated failure is the SDK emitting inconsistent parent/child identifiers.

Validation

Python 3.14.7 and uv 0.13.4 from repository tool configuration; test dependencies from the frozen lockfile.

  • Before fix: three regressions fail; four controls pass.
  • After fix: test_span_components.py: 29 passed.
  • Ruff check/format, changed-file Pylint --errors-only, and git diff --check pass.
  • Full repository pre-commit: all seven hooks passed. mise itself is unavailable; its equivalent pre-commit run --all-files command was used with configured tool versions.
  • Official nox -s test_core was interrupted by a safety rejection reporting an attempted request to api.braintrust.ai. It did not complete and is not a pass. No retry was made. The run had CI replay mode and an external-socket guard, but those precautions do not override the rejection.
  • Full provider/version/static-type matrix and whole-SDK Pylint were not run.

AI assistance was used for implementation and local verification. No human review or hosted-CI success is claimed.

@linjiaye929
Gareth.Y (linjiaye929) marked this pull request as ready for review October 31, 2026 06:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T06:36:19.686956Z 5d91dcf Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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