Skip to content

fix(cli): drop redundant identify from identity stitch#5396

Open
seanoliver wants to merge 1 commit into
developfrom
sean/growth-890-drop-redundant-identifydistinctid-nil-from-cli-stitchlogin
Open

fix(cli): drop redundant identify from identity stitch#5396
seanoliver wants to merge 1 commit into
developfrom
sean/growth-890-drop-redundant-identifydistinctid-nil-from-cli-stitchlogin

Conversation

@seanoliver
Copy link
Copy Markdown
Contributor

Problem

Both the Go CLI's StitchLogin and the TS CLI's X-Gotrue-Id interception fire $create_alias AND $identify(distinctID, nil) back-to-back on a user's first successful stitch. The $identify carries no person properties, so $create_alias already owns the entire device→user merge in the person graph. The Identify is pure event-volume waste.

This is the follow-up to #5366. That PR gated stitching in ephemeral environments (CI, Docker, npx) to stop the identify spike. This one tightens the path that still runs — persistent developer laptops — by dropping the redundant call.

We verified the redundancy empirically: of 638K posthog-go $identify events on 2026-05-26, zero carried $anon_distinct_id linkage, confirming the merge comes entirely from the alias.

Changes

  • Go: remove s.analytics.Identify(distinctID, nil) from StitchLogin in apps/cli-go/internal/telemetry/service.go.
  • TS: remove analytics.identify(gotrueId) from the stitch in apps/cli/src/legacy/auth/legacy-platform-api.layer.ts. The TS identify() may have set default person properties (cli_version, os, arch); accepting that small loss since subsequent cli_* capture events carry the same data as event properties.
  • Tests updated on both surfaces to assert Alias fires and Identify does not.

Kept the surfaces 1:1 so the Go/TS telemetry parity holds. identify stays on the Analytics interface — the login command still uses it for cli_login_completed, which is a separate path.

Halves the remaining persistent-laptop stitch volume (~15K/day → ~7K/day). No effect on the spike population already handled by #5366.

GROWTH-890

The Go StitchLogin and TS X-Gotrue-Id interception both fired
$create_alias and $identify(distinctID, nil) back-to-back on first
stitch. The Identify carries no person properties, so $create_alias
already owns the device->user merge — the Identify was pure event
volume waste (verified: 0 of 638K posthog-go identify events on
2026-05-26 carried $anon_distinct_id linkage).

The ephemeral-environment gate from #5366 already handles the spike
population; this halves the remaining persistent-laptop stitch volume.

GROWTH-890
@seanoliver seanoliver requested a review from a team as a code owner May 29, 2026 17:24
@blacksmith-sh
Copy link
Copy Markdown

blacksmith-sh Bot commented May 29, 2026

Found 3 test failures on Blacksmith runners:

Failures

Test View Logs
internal/login/internal/login View Logs
internal/login/TestLoginTelemetryStitching View Logs
internal/login/TestLoginTelemetryStitching/
token_login_fetches_profile_and_stitches_with_gotrue_id
View Logs

Fix in Cursor

Copy link
Copy Markdown
Contributor

@jgoux jgoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

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