: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(flags): hide $feature_flag_called in pickers past events mode (#111148)
Phil Haackf065bacd6681
diff --git a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.test.tsx b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.test.tsxindex e654448cf88e..2bdaaae58e65 100644--- a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.test.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.test.tsx@@ -1,3 +1,5 @@+import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'+import '@testing-library/jest-dom'import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'@@ -5,9 +7,9 @@ import userEvent from '@testing-library/user-event'import { Provider, getContext } from 'kea'import posthog from 'posthog-js'-import { FEATURE_FLAGS } from 'lib/constants'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { teamLogic } from 'scenes/teamLogic'+import { FlagEvaluationsModeEnumApi } from '~/generated/core/api.schemas'import { useMocks } from '~/mocks/jest'import { MockResolverInfo } from '~/mocks/utils'import { actionsModel } from '~/models/actionsModel'@@ -44,6 +46,10 @@ jest.mock('lib/components/AutoSizer', () => ({},}))+function setFlagEvaluationsMode(mode: FlagEvaluationsModeEnumApi): void {+ teamLogic.actions.loadCurrentTeamSuccess({ ...MOCK_DEFAULT_TEAM, flag_evaluations_mode: mode })+}+describe('TaxonomicFilter', () => {let onChangeMock: jest.Mocklet onCloseMock: jest.Mock@@ -544,19 +550,8 @@ describe('TaxonomicFilter', () => {// reporting "no results" tells someone who knows the event exists that it never did.// The rebuild's half of this lives in menu/Combobox.test.tsx.describe('an event hidden because its data is moving', () => {- let unmountFeatureFlagLogic: (() => void) | null = null-beforeEach(() => {- unmountFeatureFlagLogic = featureFlagLogic.mount()- featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.HIDE_EVENTS_IN_QUERY_BUILDERS], {- [FEATURE_FLAGS.HIDE_EVENTS_IN_QUERY_BUILDERS]: true,- })- })-- afterEach(() => {- featureFlagLogic.actions.setFeatureFlags([], {})- unmountFeatureFlagLogic?.()- unmountFeatureFlagLogic = null+ setFlagEvaluationsMode(FlagEvaluationsModeEnumApi.Number1)})it('explains the absence instead of reporting no results', async () => {@@ -592,8 +587,8 @@ describe('TaxonomicFilter', () => {})})- it('reports no results as usual once the kill switch is off', async () => {- featureFlagLogic.actions.setFeatureFlags([], {})+ it('reports no results as usual for a team on the Events mode', async () => {+ setFlagEvaluationsMode(FlagEvaluationsModeEnumApi.Number0)renderFilter({ taxonomicGroupTypes: [TaxonomicFilterGroupType.Events] })await activateGroupWithResults('taxonomic-tab-events')@@ -607,9 +602,8 @@ describe('TaxonomicFilter', () => {expect(screen.queryByTestId('taxonomic-hidden-event')).not.toBeInTheDocument()})- // A picker on a live-event surface (the survey and product-tour event triggers, live- // events, ingestion triggers) opts in with `includeHiddenEvents`, so the flag must not- // hide the event or explain an absence there.+ // Live-event surfaces (the survey and product-tour event triggers, live events, ingestion+ // triggers) opt in with `includeHiddenEvents`.it('keeps offering the event when the picker opts in', async () => {renderFilter({ taxonomicGroupTypes: [TaxonomicFilterGroupType.Events], includeHiddenEvents: true })diff --git a/frontend/src/lib/components/TaxonomicFilter/hooks/useTaxonomicFilter.test.tsx b/frontend/src/lib/components/TaxonomicFilter/hooks/useTaxonomicFilter.test.tsxindex cbc5aad869be..9ebfcbe4e5c4 100644--- a/frontend/src/lib/components/TaxonomicFilter/hooks/useTaxonomicFilter.test.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/hooks/useTaxonomicFilter.test.tsx@@ -1,10 +1,12 @@+import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'+import { act, cleanup, renderHook } from '@testing-library/react'import { Provider } from 'kea'import { ReactNode } from 'react'-import { FEATURE_FLAGS } from 'lib/constants'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { teamLogic } from 'scenes/teamLogic'+import { FlagEvaluationsModeEnumApi } from '~/generated/core/api.schemas'import { useMocks } from '~/mocks/jest'import { actionsModel } from '~/models/actionsModel'import { groupsModel } from '~/models/groupsModel'@@ -51,9 +53,11 @@ describe('useTaxonomicFilter', () => {describe('events whose data is moving out of the events table', () => {const HIDDEN_EVENT = '$feature_flag_called'- const renderFilter = (input: Record<string, any> = {}): ReturnType<typeof useTaxonomicFilter> => {- featureFlagLogic.mount()- featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.HIDE_EVENTS_IN_QUERY_BUILDERS]: true })+ const renderFilter = (+ input: Record<string, any> = {},+ mode: FlagEvaluationsModeEnumApi = FlagEvaluationsModeEnumApi.Number1+ ): ReturnType<typeof useTaxonomicFilter> => {+ teamLogic.actions.loadCurrentTeamSuccess({ ...MOCK_DEFAULT_TEAM, flag_evaluations_mode: mode })const { result } = renderHook(() => useTaxonomicFilter({ taxonomicGroupTypes: [TaxonomicFilterGroupType.Events], ...input }),{ wrapper }@@ -61,15 +65,22 @@ describe('useTaxonomicFilter', () => {return result.current}- const eventsGroupExclusions = (input: Record<string, any> = {}): (string | null)[] =>- renderFilter(input).groups.find((g) => g.type === TaxonomicFilterGroupType.Events)?.excludedProperties ?? []+ const eventsGroupExclusions = (+ input: Record<string, any> = {},+ mode?: FlagEvaluationsModeEnumApi+ ): (string | null)[] =>+ renderFilter(input, mode).groups.find((g) => g.type === TaxonomicFilterGroupType.Events)+ ?.excludedProperties ?? []it('hides them by default', () => {expect(eventsGroupExclusions()).toContain(HIDDEN_EVENT)})- it('offers them to a picker that opts out', () => {- expect(eventsGroupExclusions({ includeHiddenEvents: true })).not.toContain(HIDDEN_EVENT)+ it.each([+ ['a team on the Events mode', {}, FlagEvaluationsModeEnumApi.Number0],+ ['a picker that opts out', { includeHiddenEvents: true }, FlagEvaluationsModeEnumApi.Number1],+ ])('offers them to %s', (_label, input, mode) => {+ expect(eventsGroupExclusions(input, mode)).not.toContain(HIDDEN_EVENT)})// The Recent and Pinned tabs and the menu shortcut rows filter against this record ratherdiff --git a/frontend/src/lib/components/TaxonomicFilter/hooks/useTaxonomicFilter.ts b/frontend/src/lib/components/TaxonomicFilter/hooks/useTaxonomicFilter.tsindex 39e3fc0006ab..7dc0637ab1c8 100644--- a/frontend/src/lib/components/TaxonomicFilter/hooks/useTaxonomicFilter.ts+++ b/frontend/src/lib/components/TaxonomicFilter/hooks/useTaxonomicFilter.ts@@ -46,7 +46,6 @@ import { isQuickFilterItem } from 'lib/components/TaxonomicFilter/types'import { buildTaxonomicGroups } from 'lib/components/TaxonomicFilter/utils/buildTaxonomicGroups'import { isContainsShortcutItem } from 'lib/components/TaxonomicFilter/utils/collapsedContainsRow'import { withHiddenEventsExcluded } from 'lib/components/TaxonomicFilter/utils/hiddenEvents'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { MaxContextTaxonomicFilterOption } from 'scenes/max/maxTypes'import { teamLogic } from 'scenes/teamLogic'@@ -306,12 +305,13 @@ export function useTaxonomicFilter(opts: UseTaxonomicFilterOptions): TaxonomicFiexcludedOperators,} = opts- const { featureFlags } = useValues(featureFlagLogic)+ const { currentTeam } = useValues(teamLogic)+ const flagEvaluationsMode = currentTeam?.flag_evaluations_mode// Every surface below reads exclusions from this one record: the group builder, the Recent and// Pinned tabs, and the menu's shortcut rows. Folding the hidden names in here reaches all of them.const excludedProperties = useMemo(- () => withHiddenEventsExcluded(callerExcludedProperties, featureFlags, includeHiddenEvents),- [callerExcludedProperties, featureFlags, includeHiddenEvents]+ () => withHiddenEventsExcluded(callerExcludedProperties, flagEvaluationsMode, includeHiddenEvents),+ [callerExcludedProperties, flagEvaluationsMode, includeHiddenEvents])const ctx = useTaxonomicGroupsContext({diff --git a/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.test.ts b/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.test.tsindex 23fa9283c289..66a236b863be 100644--- a/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.test.ts+++ b/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.test.ts@@ -1,4 +1,4 @@-import { MOCK_TEAM_ID } from 'lib/api.mock'+import { MOCK_DEFAULT_TEAM, MOCK_TEAM_ID } from 'lib/api.mock'import { getContext } from 'kea'import { expectLogic, partial } from 'kea-test-utils'@@ -9,11 +9,11 @@ import {recentTaxonomicFiltersLogic,} from 'lib/components/TaxonomicFilter/recentTaxonomicFiltersLogic'import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'-import { FEATURE_FLAGS } from 'lib/constants'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { databaseTableListLogic } from 'scenes/data-management/database/databaseTableListLogic'import { dataWarehouseSettingsSceneLogic } from 'scenes/data-warehouse/settings/dataWarehouseSettingsSceneLogic'+import { teamLogic } from 'scenes/teamLogic'+import { FlagEvaluationsModeEnumApi } from '~/generated/core/api.schemas'import { resumeKeaLoadersErrors, silenceKeaLoadersErrors } from '~/initKea'import { useMocks } from '~/mocks/jest'import { Mocks } from '~/mocks/utils'@@ -40,6 +40,10 @@ const setTabHidden = (hidden: boolean): void => {document.dispatchEvent(new Event('visibilitychange'))}+function setFlagEvaluationsMode(mode: FlagEvaluationsModeEnumApi): void {+ teamLogic.actions.loadCurrentTeamSuccess({ ...MOCK_DEFAULT_TEAM, flag_evaluations_mode: mode })+}+describe('infiniteListLogic', () => {let logic: ReturnType<typeof infiniteListLogic.build>@@ -1158,15 +1162,11 @@ describe('infiniteListLogic', () => {describe('events a picker excludes', () => {const HIDDEN_EVENT = '$feature_flag_called'- afterEach(() => {- featureFlagLogic.actions.setFeatureFlags([], {})- })-// The Pinned and Recent tabs filter against the caller's record rather than the Events// group's own list, so the hidden names have to reach that record for a pin saved before// the event was hidden to drop.it('folds the hidden names into the record the Recent and Pinned tabs read', () => {- featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.HIDE_EVENTS_IN_QUERY_BUILDERS]: true })+ setFlagEvaluationsMode(FlagEvaluationsModeEnumApi.Number1)const listLogic = infiniteListLogic({taxonomicFilterLogicKey: 'hidden-events',listGroupType: TaxonomicFilterGroupType.Events,@@ -1211,14 +1211,10 @@ describe('infiniteListLogic', () => {// that allows uncaptured events must not offer any of those forms as "not seen yet" — that would// commit a name no event carries and hide the explanation of the event's absence.describe('the "not seen yet" option and hidden events', () => {- afterEach(() => {- featureFlagLogic.actions.setFeatureFlags([], {})- })-it.each([['$feature_flag_called'], ['$FEATURE_FLAG_CALLED'], ['Feature flag called']])('does not offer the option when searching %p',async (query) => {- featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.HIDE_EVENTS_IN_QUERY_BUILDERS]: true })+ setFlagEvaluationsMode(FlagEvaluationsModeEnumApi.Number1)const listLogic = infiniteListLogic({taxonomicFilterLogicKey: `hidden-not-seen-${query}`,listGroupType: TaxonomicFilterGroupType.Events,diff --git a/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts b/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.tsindex bd15fc60888f..286986386b4a 100644--- a/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts+++ b/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts@@ -64,16 +64,14 @@ import {filterPinnedForContext,filterRecentsForContext,} from 'lib/components/TaxonomicFilter/utils/suggestedContextFilters'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { createFuse } from 'lib/utils/fuseSearch'import { mapGroupQueryResponse } from 'lib/utils/groups'import { dashboardsModel } from '~/models/dashboardsModel'import { getCoreFilterDefinition } from '~/taxonomy/helpers'-import { CohortType, EventDefinition, GroupTypeIndex, PropertyType } from '~/types'+import { CohortType, EventDefinition, GroupTypeIndex, PropertyType, TeamPublicType, TeamType } from '~/types'import { teamLogic } from '../../../scenes/teamLogic'-import type { FeatureFlagsSet } from '../../logic/featureFlagLogic'import { getItemGroup } from './InfiniteList'import type { SelectItemMeta, TopMatchItem } from './taxonomicFilterLogic'@@ -260,7 +258,6 @@ async function fetchCachedListResponse(// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface infiniteListLogicValues {- featureFlags: FeatureFlagsSet // featureFlagLogicrecentFilterItems: TaxonomicDefinitionTypes[] // recentTaxonomicFiltersLogicactiveTab: TaxonomicFilterGroupType // taxonomicFilterLogicanyGroupLoading: boolean // taxonomicFilterLogic@@ -273,6 +270,7 @@ export interface infiniteListLogicValues {topMatchItemsWithSkeletons: (SkeletonItem | TopMatchItem)[] // taxonomicFilterLogicvalue: any // taxonomicFilterLogicpinnedFilterItems: TaxonomicDefinitionTypes[] // taxonomicFilterPinnedPropertiesLogic+ currentTeam: TeamPublicType | TeamType | null // teamLogiccurrentTeamId: number | null // teamLogicallowNonCapturedEvents: booleancontextFilteredPinnedItems: TaxonomicDefinitionTypes[]@@ -562,7 +560,7 @@ export interface infiniteListLogicMeta {) => booleanexcludedPropertiesWithHiddenEvents: (arg: import('lib/components/TaxonomicFilter/types').TaxonomicFilterGroupValueMap | undefined,- featureFlags: FeatureFlagsSet,+ currentTeam: TeamPublicType | TeamType | null,arg2: boolean | undefined) => ExcludedProperties | undefinedcontextFilteredRecentItems: (@@ -845,13 +843,11 @@ export const infiniteListLogic = kea<infiniteListLogicType>(['includeStaleEvents',],teamLogic,- ['currentTeamId'],+ ['currentTeam', 'currentTeamId'],recentTaxonomicFiltersLogic,['recentFilterItems'],taxonomicFilterPinnedPropertiesLogic,['pinnedFilterItems'],- featureFlagLogic,- ['featureFlags'],],actions: [taxonomicFilterLogic(props),@@ -1175,15 +1171,15 @@ export const infiniteListLogic = kea<infiniteListLogicType>([excludedPropertiesWithHiddenEvents: [(s) => [(_, props: InfiniteListLogicProps) => props.excludedProperties,- s.featureFlags,+ s.currentTeam,(_, props: InfiniteListLogicProps) => props.includeHiddenEvents,],(excludedProperties: ExcludedProperties | undefined,- featureFlags: FeatureFlagsSet,+ currentTeam: TeamPublicType | TeamType | null,includeHiddenEvents: boolean | undefined): ExcludedProperties | undefined =>- withHiddenEventsExcluded(excludedProperties, featureFlags, includeHiddenEvents),+ withHiddenEventsExcluded(excludedProperties, currentTeam?.flag_evaluations_mode, includeHiddenEvents),],contextFilteredRecentItems: [(s) => [diff --git a/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.test.tsx b/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.test.tsxindex a8a5605154ae..fb0f2ba0c513 100644--- a/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.test.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/menu/Combobox.test.tsx@@ -1,3 +1,5 @@+import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'+import '@testing-library/jest-dom'import { act, cleanup, render, screen, waitFor, within } from '@testing-library/react'@@ -5,9 +7,9 @@ import userEvent from '@testing-library/user-event'import { Provider } from 'kea'import { useState } from 'react'-import { FEATURE_FLAGS } from 'lib/constants'-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { teamLogic } from 'scenes/teamLogic'+import { FlagEvaluationsModeEnumApi } from '~/generated/core/api.schemas'import { useMocks } from '~/mocks/jest'import { actionsModel } from '~/models/actionsModel'import { groupsModel } from '~/models/groupsModel'@@ -109,6 +111,10 @@ async function openedCategoryPopup(): Promise<HTMLElement> {})}+function setFlagEvaluationsMode(mode: FlagEvaluationsModeEnumApi): void {+ teamLogic.actions.loadCurrentTeamSuccess({ ...MOCK_DEFAULT_TEAM, flag_evaluations_mode: mode })+}+describe('MenuFilterCombobox', () => {beforeEach(() => {__clearTaxonomicResourceCache()@@ -1141,20 +1147,9 @@ describe('MenuFilterCombobox', () => {// Parity with the legacy picker, whose half lives in TaxonomicFilter.test.tsx. Nothing enforces// that the two agree, so the same rule is asserted on both.describe('an event hidden because its data is moving', () => {- let unmountFeatureFlagLogic: (() => void) | null = null-beforeEach(() => {apiGet.mockResolvedValue({ results: [], count: 0 })- unmountFeatureFlagLogic = featureFlagLogic.mount()- featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.HIDE_EVENTS_IN_QUERY_BUILDERS], {- [FEATURE_FLAGS.HIDE_EVENTS_IN_QUERY_BUILDERS]: true,- })- })-- afterEach(() => {- featureFlagLogic.actions.setFeatureFlags([], {})- unmountFeatureFlagLogic?.()- unmountFeatureFlagLogic = null+ setFlagEvaluationsMode(FlagEvaluationsModeEnumApi.Number1)})it('explains the absence, and drops recovery buttons that cannot recover it', async () => {@@ -1169,8 +1164,8 @@ describe('MenuFilterCombobox', () => {expect(screen.queryByTestId('menu-filter-check-other-categories')).not.toBeInTheDocument()})- it('reports no matches as usual once the kill switch is off', async () => {- featureFlagLogic.actions.setFeatureFlags([], {})+ it('reports no matches as usual for a team on the Events mode', async () => {+ setFlagEvaluationsMode(FlagEvaluationsModeEnumApi.Number0)renderAll({groupTypes: [TaxonomicFilterGroupType.Events],diff --git a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.test.ts b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.test.tsindex 930f22133063..2758dec3f01d 100644--- a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.test.ts+++ b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.test.ts@@ -1,4 +1,4 @@-import { MOCK_TEAM_ID } from 'lib/api.mock'+import { MOCK_DEFAULT_TEAM, MOCK_TEAM_ID } from 'lib/api.mock'import { getContext } from 'kea'import { expectLogic } from 'kea-test-utils'@@ -17,9 +17,10 @@ import {} from 'lib/components/TaxonomicFilter/taxonomicFilterLogic'import { TaxonomicFilterGroupType, TaxonomicFilterLogicProps } from 'lib/components/TaxonomicFilter/types'import { getMCPPropertyFilterOptions } from 'lib/components/TaxonomicFilter/utils/mcpProperties'-import { FEATURE_FLAGS } from 'lib/constants'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { teamLogic } from 'scenes/teamLogic'+import { FlagEvaluationsModeEnumApi } from '~/generated/core/api.schemas'import { useMocks } from '~/mocks/jest'import { actionsModel } from '~/models/actionsModel'import { dashboardsModel } from '~/models/dashboardsModel'@@ -1004,14 +1005,11 @@ describe('taxonomicFilterLogic', () => {describe('events whose data is moving out of the events table', () => {const HIDDEN_EVENT = '$feature_flag_called'- afterEach(() => {- featureFlagLogic.actions.setFeatureFlags([], {})- })-- const eventsGroupExclusions = (props: Record<string, any>): (string | null)[] => {- featureFlagLogic.actions.setFeatureFlags([], {- [FEATURE_FLAGS.HIDE_EVENTS_IN_QUERY_BUILDERS]: true,- })+ const eventsGroupExclusions = (+ props: Record<string, any>,+ mode: FlagEvaluationsModeEnumApi = FlagEvaluationsModeEnumApi.Number1+ ): (string | null)[] => {+ teamLogic.actions.loadCurrentTeamSuccess({ ...MOCK_DEFAULT_TEAM, flag_evaluations_mode: mode })const testLogic = taxonomicFilterLogic({taxonomicFilterLogicKey: `hidden-events-${JSON.stringify(props)}`,taxonomicGroupTypes: [TaxonomicFilterGroupType.Events],@@ -1031,8 +1029,11 @@ describe('taxonomicFilterLogic', () => {expect(eventsGroupExclusions({})).toContain(HIDDEN_EVENT)})- it('offers them to a picker that opts out', () => {- expect(eventsGroupExclusions({ includeHiddenEvents: true })).not.toContain(HIDDEN_EVENT)+ it.each([+ ['a team on the Events mode', {}, FlagEvaluationsModeEnumApi.Number0],+ ['a picker that opts out', { includeHiddenEvents: true }, FlagEvaluationsModeEnumApi.Number1],+ ])('offers them to %s', (_label, props, mode) => {+ expect(eventsGroupExclusions(props, mode)).not.toContain(HIDDEN_EVENT)})// Cohorts exclude "All events" and transformations exclude $exception; adding ours must notdiff --git a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsxindex 6eafe47371df..74940df641f9 100644--- a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx@@ -1219,7 +1219,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([}).url,excludedProperties: [...(excludedProperties?.[TaxonomicFilterGroupType.Events]?.filter(isString) ?? []),- ...hiddenEventNames(featureFlags, includeHiddenEvents),+ ...hiddenEventNames(currentTeam?.flag_evaluations_mode, includeHiddenEvents),],...withKeywordShortcuts<Record<string, any>>({diff --git a/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx b/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsxindex 2c013a42cbcc..390a55e17b8f 100644--- a/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/utils/buildTaxonomicGroups.tsx@@ -231,7 +231,7 @@ export function buildTaxonomicGroups(ctx: BuildTaxonomicGroupsContext): TaxonomiexcludedProperties: [...new Set([...(excludedProperties?.[TaxonomicFilterGroupType.Events]?.filter(isString) ?? []),- ...hiddenEventNames(featureFlags, includeHiddenEvents),+ ...hiddenEventNames(currentTeam?.flag_evaluations_mode, includeHiddenEvents),]),],...withKeywordShortcuts<Record<string, any>>(diff --git a/frontend/src/lib/components/TaxonomicFilter/utils/hiddenEvents.test.ts b/frontend/src/lib/components/TaxonomicFilter/utils/hiddenEvents.test.tsindex 7232822d5b92..504e102e9e49 100644--- a/frontend/src/lib/components/TaxonomicFilter/utils/hiddenEvents.test.ts+++ b/frontend/src/lib/components/TaxonomicFilter/utils/hiddenEvents.test.ts@@ -4,34 +4,43 @@ import {hiddenEventNames,withHiddenEventsExcluded,} from 'lib/components/TaxonomicFilter/utils/hiddenEvents'-import { FEATURE_FLAGS } from 'lib/constants'-const FLAG_ON = { [FEATURE_FLAGS.HIDE_EVENTS_IN_QUERY_BUILDERS]: true }-const FLAG_OFF = {}+import { FlagEvaluationsModeEnumApi } from '~/generated/core/api.schemas'describe('events hidden from query builders', () => {- // The whole feature keys off this taxonomy entry.- it('hides $feature_flag_called while the kill switch is on', () => {- expect(hiddenEventNames(FLAG_ON)).toContain('$feature_flag_called')+ // The mode gate belongs to the flag evaluations rollout. A second event marked+ // hidden_in_query_builders fails this test until it gets its own gate.+ it.each([+ ['reads flag evaluations', FlagEvaluationsModeEnumApi.Number1],+ ['writes only flag evaluations', FlagEvaluationsModeEnumApi.Number2],+ ])('hides $feature_flag_called for a team that %s', (_label, mode) => {+ expect(hiddenEventNames(mode)).toEqual(['$feature_flag_called'])})it.each([- ['the kill switch is off', FLAG_OFF, undefined],+ ['the team is on the Events mode', FlagEvaluationsModeEnumApi.Number0, undefined],+ ['the team has no mode', undefined, undefined],// Pickers that read live event data, and the experiment exposure pickers, opt back in.- ['the picker opts out', FLAG_ON, true],- ])('hides nothing when %s', (_label, featureFlags, includeHiddenEvents) => {- expect(hiddenEventNames(featureFlags, includeHiddenEvents)).toEqual([])+ ['the picker opts out', FlagEvaluationsModeEnumApi.Number1, true],+ ])('hides nothing when %s', (_label, mode, includeHiddenEvents) => {+ expect(hiddenEventNames(mode, includeHiddenEvents)).toEqual([])})describe('withHiddenEventsExcluded', () => {// Cohort pickers exclude "All events" as null, so appending must not replace what came in.it('adds the hidden names to the Events group and keeps the ones the caller passed', () => {- const merged = withHiddenEventsExcluded({ [TaxonomicFilterGroupType.Events]: [null] }, FLAG_ON)+ const merged = withHiddenEventsExcluded(+ { [TaxonomicFilterGroupType.Events]: [null] },+ FlagEvaluationsModeEnumApi.Number1+ )expect(merged?.[TaxonomicFilterGroupType.Events]).toEqual([null, '$feature_flag_called'])})- it('leaves the record alone while the kill switch is off', () => {- const merged = withHiddenEventsExcluded({ [TaxonomicFilterGroupType.Events]: [null] }, FLAG_OFF)+ it('leaves the record alone for a team on the Events mode', () => {+ const merged = withHiddenEventsExcluded(+ { [TaxonomicFilterGroupType.Events]: [null] },+ FlagEvaluationsModeEnumApi.Number0+ )expect(merged?.[TaxonomicFilterGroupType.Events]).toEqual([null])})})@@ -59,7 +68,7 @@ describe('events hidden from query builders', () => {// Two derivations off the same taxonomy scan. If they disagree, a picker hides an event it// then refuses to explain.it('recognizes every name the Events group hides', () => {- for (const name of hiddenEventNames(FLAG_ON)) {+ for (const name of hiddenEventNames(FlagEvaluationsModeEnumApi.Number1)) {expect(hiddenEventMatchingSearch(name, [name])).toBe(name)}})diff --git a/frontend/src/lib/components/TaxonomicFilter/utils/hiddenEvents.ts b/frontend/src/lib/components/TaxonomicFilter/utils/hiddenEvents.tsindex 4ac0395fc64f..9bf78cdf590e 100644--- a/frontend/src/lib/components/TaxonomicFilter/utils/hiddenEvents.ts+++ b/frontend/src/lib/components/TaxonomicFilter/utils/hiddenEvents.ts@@ -1,11 +1,13 @@import { ExcludedProperties, TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'-import { FEATURE_FLAGS } from 'lib/constants'+import { FlagEvaluationsModeEnumApi } from '~/generated/core/api.schemas'import { CORE_FILTER_DEFINITIONS_BY_GROUP } from '~/taxonomy/taxonomy'+const EVENTS_MODE = FlagEvaluationsModeEnumApi.Number0+/**- * Events whose rows are moving out of the `events` table. A query saved against one of these stops- * returning data once the move happens, so event pickers leave them out by default.+ * Events whose rows are moving out of the `events` table. Event pickers leave them out, because a+ * query saved against one stops returning data once the move happens.** `searchTerms` are every string a search has to equal for us to treat it as a hunt for that event.* The label is in there because lists render core events by their label, so "Feature flag called" is@@ -28,15 +30,18 @@ const HIDDEN_EVENT_NAMES = EVENTS_HIDDEN_IN_QUERY_BUILDERS.map(({ name }) => nam/*** Names the Events group adds to its own exclusions.*- * Empty for a picker that passes `includeHiddenEvents`, which is how surfaces that browse captured- * events (the activity explorer, live events, a group's event feed, ingestion triggers) and the- * experiment pickers keep offering them.+ * Empty when the team's `flag_evaluations_mode` is Events or missing, or when the picker passes+ * `includeHiddenEvents`. Surfaces that browse captured events (the activity explorer, live events, a+ * group's event feed, ingestion triggers) and the experiment pickers pass it.+ *+ * For an organization on mode 1, the team API reports Events while the+ * `FLAG_EVALUATIONS_USAGE_TAB_FORCE_EVENTS` instance setting is on, so its pickers show these events again.*/export function hiddenEventNames(- featureFlags: Record<string, boolean | string | undefined>,+ flagEvaluationsMode: FlagEvaluationsModeEnumApi | undefined,includeHiddenEvents?: boolean): string[] {- if (includeHiddenEvents || !featureFlags[FEATURE_FLAGS.HIDE_EVENTS_IN_QUERY_BUILDERS]) {+ if (includeHiddenEvents || (flagEvaluationsMode ?? EVENTS_MODE) === EVENTS_MODE) {return []}return HIDDEN_EVENT_NAMES@@ -46,8 +51,8 @@ export function hiddenEventNames(* The hidden event this search was looking for, or null. Lets a picker explain an absence it caused* rather than reporting no results.*- * Reads the Events group's own exclusions rather than the feature flag, so a picker that opted in,- * and a user without the flag, both match nothing: a picker only ever explains what it hides itself.+ * Reads the Events group's own exclusions rather than the team's mode, so a picker only explains what+ * it hides itself.** Matches the whole query, never a prefix, because "feature" is a plausible real search.*/@@ -75,10 +80,10 @@ export function hiddenEventMatchingSearch(*/export function withHiddenEventsExcluded(excludedProperties: ExcludedProperties | undefined,- featureFlags: Record<string, boolean | string | undefined>,+ flagEvaluationsMode: FlagEvaluationsModeEnumApi | undefined,includeHiddenEvents?: boolean): ExcludedProperties | undefined {- const hidden = hiddenEventNames(featureFlags, includeHiddenEvents)+ const hidden = hiddenEventNames(flagEvaluationsMode, includeHiddenEvents)if (!hidden.length) {return excludedProperties}diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex e949292b68da..7170d2d24e24 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -357,7 +357,6 @@ export const FEATURE_FLAGS = {GITHUB_WORKFLOW_TRIGGERS: 'github-workflow-triggers', // owner: #team-workflows-cdpGROUP_PROFILE_EXPERIMENT: 'group-profile-experiment', // owner: @arthurdedeus #team-customer-analyticsHEALTH_ASK_AI: 'health-ask-ai', // owner: @jordanm-posthog #team-web-analytics, gates the "Ask PostHog AI" buttons on the Health overview- HIDE_EVENTS_IN_QUERY_BUILDERS: 'hide-events-in-query-builders', // owner: #team-feature-flags, kill switch for hiding events marked hidden_in_query_builders from insight/cohort/destination pickersHOGQL_WAREHOUSE_ACCESS_CONTROL: 'hogql-warehouse-access-control', // owner: @a-lider #team-platform-features, gates per-object access control for warehouse tables and viewsIDENTITY_MATCHING: 'identity-matching', // owner: @fercgomes #team-growth, gates new identity matching scene on marketing analyticsINBOX_GET_IT_MERGED: 'inbox-get-it-merged', // owner: #team-self-driving, gates the Get it merged action in the report Ask AI menudiff --git a/frontend/src/scenes/hog-functions/filters/HogFunctionFilters.tsx b/frontend/src/scenes/hog-functions/filters/HogFunctionFilters.tsxindex 4d17a978edc6..cf96684f43e3 100644--- a/frontend/src/scenes/hog-functions/filters/HogFunctionFilters.tsx+++ b/frontend/src/scenes/hog-functions/filters/HogFunctionFilters.tsx@@ -382,6 +382,9 @@ export function HogFunctionFilters({: 'Add event matcher'}excludedProperties={excludedProperties}+ // Transformations run before ingestion stops writing $feature_flag_called+ // to `events`, so they receive the event at every flag evaluations mode.+ includeHiddenEvents={isTransformation}allowNonCapturedEvents/>{selectedFullRefreshView ? (