Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

revert(feature-flags): mixed user/group targeting local eval warning (#57575)

Dylan Martind5d016b53602
diff --git a/frontend/src/scenes/feature-flags/FeatureFlag.tsx b/frontend/src/scenes/feature-flags/FeatureFlag.tsx
index 3c3782360d85..d646d376dbb9 100644
--- a/frontend/src/scenes/feature-flags/FeatureFlag.tsx
+++ b/frontend/src/scenes/feature-flags/FeatureFlag.tsx
@@ -1128,7 +1128,6 @@ function FeatureFlagRollout({
<>
<FeatureFlagConditionWarning
properties={properties}
- filterGroups={filterGroups}
evaluationRuntime={featureFlag.evaluation_runtime}
/>
<div className="flex flex-col">
diff --git a/frontend/src/scenes/feature-flags/FeatureFlagConditionWarning.tsx b/frontend/src/scenes/feature-flags/FeatureFlagConditionWarning.tsx
index 2ab9a19e8e28..8b5320014933 100644
--- a/frontend/src/scenes/feature-flags/FeatureFlagConditionWarning.tsx
+++ b/frontend/src/scenes/feature-flags/FeatureFlagConditionWarning.tsx
@@ -4,24 +4,22 @@ import { IconInfo } from '@posthog/icons'
import { Link } from 'lib/lemon-ui/Link'
-import { AnyPropertyFilter, FeatureFlagEvaluationRuntime, FeatureFlagGroupType } from '~/types'
+import { AnyPropertyFilter, FeatureFlagEvaluationRuntime } from '~/types'
import { featureFlagConditionWarningLogic } from './featureFlagConditionWarningLogic'
export interface FeatureFlagConditionWarningProps {
evaluationRuntime?: FeatureFlagEvaluationRuntime
properties: AnyPropertyFilter[]
- filterGroups?: FeatureFlagGroupType[]
className?: string
}
export function FeatureFlagConditionWarning({
properties,
- filterGroups,
className,
evaluationRuntime = FeatureFlagEvaluationRuntime.ALL,
}: FeatureFlagConditionWarningProps): JSX.Element | null {
- const { warning } = useValues(featureFlagConditionWarningLogic({ properties, evaluationRuntime, filterGroups }))
+ const { warning } = useValues(featureFlagConditionWarningLogic({ properties, evaluationRuntime }))
if (!warning) {
return null
diff --git a/frontend/src/scenes/feature-flags/FeatureFlagInstructions.tsx b/frontend/src/scenes/feature-flags/FeatureFlagInstructions.tsx
index 2f59b0e9a991..58b074d4289f 100644
--- a/frontend/src/scenes/feature-flags/FeatureFlagInstructions.tsx
+++ b/frontend/src/scenes/feature-flags/FeatureFlagInstructions.tsx
@@ -93,7 +93,6 @@ export function CodeInstructions({
const { warning: localEvalWarning } = useValues(
featureFlagConditionWarningLogic({
properties: allProperties,
- filterGroups: featureFlag?.filters?.groups,
evaluationRuntime: featureFlag?.evaluation_runtime ?? FeatureFlagEvaluationRuntime.ALL,
})
)
diff --git a/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditions.tsx b/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditions.tsx
index 6cfd0d18e492..4c7ce53966f9 100644
--- a/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditions.tsx
+++ b/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditions.tsx
@@ -290,7 +290,6 @@ export function FeatureFlagReleaseConditions({
{!readOnly && (
<FeatureFlagConditionWarning
properties={properties}
- filterGroups={filterGroups}
evaluationRuntime={evaluationRuntime}
className="mt-3 mb-3"
/>
diff --git a/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsCollapsible.tsx b/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsCollapsible.tsx
index ca0a9effb337..bd0a9fd94ac2 100644
--- a/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsCollapsible.tsx
+++ b/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsCollapsible.tsx
@@ -949,11 +949,7 @@ export function FeatureFlagReleaseConditionsCollapsible({
</LemonBanner>
)}
- <FeatureFlagConditionWarning
- properties={properties}
- filterGroups={filterGroups}
- evaluationRuntime={evaluationRuntime}
- />
+ <FeatureFlagConditionWarning properties={properties} evaluationRuntime={evaluationRuntime} />
{flagId && <IntentWarningsBanner flagId={flagId} />}
diff --git a/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsReadonly.tsx b/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsReadonly.tsx
index f148af865a65..bd8315c67787 100644
--- a/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsReadonly.tsx
+++ b/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsReadonly.tsx
@@ -125,11 +125,7 @@ export function FeatureFlagReleaseConditionsReadonly({
Condition sets are evaluated top to bottom — the first match wins.
</p>
- <FeatureFlagConditionWarning
- properties={properties}
- filterGroups={filterGroups}
- evaluationRuntime={evaluationRuntime}
- />
+ <FeatureFlagConditionWarning properties={properties} evaluationRuntime={evaluationRuntime} />
<div className={isDisabled ? 'opacity-60' : ''}>
{filterGroups.map((group, index) => (
diff --git a/frontend/src/scenes/feature-flags/featureFlagConditionWarningLogic.test.ts b/frontend/src/scenes/feature-flags/featureFlagConditionWarningLogic.test.ts
index 700e99cfda42..da4a39f2ef80 100644
--- a/frontend/src/scenes/feature-flags/featureFlagConditionWarningLogic.test.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagConditionWarningLogic.test.ts
@@ -2,13 +2,7 @@ import { expectLogic } from 'kea-test-utils'
import { cohortsModel } from '~/models/cohortsModel'
import { initKeaTests } from '~/test/init'
-import {
- AnyPropertyFilter,
- FeatureFlagEvaluationRuntime,
- FeatureFlagGroupType,
- PropertyFilterType,
- PropertyOperator,
-} from '~/types'
+import { AnyPropertyFilter, FeatureFlagEvaluationRuntime, PropertyFilterType, PropertyOperator } from '~/types'
import { featureFlagConditionWarningLogic } from './featureFlagConditionWarningLogic'
@@ -31,7 +25,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.CLIENT,
- filterGroups: undefined,
})
logic.mount()
@@ -55,7 +48,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -83,7 +75,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -96,7 +87,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties: [],
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -120,7 +110,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -142,7 +131,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -166,7 +154,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -188,7 +175,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -215,7 +201,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -240,7 +225,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -264,7 +248,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -299,7 +282,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -330,7 +312,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -358,7 +339,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -382,7 +362,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.ALL,
- filterGroups: undefined,
})
logic.mount()
@@ -406,7 +385,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -439,7 +417,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -459,7 +436,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -490,7 +466,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -498,57 +473,6 @@ describe('featureFlagConditionWarningLogic', () => {
})
})
- describe('server runtime - mixed user/group targeting', () => {
- const groupWithAggregation = (index: number | null): FeatureFlagGroupType => ({
- properties: [],
- rollout_percentage: 100,
- variant: null,
- aggregation_group_type_index: index,
- })
-
- it.each([
- {
- name: 'warns when groups have different aggregation_group_type_index values on SERVER runtime',
- aggregations: [null, 0],
- evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- expectedWarning: 'mixed user and group targeting',
- },
- {
- name: 'warns on ALL runtime with mixed aggregations',
- aggregations: [null, 0],
- evaluationRuntime: FeatureFlagEvaluationRuntime.ALL,
- expectedWarning: 'mixed user and group targeting',
- },
- {
- name: 'does not warn when all groups share the same aggregation (user-level)',
- aggregations: [null, null],
- evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- expectedWarning: undefined,
- },
- {
- name: 'does not warn when all groups share the same aggregation (group-level)',
- aggregations: [0, 0],
- evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- expectedWarning: undefined,
- },
- {
- name: 'does not warn for client-only runtime even with mixed targeting',
- aggregations: [null, 0],
- evaluationRuntime: FeatureFlagEvaluationRuntime.CLIENT,
- expectedWarning: undefined,
- },
- ])('$name', ({ aggregations, evaluationRuntime, expectedWarning }) => {
- const logic = featureFlagConditionWarningLogic({
- properties: [],
- filterGroups: aggregations.map(groupWithAggregation),
- evaluationRuntime,
- })
- logic.mount()
-
- expectLogic(logic).toMatchValues({ warning: expectedWarning })
- })
- })
-
describe('edge cases', () => {
it('handles regex patterns that look like but are not unsupported features', () => {
const properties: AnyPropertyFilter[] = [
@@ -563,7 +487,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -585,7 +508,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
@@ -607,7 +529,6 @@ describe('featureFlagConditionWarningLogic', () => {
const logic = featureFlagConditionWarningLogic({
properties,
evaluationRuntime: FeatureFlagEvaluationRuntime.SERVER,
- filterGroups: undefined,
})
logic.mount()
diff --git a/frontend/src/scenes/feature-flags/featureFlagConditionWarningLogic.ts b/frontend/src/scenes/feature-flags/featureFlagConditionWarningLogic.ts
index a6c6ca937fda..4686c3bde7b6 100644
--- a/frontend/src/scenes/feature-flags/featureFlagConditionWarningLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagConditionWarningLogic.ts
@@ -3,20 +3,13 @@ import { connect, kea, key, path, props, selectors } from 'kea'
import { isPropertyFilterWithOperator } from 'lib/components/PropertyFilters/utils'
import { cohortsModel } from '~/models/cohortsModel'
-import {
- AnyPropertyFilter,
- CohortType,
- FeatureFlagEvaluationRuntime,
- FeatureFlagGroupType,
- PropertyFilterType,
-} from '~/types'
+import { AnyPropertyFilter, CohortType, FeatureFlagEvaluationRuntime, PropertyFilterType } from '~/types'
import type { featureFlagConditionWarningLogicType } from './featureFlagConditionWarningLogicType'
export interface FeatureFlagConditionWarningLogicProps {
properties: AnyPropertyFilter[]
evaluationRuntime: FeatureFlagEvaluationRuntime
- filterGroups: FeatureFlagGroupType[] | undefined
}
const REGEX_LOOKAHEAD = /(?<!\\)\(\?[=!]/ // (?= or (?!
@@ -25,20 +18,19 @@ const REGEX_BACKREFERENCE = /(?<!\\)\\[1-9]/ // \1 through \9
export const featureFlagConditionWarningLogic = kea<featureFlagConditionWarningLogicType>([
path(['scenes', 'feature-flags', 'featureFlagConditionWarningLogic']),
- props({ filterGroups: undefined } as FeatureFlagConditionWarningLogicProps),
- key((props) => JSON.stringify({ properties: props.properties, filterGroups: props.filterGroups })),
+ props({} as FeatureFlagConditionWarningLogicProps),
+ key((props) => JSON.stringify(props.properties)),
connect(() => ({
values: [cohortsModel, ['cohortsById']],
})),
selectors({
warning: [
- (s, p) => [s.cohortsById, p.properties, p.evaluationRuntime, p.filterGroups],
+ (s, p) => [s.cohortsById, p.properties, p.evaluationRuntime],
(
cohortsById: Partial<Record<string | number, CohortType>>,
properties: AnyPropertyFilter[],
- evaluationRuntime: FeatureFlagEvaluationRuntime,
- filterGroups: FeatureFlagGroupType[] | undefined
+ evaluationRuntime: FeatureFlagEvaluationRuntime
): string | undefined => {
// Local evaluation is only relevant for server-side SDKs, so only show the warning
// for flags that can be evaluated server-side (ALL or SERVER)
@@ -48,13 +40,6 @@ export const featureFlagConditionWarningLogic = kea<featureFlagConditionWarningL
const issues: string[] = []
- if (filterGroups && filterGroups.length > 1) {
- const aggregations = filterGroups.map((g) => g.aggregation_group_type_index ?? null)
- if (!aggregations.every((a) => a === aggregations[0])) {
- issues.push('mixed user and group targeting')
- }
- }
-
properties.forEach((property) => {
if (isPropertyFilterWithOperator(property) && property.operator === 'is_not_set') {
issues.push('is_not_set operator')
diff --git a/frontend/src/scenes/feature-flags/featureFlagIntentWarningLogic.test.ts b/frontend/src/scenes/feature-flags/featureFlagIntentWarningLogic.test.ts
index ff54c77835a9..7d99bde1fde7 100644
--- a/frontend/src/scenes/feature-flags/featureFlagIntentWarningLogic.test.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagIntentWarningLogic.test.ts
@@ -298,66 +298,6 @@ describe('featureFlagIntentWarningLogic', () => {
expect(issues.filter((s) => s.includes('"is not set"'))).toHaveLength(1)
})
- it('detects mixed user and group targeting across condition groups', async () => {
- enableIntentsFeatureFlag()
-
- flagLogic.actions.setFlagIntent('local-eval')
- flagLogic.actions.setFeatureFlag({
- ...NEW_FLAG,
- filters: {
- ...NEW_FLAG.filters,
- aggregation_group_type_index: null,
- groups: [
- {
- properties: [] as AnyPropertyFilter[],
- rollout_percentage: 100,
- variant: null,
- aggregation_group_type_index: null,
- },
- {
- properties: [] as AnyPropertyFilter[],
- rollout_percentage: 100,
- variant: null,
- aggregation_group_type_index: 0,
- },
- ] as FeatureFlagGroupType[],
- },
- })
-
- const issues = warningLogic.values.intentIssues
- expect(issues.some((s) => s.toLowerCase().includes('mixed user and group targeting'))).toBe(true)
- })
-
- it('does not flag mixed targeting when all groups share the same aggregation', async () => {
- enableIntentsFeatureFlag()
-
- flagLogic.actions.setFlagIntent('local-eval')
- flagLogic.actions.setFeatureFlag({
- ...NEW_FLAG,
- filters: {
- ...NEW_FLAG.filters,
- aggregation_group_type_index: null,
- groups: [
- {
- properties: [] as AnyPropertyFilter[],
- rollout_percentage: 100,
- variant: null,
- aggregation_group_type_index: null,
- },
- {
- properties: [] as AnyPropertyFilter[],
- rollout_percentage: 100,
- variant: null,
- aggregation_group_type_index: null,
- },
- ] as FeatureFlagGroupType[],
- },
- })
-
- const issues = warningLogic.values.intentIssues
- expect(issues.some((s) => s.toLowerCase().includes('mixed user and group targeting'))).toBe(false)
- })
-
it('experience continuity adds an issue', async () => {
enableIntentsFeatureFlag()
diff --git a/frontend/src/scenes/feature-flags/featureFlagIntentWarningLogic.ts b/frontend/src/scenes/feature-flags/featureFlagIntentWarningLogic.ts
index 0194db4c4221..5c3da22f9004 100644
--- a/frontend/src/scenes/feature-flags/featureFlagIntentWarningLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagIntentWarningLogic.ts
@@ -117,14 +117,6 @@ export const featureFlagIntentWarningLogic = kea<featureFlagIntentWarningLogicTy
)
}
- const aggregationIndices = groups.map((g) => g.aggregation_group_type_index ?? null)
- if (
- aggregationIndices.length > 1 &&
- !aggregationIndices.every((a) => a === aggregationIndices[0])
- ) {
- issues.add('Mixed user and group targeting is not currently supported by local evaluation')
- }
-
for (const group of groups) {
for (const property of group.properties || []) {
if (property.type === PropertyFilterType.Cohort) {