Repository navigation
fix: don't require the installation ID to be a UUID - #2177
Merged
Merged
Conversation
Read line 1 of <database>/installation_id up to the newline instead of as a fixed 36 bytes, so the file can hold an ID of any length, and accept any non-empty, newline-free ID of up to 128 characters from a platform integration. Existing files parse exactly as before and a generated ID is still a random UUIDv4. user.id is free-form in the protocol, so there is no reason for the SDK to impose a format of its own on the ID that backs it.
tustanivsky
marked this pull request as ready for review
October 8, 2026 07:11
The reader trims line 1 of the file, so an ID with surrounding whitespace was reported as-is on the run that created it and in its trimmed form on every run after, changing user.id once. Trim on the way in as well, and reject an embedded newline over the trimmed span.
The installation ID no longer has to be a UUID, so stop asserting its length. In test_scope.c the neighbouring checks already cover that the ID is present and that the event's user ID matches it; in test_session.c the check is all that covers `did`, so it only asserts the value is set.
| ? options->dsn->public_key | ||
| : ""; | ||
| const size_t key_len = strlen(public_key); | ||
| const size_t max_id_len = 128; |
Member
There was a problem hiding this comment.
(note) matches the Relay truncation limit in https://github.com/getsentry/relay/blob/master/relay-event-schema/src/protocol/user.rs#L48
JoshuaMoelans
approved these changes
Oct 8, 2026
jpnurmi
approved these changes
Oct 8, 2026
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2177 +/- ##
==========================================
- Coverage 75.47% 75.43% -0.05%
==========================================
Files 103 103
Lines 28079 28089 +10
Branches 5147 5150 +3
==========================================
- Hits 21194 21189 -5
- Misses 5538 5558 +20
+ Partials 1347 1342 -5 🚀 New features to boost your workflow:
|
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.
Follow-up to #2150: the persisted installation ID is stored and read back as a UUID, but the
user.idit backs is free-form in the protocol, so there's no reason for the SDK to impose a format of its own as it forces anything that wants to supply an ID to pad or hash it into UUID shape first.Key Changes
<database>/installation_idis now read up to the newline instead of as a fixed 36 bytes, so the file can hold an ID of any length. A trailing\ris trimmed, and IDs longer than 128 characters are rejected so a corrupt file can't produce an absurduser.id.<uuid>\n<public_key>\nparses exactly as before, and rotation when the DSN's public key changes is unaffected.Related Items
user.id#1661