Repository navigation
fix(capture): one property precedence for client SDKs - #143
Merged
Merged
Conversation
… before_send Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Oct 23, 2026
eli-r-ph
approved these changes
Oct 23, 2026
5 of 6 tasks
ioannisj
reviewed
Oct 26, 2026
| ### Requirement: Caller-supplied event properties take precedence | ||
|
|
||
| On client SDKs, a property the caller passes on an event SHALL win over a registered (super) property with the same key and over an SDK context property with the same key, such as `$lib`, `$lib_version`, `$os`, `$app_version`, `$screen_width`, `$current_url`, `$screen_name`, `$feature/<key>` or `$active_feature_flags`. A group the caller passes for the event SHALL win over a registered group of the same type. | ||
| On client SDKs, an event's properties SHALL be merged in this order, each layer overwriting the one before: |
Contributor
There was a problem hiding this comment.
🤖 An AI agent wrote this on behalf of @ioannisj.
posthog-js sets $process_person_profile last on purpose (packages/browser/src/posthog-core.ts:2331 says "so it cannot be overridden"). @posthog/core and android do the same today.
Contributor
There was a problem hiding this comment.
We had a discussion in the v1 thread and localed a change to the override behavior for these. global/super props can now be overridden by end users per-event and on before_send in v1 SDKs. This is documented in the draft public docs PR for release and per-SDK migration guides too as needed.
…he layers Say a registered or caller value for an SDK-set key changes that event only, keep the project token as request routing, and align the layer count across proposal, tasks and spec. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Oct 28, 2026
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
Follow-up to #114. That PR let the caller's event properties win over registered and SDK context properties, but kept exceptions: the SDK SHALL set
$is_identifiedand$process_person_profileafter the caller's properties, and MAY do the same for$session_id/$window_id, the session replay debug properties,$geoip_disableand posthog-js bookkeeping. SDKs answer the MAY items differently, so the order is hard to predict.This replaces the exceptions with one order for client SDKs, each layer overwriting the one before:
before_sendChanges
acceptance/public/capture.feature:openspec validate --specs --strictpasses (67/67). The scenarios reuse existing steps.Impact
$is_identified,$process_person_profile, the session properties, the replay debug properties and page/session bookkeeping set before super and caller properties instead of after.@posthog/core(react-native, js-lite): sets$geoip_disableand person-processing state after the caller's properties; needs the same reorder.🤖 Generated with Claude Code