Repository navigation
fix(span-components): only compress canonical UUIDs in V3 - #1161
Merged
Abhijeet Prasad (AbhiPrasad) merged 1 commit intoNov 20, 2026
Merged
Conversation
`_try_make_uuid` accepted anything `uuid.UUID()` parses: 32-char hex, braces, `urn:uuid:` and uppercase. Decoding always returns the canonical dashed form, so those IDs came back altered. A hex trace ID re-exported under BRAINTRUST_LEGACY_IDS would gain dashes and split the trace. Compress only when the value is already a canonical UUID string. Any other value goes into the JSON section unchanged. Decoding is the same as before, so existing slugs and other V3 readers keep working. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour 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. |
Abhijeet Prasad (AbhiPrasad)
deleted the
fix/v3-strict-uuid-compression
branch
November 20, 2026 18:21
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.
Summary
_try_make_uuidinspan_identifier_v3.pycompressed any value thatuuid.UUID()accepts. That includes 32-char hex,{braced},urn:uuid:and uppercase forms. V3 decoding always returns the canonical lowercase dashed form, so those IDs came back changed after a round trip. For example,4bf92f35…4736came back as4bf92f35-77b3-…-4736.The SDK only exports V3 under
BRAINTRUST_LEGACY_IDS, where it generates canonical UUIDs itself, so this is narrow. One path can still hit it: a service with legacy IDs imports a parent from a default-mode (hex ID) service, then re-exports a child span. The child'sroot_span_idgains dashes, and anything continuing from that slug splits from the original trace.Fix
Compress a value only when
str(UUID(s)) == s, meaning it is already a canonical UUID. Any other value goes into V3's JSON section unchanged. Decoding is unchanged, so existing slugs and other V3 readers still work, and canonical UUIDs encode to the same bytes as before.Tests
test_otel_ids_fail_roundtrip, which asserted the buggy behavior, withtest_otel_ids_roundtrip_unchanged. It checks that hexobject_id,span_idandroot_span_idround-trip exactly.urn:uuid:and undashed UUID strings.nox -s test_core: 1229 passed, 112 skipped, 12 xfailed.nox -s "test_temporal(latest)": 27 passed. The Temporal plugin decodes V3 slugs, and that path is unchanged.🤖 Generated with Claude Code
Co-authored by StarfolkAI (@starfolkai)[bot]