fix(flags): update frontend null checks to enable per-condition aggregation_group_type_index
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.9k
- Forks
- 3.4k
- Avg merge
- 6h 51m
- Merged PRs (30d)
- 232
Description
Context
Part of #46288 (Mixed User + Group Targeting for Feature Flags).
PR #51399 adds aggregation_group_type_index to each condition set, but currently only sets the field when the value is non-null. For person-aggregated flags, the field is left absent to preserve backward compatibility with frontend code that uses !== undefined checks.
This blocks the full per-condition aggregation vision where every condition set explicitly carries its aggregation mode (including None for person-aggregated).
Problem
~10 frontend locations use !== undefined to check aggregation_group_type_index. In JavaScript, null !== undefined is true, so adding explicit null values would cause these checks to incorrectly treat person-aggregated flags as group-aggregated.
Affected locations
| File | Pattern | Impact |
|---|---|---|
relatedFeatureFlagsLogic.ts |
!== undefined |
Flags miscategorized as group-based |
experimentLogic.tsx |
!== undefined |
Always includes field in spread |
featureFlagLogic.ts |
== undefined |
Early access feature creation breaks |
FunnelsAdvanced.tsx |
!= undefined |
Wrong text rendered |
filtersToQueryNode.ts |
!== undefined |
null sent to backend unexpectedly |
retentionModalLogic.ts |
!== undefined |
Group queries misidentified |
funnelPathsExpansionLogic.ts |
!= undefined |
Funnel paths incorrectly disabled |
cleanFilters.ts |
!= undefined |
Filter cleaning changes |
Fix
Replace !== undefined / != undefined with != null (which catches both null and undefined) or use explicit != null checks. Then update the Python normalization to always set the field, and backfill existing flags.
Steps
- Fix all frontend
!== undefinedchecks foraggregation_group_type_indexto use!= null - Update
posthog/api/feature_flag.pynormalization to always set the field (remove theis not Noneguard) - Backfill existing person-aggregated flags to have explicit
aggregation_group_type_index: nullon each condition set
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the listed frontend files, including relatedFeatureFlagsLogic.ts, experimentLogic.tsx, featureFlagLogic.ts, FunnelsAdvanced.tsx, and the filter and funnel logic files, then inspect posthog/api/feature_flag.py. Update the null checks, make normalization always set the field, and backfill existing person-aggregated flags so every condition set has an explicit null value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, typescript
- Domain
- backend, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100