: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(feature-flags): explain condition matching (#122049)
Paul D'Ambra71337ce956c2
diff --git a/frontend/src/lib/components/PropertyFilters/PropertyFilters.test.tsx b/frontend/src/lib/components/PropertyFilters/PropertyFilters.test.tsxindex cb06abe89938..1cefe8264a5b 100644--- a/frontend/src/lib/components/PropertyFilters/PropertyFilters.test.tsx+++ b/frontend/src/lib/components/PropertyFilters/PropertyFilters.test.tsx@@ -84,6 +84,18 @@ describe('PropertyFilters', () => {operator: PropertyOperator.Exact,} as const+ it('shows the logical divider tooltip on click', async () => {+ renderPropertyFilters({+ propertyFilters: [BROWSER_FILTER, OS_FILTER],+ logicalRowDivider: true,+ logicalRowDividerTooltip: 'Every filter in this condition set must match.',+ })++ await userEvent.click(screen.getByText('AND'))++ expect(await screen.findByText('Every filter in this condition set must match.')).toBeInTheDocument()+ })+const splitControls: PropertyFiltersProps['renderControls'] = ({ addFilter, activeFilters }) => (<div><div>{addFilter}</div>diff --git a/frontend/src/lib/components/PropertyFilters/PropertyFilters.tsx b/frontend/src/lib/components/PropertyFilters/PropertyFilters.tsxindex 6fc7fa293095..8a991a911e95 100644--- a/frontend/src/lib/components/PropertyFilters/PropertyFilters.tsx+++ b/frontend/src/lib/components/PropertyFilters/PropertyFilters.tsx@@ -45,6 +45,7 @@ export interface PropertyFiltersProps {schemaColumns?: DatabaseSchemaField[]dataWarehouseTableName?: stringlogicalRowDivider?: boolean+ logicalRowDividerTooltip?: stringorFiltering?: booleanpropertyGroupType?: FilterLogicalOperator | nulladdText?: string | null@@ -110,6 +111,7 @@ export function PropertyFilters({dataWarehouseTableName,orFiltering = false,logicalRowDivider = false,+ logicalRowDividerTooltip,propertyGroupType = null,addText = null,buttonText = 'Filter',@@ -170,7 +172,10 @@ export function PropertyFilters({return (<React.Fragment key={displayedFilterIds[index]}>{logicalRowDivider && index > 0 && index !== displayedFilters.length - 1 && (- <LogicalRowDivider logicalOperator={propertyGroupType ?? FilterLogicalOperator.And} />+ <LogicalRowDivider+ logicalOperator={propertyGroupType ?? FilterLogicalOperator.And}+ tooltip={logicalRowDividerTooltip}+ />)}{addFilterDivider &&showNewFilterRow &&diff --git a/frontend/src/scenes/cohorts/CohortFilters/CohortCriteriaRowBuilder.tsx b/frontend/src/scenes/cohorts/CohortFilters/CohortCriteriaRowBuilder.tsxindex 6fd25f4794de..9c05411e27bc 100644--- a/frontend/src/scenes/cohorts/CohortFilters/CohortCriteriaRowBuilder.tsx+++ b/frontend/src/scenes/cohorts/CohortFilters/CohortCriteriaRowBuilder.tsx@@ -5,7 +5,7 @@ import { useActions, useValues } from 'kea'import { Field as KeaField } from 'kea-forms'import { IconCopy, IconTrash } from '@posthog/icons'-import { LemonDivider } from '@posthog/lemon-ui'+import { LemonDivider, Tooltip } from '@posthog/lemon-ui'import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'import { eventsWithMoveNotice, moveAnnouncementUrl } from 'lib/components/TaxonomicFilter/utils/hiddenEvents'@@ -206,8 +206,16 @@ export function CohortCriteriaRowBuilder({export interface LogicalRowDividerProps {logicalOperator: FilterLogicalOperator+ tooltip?: string}-export function LogicalRowDivider({ logicalOperator }: LogicalRowDividerProps): JSX.Element {- return <LemonDivider className="logical-row-divider my-4" label={logicalOperator} />+export function LogicalRowDivider({ logicalOperator, tooltip }: LogicalRowDividerProps): JSX.Element {+ const label = tooltip ? (+ <Tooltip title={tooltip} openOnClick placement="right">+ <span tabIndex={0}>{logicalOperator}</span>+ </Tooltip>+ ) : (+ logicalOperator+ )+ return <LemonDivider className="logical-row-divider my-4" label={label} />}diff --git a/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditions.tsx b/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditions.tsxindex 1117c808fdc6..335ebb70e45b 100644--- a/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditions.tsx+++ b/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditions.tsx@@ -50,7 +50,11 @@ import { FractionalRolloutWarning } from 'products/feature_flags/frontend/Fractiimport { resolveAggregationGroupTypeIndex } from './aggregation'import { BlastRadiusErrorMessage } from './BlastRadiusErrorMessage'import { BlastRadiusSkeleton } from './BlastRadiusSkeleton'-import { EARLY_ACCESS_GROUP_TARGETING_DISABLED_REASON, MATCHING_ESTIMATE_TOOLTIP } from './constants'+import {+ CONDITION_SET_LOGICAL_OPERATOR_TOOLTIP,+ EARLY_ACCESS_GROUP_TARGETING_DISABLED_REASON,+ MATCHING_ESTIMATE_TOOLTIP,+} from './constants'import { featureFlagLogic } from './featureFlagLogic'import {FeatureFlagReleaseConditionsLogicProps,@@ -358,6 +362,7 @@ export function FeatureFlagReleaseConditions({}`}propertyFilters={withResolvedFlagLabels(group?.properties, getFlagKey)}logicalRowDivider+ logicalRowDividerTooltip={CONDITION_SET_LOGICAL_OPERATOR_TOOLTIP}addText="Add condition"onChange={(properties) => updateConditionSet(index, undefined, properties)}taxonomicGroupTypes={taxonomicGroupTypes}diff --git a/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsCollapsible.tsx b/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsCollapsible.tsxindex 87d947a4dff1..52dc5d4644e1 100644--- a/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsCollapsible.tsx+++ b/frontend/src/scenes/feature-flags/FeatureFlagReleaseConditionsCollapsible.tsx@@ -75,7 +75,11 @@ import { FractionalRolloutWarning } from 'products/feature_flags/frontend/Fractiimport { resolveAggregationGroupTypeIndex } from './aggregation'import { BlastRadiusErrorMessage } from './BlastRadiusErrorMessage'import { BlastRadiusSkeleton } from './BlastRadiusSkeleton'-import { EARLY_ACCESS_GROUP_TARGETING_DISABLED_REASON, MATCHING_ESTIMATE_TOOLTIP } from './constants'+import {+ CONDITION_SET_LOGICAL_OPERATOR_TOOLTIP,+ EARLY_ACCESS_GROUP_TARGETING_DISABLED_REASON,+ MATCHING_ESTIMATE_TOOLTIP,+} from './constants'import { EarlyExitIndicator } from './EarlyExitIndicator'import { FeatureFlagConditionDragHandle } from './FeatureFlagConditionDragHandle'import { FeatureFlagConditionWarning } from './FeatureFlagConditionWarning'@@ -641,6 +645,7 @@ const ConditionContent = ({pageKey={`feature-flag-workflow-${id}-${group.sort_key!}`}propertyFilters={withResolvedFlagLabels(group?.properties, getFlagKey)}logicalRowDivider+ logicalRowDividerTooltip={CONDITION_SET_LOGICAL_OPERATOR_TOOLTIP}addText="Add filter"onChange={(properties) => {updateConditionSet(index, undefined, properties)diff --git a/frontend/src/scenes/feature-flags/constants.tsx b/frontend/src/scenes/feature-flags/constants.tsxindex eb002b3efdec..b0c5cd084d89 100644--- a/frontend/src/scenes/feature-flags/constants.tsx+++ b/frontend/src/scenes/feature-flags/constants.tsx@@ -6,6 +6,9 @@ export const COHORT_BEHAVIORAL_LIMITATIONS_URL =export const EARLY_ACCESS_GROUP_TARGETING_DISABLED_REASON ='This flag is linked to an early access feature, so it can only target users. Remove the early access feature to target groups.'+export const CONDITION_SET_LOGICAL_OPERATOR_TOOLTIP =+ 'Filters within a group are combined with AND. To use OR, add another group.'+export const MATCHING_ESTIMATE_TOOLTIP = (<><div>