Skip to content

fix(identify): document anonymous-to-identified transition on matching distinct id - #18

Draft
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/fix-identify-anonymous-transition
Draft

fix(identify): document anonymous-to-identified transition on matching distinct id#18
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-code/fix-identify-anonymous-transition

Conversation

@posthog

@posthog posthog Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Why

Three SDKs independently shipped the identical bug fix within days of each other:

The bug: calling identify(id) with an id that 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 to true. The person profile stayed anonymous indefinitely despite an explicit identify call.

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_once if 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.md line 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

  • Adds one new @client scenario to the Canonical identify behavior requirement (via openspec/changes/archive/2026-07-31-fix-identify-anonymous-transition/, following this repo's propose→archive convention).
  • Splits the old "Same distinct id" Behavior-section bullet into anonymous-transition vs. already-identified cases, and updates the "Duplicate-call suppression" summary table row to match.
  • openspec validate --specs --strict passes.

Uncertain / flagged for reviewer attention

  • Only posthog-js, posthog-ios, and posthog-android were checked. Flutter and React Native weren't audited for the same bug — worth a follow-up pass (noted in tasks.md §4).
  • Server SDKs are unaffected (no anonymous-id concept per this spec's existing client/server split).

Created with PostHog Code

…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
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.

0 participants