Repository navigation
fix: store the person-properties hash only once the update is queued - #967
Merged
Merged
Conversation
The dedup hash was written before capture ran, so a $set that beforeSend dropped or made personless, or one made while opted out, still left its hash and the next identical update was skipped. The hash is now checked before capture and recorded or cleared after the event is queued, from the event as sent. An accepted $identify records it too.
Contributor
There was a problem hiding this comment.
PostHog Review · Standard · reviewed b99bd17: 2 Should fix.
See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.
Contributor
posthog-android Compliance ReportDate: 2026-11-12 14:20:28 UTC ✅ All Tests Passed!46/46 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
Gson throws on values such as Double.NaN, which made identify and setPersonProperties throw before the event was captured. Fall back to the map's string form and log instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
If beforeSend changed or removed $set/$set_once or the distinct id, the original hash was still cached and a later identical update was skipped. Compare the hash of the event as queued and clear it on a mismatch; an empty map now hashes like a missing one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dustinbyrne
approved these changes
Nov 11, 2026
dustinbyrne
left a comment
Contributor
There was a problem hiding this comment.
The earlier NaN-identification and hook-filtered-payload cases are addressed, and relevant CI passes. Two optional robustness notes remain for unhashable or pathological property inputs.
AI-assisted review.
Catch failures from the recursive sort as well as serialization, and send an unhashable update without caching a hash, instead of falling back to Map.toString(), which equates 1 and "1". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
💡 Motivation and Context
Android stores the person-properties dedup hash before the event is built. So if
beforeSenddrops a$set, or sets$process_person_profiletofalse, or the SDK is opted out, the hash is stored anyway, and the next identicalsetPersonProperties/identifycall is skipped. The server never gets that update.This makes Android follow sdk-specs #208 (and the existing
identifyspec), and matches how iOS'squeueEventalready works:beforeSend). It's recorded when the event keeps its name and$process_person_profileis missing ortrue.$identifynow records the hash too, as the spec says. A follow-upidentifywith the same properties no longer sends an extra$set.Two identical calls racing each other can now both be sent, which the spec allows. The old code wrote the hash in the check itself.
The v4 branch PR #965 can then be rebased onto this and shrink to the per-call
process_person_profileoption, which is already covered here because that option lands in$process_person_profilebefore the hook runs.💚 How did you test it?
PostHogTest: a$setdropped bybeforeSendis resent, a$setmade personless bybeforeSendis resent, an update made while opted out is sent afteroptIn(), andidentifyskips a$setthat repeats its$identifyproperties. All 4 fail onmainand pass with this change../gradlew spotlessCheck :posthog:apiCheck :posthog:test :posthog-android:testDebugUnitTest: 1094 + 1033 tests, 0 failures.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Claude Code (Opus) wrote the fix after a spec review of sdk-specs#208 found Android #965 stored the hash before
beforeSendand queueing. I followed iOS'squeueEventas the reference, but kept Android's pre-capture duplicate check rather than moving the whole check under the queue lock.