Skip to content

fix: fill feature flag properties below context tags and super properties - #1121

Merged
eli-r-ph merged 1 commit into
v1from
v1-flag-properties-as-sdk-values
Oct 23, 2026
Merged

eli-r-ph merged 1 commit into
v1from
v1-flag-properties-as-sdk-values

Conversation

@eli-r-ph

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

On v1, the feature flag properties from flags or send_feature_flags ($feature/<key>, $active_feature_flags) win over the same keys set in context tags or super_properties. That differs from every released SDK and from the rest of the v1 fleet:

  • posthog-python 7.x, posthog-go 1.x and posthog-node 5.x all let context and super/default properties win over flag properties.
  • posthog-go v2 already fills flag properties after context and defaults.
  • The client SDK order in PostHog/sdk-specs#143 (adopted by posthog-ios 4.0) puts flag properties with the other properties the SDK sets itself, under super properties.

This change treats flag properties as SDK values, like $is_server and system properties: they fill only keys the call, context tags and super_properties left unset. The call's own properties still win over everything, so a caller can still set a $feature/<key> on one event.

  • Client.capture and AsyncPosthog pass flag properties to the SDK-values layer instead of merging them into the call's properties.
  • The 8.0 migration guide lists flag properties among the values the SDK sets, and notes that this matches 7.x.
  • No changeset: the order is the same as in 7.x.

💚 How did you test it?

  • New parameterized tests (sync and async): a $feature/<key> from the call, a context tag or super_properties beats the snapshot value, and with no caller value the snapshot fills it. The context and super_properties cases fail without this change.
  • Two existing snapshot tests that read the mocked _enqueue call now read the flag properties from its new argument.
  • pytest posthog/test, ruff check, ruff format --check, mypy and make public_api_check pass locally.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran sampo add to generate a changeset file

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Authored with Claude Code (Claude Opus 5.5), directed by @eli-r-ph. The precedence was checked in the code of posthog-python 7.x, posthog-go 1.x and v2, posthog-node 5.x, posthog-js, posthog-ios 3.x and 4.0, and posthog-rs.

🤖 Generated with Claude Code

…ties

Flag properties from flags or send_feature_flags are values the SDK
adds, so they now fill after the call's properties, context tags and
super_properties, like $is_server and system properties. 7.x already
let context tags and super_properties win over them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eli-r-ph eli-r-ph self-assigned this Oct 23, 2026
@eli-r-ph
eli-r-ph marked this pull request as ready for review October 23, 2026 21:57
@eli-r-ph
eli-r-ph requested a review from a team as a code owner October 23, 2026 21:57
@eli-r-ph
eli-r-ph merged commit 537190e into v1 Oct 23, 2026
42 checks passed
@eli-r-ph
eli-r-ph deleted the v1-flag-properties-as-sdk-values branch October 23, 2026 22:24
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