fix(identify): document anonymous-to-identified transition on matching distinct id - #18
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(identify): document anonymous-to-identified transition on matching distinct id#18posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
…g distinct id The spec named the wrong winner: calling identify() with a distinct id that already equals the persisted anonymous id was documented as "log and drop", but three SDKs independently fixed this to instead transition the user to identified and emit a $set event. Generated-By: PostHog Code Task-Id: 7d7cb7ed-0d67-4718-ada0-2b2cd585f3a6
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.
Why
Three SDKs independently shipped the identical bug fix within days of each other:
The bug: calling
identify(id)with anidthat already equals the persisted distinct id, while the SDK still considers the user anonymous (e.g. a bootstrap-seeded id), fell into the "same distinct id" branch, which only acts when properties are supplied. With none, the call was dropped entirely — no event, and the identified-state flag never flipped totrue. The person profile stayed anonymous indefinitely despite an explicitidentifycall.The fix (identical across all three): treat this as its own identity-state transition — mark the user identified and emit exactly one person-processed
$set(not$identify, since there's no anonymous id to merge), carrying any supplied properties (or empty$set/$set_onceif none). This fires even with no properties supplied — the transition itself is the effect being recorded. Feature flags reload only if properties were supplied.openspec/specs/identify/spec.mdline 112 documented the old, buggy behavior as canonical ("Same distinct id, no properties → log 'already identified', drop"), with no carve-out for the anonymous case — this isn't a gap, the spec names the wrong winner.What this PR does
@clientscenario to theCanonical identify behaviorrequirement (viaopenspec/changes/archive/2026-07-31-fix-identify-anonymous-transition/, following this repo's propose→archive convention).openspec validate --specs --strictpasses.Uncertain / flagged for reviewer attention
tasks.md§4).Created with PostHog Code