Skip to content

Conversation

@igormq
Copy link
Contributor

@igormq igormq commented Jan 22, 2026

Summary

  • Propagate personProperties (as userProperties) and groups to captureStateless when $feature_flag_called events are sent during feature flag evaluation
  • Previously these properties were available during flag evaluation but not passed through to the captured event, meaning the feature flag evaluation context was lost

Split from original PR addressing contributor feedback to keep changes focused.

When `getFeatureFlagStateless` calls `captureStateless` for the
`$feature_flag_called` event, it now propagates the `personProperties`
(as userProperties) and `groups` to the event. Previously these
properties were available but not passed through, meaning the feature
flag evaluation context was lost in the captured event.

This ensures that when analyzing feature flag events in PostHog,
the user properties and group context are properly attached for
accurate targeting and analysis.

Fixes part of the issue by ensuring proper event context propagation.
Comment on lines +457 to +459
val userProps = personProperties
?.filterValues { it != null }
?.mapValues { it.value!! }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we do this instead of just passing personProperties?

@marandaneto
Copy link
Member

@dustinbyrne i think you'd know better what exactly the problem here is

@marandaneto marandaneto requested a review from a team January 22, 2026 17:40
PostHogEventName.FEATURE_FLAG_CALLED.event,
distinctId,
properties = props,
userProperties = userProps,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Providing userProperties here will mutate persisted person properties. That seems unexpected for a feature flag called event.

What's the behavior we're looking for by doing this?

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.

3 participants