feat(telemetry): stitch CLI identity from API response header#5054
Merged
seanoliver merged 4 commits intodevelopfrom Apr 9, 2026
Merged
feat(telemetry): stitch CLI identity from API response header#5054seanoliver merged 4 commits intodevelopfrom
seanoliver merged 4 commits intodevelopfrom
Conversation
Coverage Report for CI Build 24205885789Warning No base build found for commit Coverage: 63.794%Details
Uncovered Changes
Coverage RegressionsRequires a base build to compare against. How to fix this → Coverage Stats
💛 - Coveralls |
avallete
approved these changes
Apr 9, 2026
Member
avallete
left a comment
There was a problem hiding this comment.
Minor nitpicks, nothing blocking.
…ests - Wrap StitchLogin callback in sync.Once to prevent duplicate $alias calls if concurrent API responses both carry X-Gotrue-Id - Rename HeaderGotrueId → HeaderGotrueID per Go naming conventions - Add tests for nil callback and inner transport error paths
Avoids capturing OnGotrueID by value at GetSupabase() init time, which would silently hold nil if clientOnce.Do ran before PersistentPreRunE set the callback. Transport now holds &OnGotrueID and dereferences at call time, decoupling initialization order.
271bcc9 to
a271d96
Compare
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
identityTransportRoundTripper that readsX-Gotrue-Idfrom management API response headersStitchLogin()to linkdevice_id→gotrue_idin PostHogtelemetry.jsonafter first stitchCompanion PR: supabase/platform#31378 — platform-side interceptor that sets the
X-Gotrue-Idresponse header. Safe to merge in either order; without the header, this change is a transparent no-op.Context: GROWTH-756 — ~89% of CLI devices are anonymous. CLI tokens are opaque (
sbp_*), sogotrue_idcan't be extracted locally. This piggybacks on existing API calls to passively resolve identity, taking coverage from 11% → ~85%.Test plan
go test ./internal/utils/ -run TestIdentityTransport -v— transport captures header when present, ignores when absentgo test ./internal/telemetry/ -run TestServiceNeedsIdentityStitch -v— returns true when DistinctID empty, false after stitchgo test ./...— no regressionsDEBUG=true— confirms no errors (header not present yet, so no stitch attempt)