Skip to content

feat(feature-flag-called-tracker): document minimal event mode for non-experiment flags - #16

Merged
dustinbyrne merged 1 commit into
mainfrom
posthog-code/minimize-feature-flag-called-events
Jul 29, 2026
Merged

feat(feature-flag-called-tracker): document minimal event mode for non-experiment flags#16
dustinbyrne merged 1 commit into
mainfrom
posthog-code/minimize-feature-flag-called-events

Conversation

@posthog

@posthog posthog Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Why

Nearly every SDK has shipped a server-gated "minimal event" mode for $feature_flag_called that this spec previously said nothing about — a pure gap, not a divergence from an existing requirement. The rollout originated in posthog-python#748 (merged 2026-07-18) and has since landed, each PR describing itself as "part of a cross-SDK rollout", in:

posthog-android has only shipped the precursor $feature_flag_has_experiment property (#621); the minimization itself hasn't landed there yet. posthog-java had no relevant activity in the lookback window.

What changed

When the server enables a per-team gate (minimalFlagCalledEvents on /flags v2, or minimal_flag_called_events on the local-evaluation definitions payload) and the evaluated flag is not linked to an experiment (has_experiment === false), $feature_flag_called events are trimmed from the full enriched properties dict down to a fixed allowlist (flag identity/outcome, evaluation debug scalars, group/session context, SDK identity, and each SDK's own static platform fields). Any missing/unknown/experiment-linked signal keeps the full event unchanged — minimization fails safe.

What this PR does

Adds one new requirement, Minimal event mode for non-experiment flags, to openspec/specs/feature-flag-called-tracker/spec.md, plus the matching OpenSpec change folder (openspec/changes/archive/2026-07-27-minimize-feature-flag-called-events/) per this repo's propose→apply→archive convention. openspec validate --specs --strict passes.

The allowlist is stated at the category level rather than one fixed literal list, since SDKs differ slightly in which static platform fields they keep — posthog-python's list is used as the illustrative reference implementation.

Uncertain / flagged for reviewer attention

  • The exact allowlist literal was taken from posthog-python's source/changeset (the best-documented implementation); other SDKs were checked via PR descriptions rather than full diffs, so minor allowlist differences may not all be captured here.
  • posthog-android and posthog-flutter (real SDK) haven't shipped this yet — noted as an in-progress rollout, not treated as those SDKs being non-compliant.

Created with PostHog Code

…n-experiment flags

Nearly every SDK has shipped a server-gated "minimal event" mode for $feature_flag_called that this spec previously said nothing about. Add a requirement documenting the gate signals, the has_experiment condition, the allowlisted property categories, and the fail-safe-to-full-event behavior.

Generated-By: PostHog Code
Task-Id: 1712e846-7728-47a7-980b-6899ff320a2a

@dustinbyrne dustinbyrne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you archive the proposal / tasks? i.e., make the spec official. update the related skill if need be.

@dustinbyrne
dustinbyrne marked this pull request as ready for review July 29, 2026 14:23
@dustinbyrne
dustinbyrne self-requested a review July 29, 2026 14:23
@dustinbyrne
dustinbyrne merged commit d8fde2f into main Jul 29, 2026
10 checks passed
@dustinbyrne
dustinbyrne deleted the posthog-code/minimize-feature-flag-called-events branch July 29, 2026 14:23
posthog Bot added a commit that referenced this pull request Aug 5, 2026
…to minimal-event allowlist

## Why

[posthog-js#4287](PostHog/posthog-js#4287) ("keep session-attribution
props on minimal $feature_flag_called events") fixed a web-analytics data-correctness bug: the
minimal-event allowlist added by posthog-js#4172 (documented here in
[#16](#16)) stripped every referrer and campaign/click-id
super property (`utm_source`, `gclid`, `$referring_domain`, etc.). Web-analytics session-initial
UTM attribution and channel-type grouping are read from the **first event in a session**, and a
minimized `$feature_flag_called` event can be that first event — so a flag call landing first in a
session silently nulled out the session's whole attribution.

`openspec/specs/feature-flag-called-tracker/spec.md`'s "Minimal event mode for non-experiment
flags" requirement lists allowlist categories at a category level but never mentions referrer or
campaign/UTM properties anywhere — not in the category list, the posthog-python reference literal,
or the "everything else... SHALL be stripped" clause. This is a real spec gap: an SDK implementing
minimal-event-mode strictly per the current text would (correctly, per the spec) strip these and
reproduce the same bug.

## What this PR does

- Adds a "Session-attribution properties" category to the minimal-event allowlist —
  `$referring_domain` and canonical campaign/click-id super properties (`utm_source`, `utm_medium`,
  `utm_campaign`, `utm_content`, `utm_term`, `gad_source`, `mc_cid`, `gclid`/`fbclid`-style ids) —
  noting that full `$referrer` remains excluded (only `$referring_domain` and bare campaign-param
  keys survive), preserving the minimal event's privacy/payload-size intent.
- Adds one new `@client` scenario asserting session-attribution properties are retained while
  `$referrer` itself is still stripped.
- Change proposed and archived on this branch per this repo's one-PR-per-change convention
  (`openspec/changes/archive/2026-08-05-fix-flag-called-session-attribution/`).
- `openspec validate --specs --strict` passes (59/59).

## Uncertain / flagged for reviewer attention

- Only posthog-js/posthog-node (the shared `@posthog/core` implementation) were confirmed to have
  shipped this bug and fix. No other in-scope SDK currently ships a minimal-event mode per #16's
  own audit, so this is a documentation-only correction, not a new cross-platform parity gap —
  flagged as a follow-up check in `tasks.md` §3.1 for if/when another SDK adds minimal-event mode.


Generated-By: PostHog Code
Task-Id: 457dcd47-67c0-4fb7-830b-c3d13a790c8d
dustinbyrne pushed a commit that referenced this pull request Aug 6, 2026
…to minimal-event allowlist (#26)

## Why

[posthog-js#4287](PostHog/posthog-js#4287) ("keep session-attribution
props on minimal $feature_flag_called events") fixed a web-analytics data-correctness bug: the
minimal-event allowlist added by posthog-js#4172 (documented here in
[#16](#16)) stripped every referrer and campaign/click-id
super property (`utm_source`, `gclid`, `$referring_domain`, etc.). Web-analytics session-initial
UTM attribution and channel-type grouping are read from the **first event in a session**, and a
minimized `$feature_flag_called` event can be that first event — so a flag call landing first in a
session silently nulled out the session's whole attribution.

`openspec/specs/feature-flag-called-tracker/spec.md`'s "Minimal event mode for non-experiment
flags" requirement lists allowlist categories at a category level but never mentions referrer or
campaign/UTM properties anywhere — not in the category list, the posthog-python reference literal,
or the "everything else... SHALL be stripped" clause. This is a real spec gap: an SDK implementing
minimal-event-mode strictly per the current text would (correctly, per the spec) strip these and
reproduce the same bug.

## What this PR does

- Adds a "Session-attribution properties" category to the minimal-event allowlist —
  `$referring_domain` and canonical campaign/click-id super properties (`utm_source`, `utm_medium`,
  `utm_campaign`, `utm_content`, `utm_term`, `gad_source`, `mc_cid`, `gclid`/`fbclid`-style ids) —
  noting that full `$referrer` remains excluded (only `$referring_domain` and bare campaign-param
  keys survive), preserving the minimal event's privacy/payload-size intent.
- Adds one new `@client` scenario asserting session-attribution properties are retained while
  `$referrer` itself is still stripped.
- Change proposed and archived on this branch per this repo's one-PR-per-change convention
  (`openspec/changes/archive/2026-08-05-fix-flag-called-session-attribution/`).
- `openspec validate --specs --strict` passes (59/59).

## Uncertain / flagged for reviewer attention

- Only posthog-js/posthog-node (the shared `@posthog/core` implementation) were confirmed to have
  shipped this bug and fix. No other in-scope SDK currently ships a minimal-event mode per #16's
  own audit, so this is a documentation-only correction, not a new cross-platform parity gap —
  flagged as a follow-up check in `tasks.md` §3.1 for if/when another SDK adds minimal-event mode.


Generated-By: PostHog Code
Task-Id: 457dcd47-67c0-4fb7-830b-c3d13a790c8d

Co-authored-by: posthog[bot] <206114724+posthog[bot]@users.noreply.github.com>
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.

1 participant