: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
fix(insights): gate rebuilt taxonomic filter on a single flag (#61562)
Adam Leithf0a7bc6d31eb
diff --git a/common/storybook/.storybook/test-runner.ts b/common/storybook/.storybook/test-runner.tsindex c7fcc43f1861..e5eba9e328ad 100644--- a/common/storybook/.storybook/test-runner.ts+++ b/common/storybook/.storybook/test-runner.ts@@ -83,6 +83,7 @@ declare module '@storybook/types' {const RETRY_TIMES = 2const LOADER_SELECTORS = ['.Spinner',+ '.quill-spinner', // Quill's <Spinner /> — rotates while present, so it must settle before we snapshot'.LemonSkeleton','.LemonTableLoader','.Toastify__toast',diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 01f0c9295888..020dc5bbad76 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -2045,9 +2045,9 @@ snapshots:filters-taxonomic-filter-headless--properties--light:hash: v1.k794b7964.bd715b36b456df8730e934366a35faed4556dffa881456db1272e2804047a036.IH74-bf3miZ6nC3E0bqbzIb0km4fBh97_2XubTpcmnsfilters-taxonomic-filter-headless--suggested-filters-with-recents--dark:- hash: v1.k794b7964.0fa0c4f2080aae970fe9cb2599d76a47d71cbc7ce3cb1a4ef5ab7ce2a4e2a095.yraoTnMVeBtQXg1K-r3YPAyFXWhyAw3DCCvH7rt8tzM+ hash: v1.k794b7964.bde87b20067d3a4ab3089ea62acfd9095b3be42275f60a37b5c50fff74cea6a7.wXHAM_8ewbUHxsuzWBDuotzkgYbpE0a0fJ64zGDlAqkfilters-taxonomic-filter-headless--suggested-filters-with-recents--light:- hash: v1.k794b7964.9a100f60733e742a18d00cf0764ebb7a193e7eabee5416e746da759c871eb49f.gTJtue0Rg4_HuqXdUsV3dU1ZyEo3rHkqoXVpAKkdypg+ hash: v1.k794b7964.9e94f0bc20ace724f4984c77cc1c1ef818b64f708ab972b8bc2e0afcbc2bc8a0.d4EvG3smS4PHr1VMeIS3JNPMEu5tDCJXbVJhb7rnzeUfilters-taxonomic-filter-menu-rebuild--data-warehouse-config--dark:hash: v1.k794b7964.c09183f21589b0f11a3013a6e359d23c8d5b17b1e6ed61476ba45da75bcdc73f.tzexSMIoGf0LgGmzdG3-O0g7vd9Isx6MRQ_TWltg4Fofilters-taxonomic-filter-menu-rebuild--data-warehouse-config--light:diff --git a/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsx b/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsxindex f26424569fb7..9c66ae39632e 100644--- a/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsx+++ b/frontend/src/lib/components/PropertyFilters/components/TaxonomicPropertyFilter.tsx@@ -17,6 +17,7 @@ import {sanitizePropertyFilter,} from 'lib/components/PropertyFilters/utils'import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'+import { taxonomicTriggerWrapperClassName } from 'lib/components/TaxonomicFilter/menu/triggerLayout'import { TaxonomicFilter } from 'lib/components/TaxonomicFilter/TaxonomicFilter'import {TaxonomicFilterGroup,@@ -332,7 +333,7 @@ export function TaxonomicPropertyFilter({}}/>) : (- <span className="relative inline-flex max-w-full min-w-0">+ <span className={taxonomicTriggerWrapperClassName()}>{legacyDropdown}<TaxonomicMenuToggle /></span>diff --git a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.tsx b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.tsxindex 61e66c342e48..e18311c7c13d 100644--- a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.tsx@@ -22,20 +22,11 @@ import { urls } from 'scenes/urls'import { CategoryDropdown } from './CategoryDropdown'import { InfiniteSelectResults } from './InfiniteSelectResults'-import { TaxonomicFilterAdapter } from './TaxonomicFilterAdapter'import { defaultDataWarehousePopoverFields, taxonomicFilterLogic } from './taxonomicFilterLogic'let uniqueMemoizedIndex = 0-export function TaxonomicFilter(props: TaxonomicFilterProps): JSX.Element {- const { featureFlags } = useValues(featureFlagLogic)- if (featureFlags[FEATURE_FLAGS.TAXONOMIC_FILTER_HEADLESS]) {- return <TaxonomicFilterAdapter {...props} />- }- return <TaxonomicFilterLegacy {...props} />-}--function TaxonomicFilterLegacy({+export function TaxonomicFilter({taxonomicFilterLogicKey: taxonomicFilterLogicKeyInput,groupType,value,diff --git a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilterAdapter.tsx b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilterAdapter.tsxdeleted file mode 100644index 12b8b124be56..000000000000--- a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilterAdapter.tsx+++ /dev/null@@ -1,118 +0,0 @@-/**- * Bridges the legacy `TaxonomicFilterProps` API to the new headless component- * tree. Used by the entry `<TaxonomicFilter>` component when the- * `TAXONOMIC_FILTER_HEADLESS` feature flag is on, so existing call-sites get- * the new implementation without touching their props.- *- * Translation table is intentionally narrow for the v1 flip:- * - search / tabs / list / select / keyboard nav → fully wired- * - definition popover → not yet (legacy renderer- * not supported in v1; the- * `<Panel>` row uses the- * Quill `<ItemMenuItem>`)- * - DataWarehouse pinned-row detail-pane → deferred (see PRD §3.3)- * - keyword shortcut promotion in SuggestedFilters → deferred (orchestrator- * doesn't yet aggregate- * top matches across tabs)- *- * Anything in those buckets is documented inline + in the rewrite PRD. When- * the flag is off, the legacy kea implementation runs exactly as before.- */-import { KeyboardEvent, useCallback } from 'react'--import { TaxonomicFilterHeadless } from './headless'-import { TaxonomicFilterProps } from './types'--export function TaxonomicFilterAdapter(props: TaxonomicFilterProps): JSX.Element {- const {- taxonomicGroupTypes,- groupType,- value,- onChange,- onEnter,- onClose,- optionsFromProp,- metadataSource,- eventNames,- schemaColumns,- schemaColumnsLoading,- excludedProperties,- selectedProperties,- propertyAllowList,- showNumericalPropsOnly,- hideBehavioralCohorts,- maxContextOptions,- allowNonCapturedEvents,- hogQLGlobals,- hogQLExpressionShowBreakdownLabelHint,- minSearchQueryLength,- suggestedFiltersLabel,- hideSearchInput,- searchQuery,- initialSearchQuery,- enableKeywordShortcuts,- selectFirstItem = true,- width,- height,- } = props-- // Bridge legacy `onClose` (fires on Escape) by wrapping the orchestrator's- // keyboard handler at the adapter level — the headless API doesn't ship a- // dedicated onClose option to keep the surface small.- const handleKeyDown = useCallback(- (e: KeyboardEvent<HTMLDivElement>): void => {- if (e.key === 'Escape') {- onClose?.()- }- },- [onClose]- )-- const style = {- ...(width ? { width: typeof width === 'number' ? `${width}px` : width } : {}),- ...(height ? { height: typeof height === 'number' ? `${height}px` : height } : {}),- }-- return (- <div- className="taxonomic-filter taxonomic-filter--headless"- // eslint-disable-next-line react/forbid-dom-props- style={style}- onKeyDown={handleKeyDown}- >- <TaxonomicFilterHeadless.Root- taxonomicGroupTypes={taxonomicGroupTypes}- groupType={groupType}- value={value}- onChange={onChange}- onEnter={onEnter}- searchQuery={searchQuery}- initialSearchQuery={initialSearchQuery}- eventNames={eventNames}- schemaColumns={schemaColumns}- schemaColumnsLoading={schemaColumnsLoading}- metadataSource={metadataSource}- suggestedFiltersLabel={suggestedFiltersLabel}- excludedProperties={excludedProperties}- selectedProperties={selectedProperties}- propertyAllowList={propertyAllowList}- maxContextOptions={maxContextOptions}- hideBehavioralCohorts={hideBehavioralCohorts}- hogQLGlobals={hogQLGlobals}- hogQLExpressionShowBreakdownLabelHint={hogQLExpressionShowBreakdownLabelHint}- optionsFromProp={optionsFromProp}- showNumericalPropsOnly={showNumericalPropsOnly}- minSearchQueryLength={minSearchQueryLength}- allowNonCapturedEvents={allowNonCapturedEvents}- enableKeywordShortcuts={enableKeywordShortcuts}- selectFirstItem={selectFirstItem}- >- {!hideSearchInput && <TaxonomicFilterHeadless.Input />}- {taxonomicGroupTypes.length > 1 && (- <TaxonomicFilterHeadless.Categories className="flex flex-row flex-wrap gap-1 my-2" />- )}- <TaxonomicFilterHeadless.Panel className="flex-1 min-h-0 overflow-auto" />- </TaxonomicFilterHeadless.Root>- </div>- )-}diff --git a/frontend/src/lib/components/TaxonomicFilter/headless/TaxonomicFilterHeadless.stories.tsx b/frontend/src/lib/components/TaxonomicFilter/headless/TaxonomicFilterHeadless.stories.tsxindex f383e78bb58f..0b5b5dd34cfc 100644--- a/frontend/src/lib/components/TaxonomicFilter/headless/TaxonomicFilterHeadless.stories.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/headless/TaxonomicFilterHeadless.stories.tsx@@ -17,7 +17,7 @@ const meta: Meta = {docs: {description: {component:- 'Headless TaxonomicFilter built on Quill primitives. The compound `<Root>/<Input>/<Categories>/<Panel>` API is opt-in via the `TAXONOMIC_FILTER_HEADLESS` feature flag and replaces the kea-based `<TaxonomicFilter>` once parity is verified.',+ 'Headless TaxonomicFilter built on Quill primitives. The compound `<Root>/<Input>/<Categories>/<Panel>` API is opt-in via the `TAXONOMIC_FILTER_MENU_REBUILD` feature flag and replaces the kea-based `<TaxonomicFilter>` once parity is verified.',},},},diff --git a/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.tsx b/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.tsxindex 5549358a4893..6321334dda6b 100644--- a/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/menu/TaxonomicFilterMenu.tsx@@ -48,6 +48,7 @@ import { META_GROUP_TYPES, TaxonomicDefinitionTypes, TaxonomicFilterGroupType }import { MenuFilterCombobox } from './Combobox'import { MenuFilterDwhConfig } from './DwhFlow'import { MenuFilterHogQLEditor } from './HogQLEditor'+import { taxonomicTriggerWrapperClassName } from './triggerLayout'import { CommitFn, DrillCategory, MenuFilterEntry, MenuFilterState, TaxonomicFilterGroup } from './types'export interface TaxonomicFilterMenuProps {@@ -454,19 +455,7 @@ export function TaxonomicFilterMenu({eventDetails.cancel()}}>- {/*- * `flex min-w-0 w-full` (not `inline-flex`) so the wrap- * fills its parent column instead of sizing to the- * trigger's intrinsic width. Without `min-w-0` the- * default `min-width: auto` makes the wrap grow to its- * content and overflow narrow parents — long filter- * names then bleed past the parity wrapper instead of- * truncating like the legacy trigger.- */}- <span- ref={triggerWrapRef}- className={cn('relative flex min-w-0', fullWidthTrigger ? 'w-full' : 'max-w-full')}- >+ <span ref={triggerWrapRef} className={taxonomicTriggerWrapperClassName(fullWidthTrigger)}><DropdownMenuTrigger render={triggerEl} data-attr="taxonomic-filter-menu-trigger" /><PopoverTriggerrender={<span aria-hidden tabIndex={-1} className="absolute inset-0 pointer-events-none" />}diff --git a/frontend/src/lib/components/TaxonomicFilter/menu/triggerLayout.ts b/frontend/src/lib/components/TaxonomicFilter/menu/triggerLayout.tsnew file mode 100644index 000000000000..c48e5bb5ea0d--- /dev/null+++ b/frontend/src/lib/components/TaxonomicFilter/menu/triggerLayout.ts@@ -0,0 +1,18 @@+import { cn } from '@posthog/quill'++/**+ * Single source of truth for the layout of any taxonomic-filter trigger+ * wrapper — the legacy `TaxonomicPopover` fallback, the lazy placeholder+ * before the rebuilt menu mounts, and the rebuilt `TaxonomicFilterMenu`+ * itself. Keeping them identical means swapping between the legacy and+ * rebuilt triggers (or the placeholder → armed transition) never shifts the+ * trigger's box.+ *+ * `relative` anchors the floating `<TaxonomicMenuToggle>`; `flex min-w-0`+ * (not `inline-flex`) lets the trigger fill its parent column and truncate+ * instead of sizing to its intrinsic width; width tracks the call site's+ * `fullWidth` so a full-width column stays full width in every variant.+ */+export function taxonomicTriggerWrapperClassName(fullWidth?: boolean): string {+ return cn('relative flex min-w-0', fullWidth ? 'w-full' : 'max-w-full')+}diff --git a/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopover.tsx b/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopover.tsxindex b45c76597dd4..847446ee6628 100644--- a/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopover.tsx+++ b/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopover.tsx@@ -4,6 +4,7 @@ import { Ref, forwardRef, useEffect, useState } from 'react'import { IconX } from '@posthog/icons'+import { taxonomicTriggerWrapperClassName } from 'lib/components/TaxonomicFilter/menu/triggerLayout'import { TaxonomicFilter } from 'lib/components/TaxonomicFilter/TaxonomicFilter'import {DataWarehousePopoverField,@@ -210,16 +211,18 @@ export const TaxonomicPopover = forwardRef(function TaxonomicPopover_<// the call site's layout exactly. The legacy path needs a thin// positioned wrapper to host the floating toggle.//- // The rebuilt menu doesn't model these legacy capabilities yet, so a- // call site that needs any of them stays on the classic filter (still- // with the toggle) — no behaviour is silently lost:+ // The rebuilt menu can't honour these legacy capabilities, so a call site+ // that needs any of them stays on the classic filter (still with the+ // toggle) — no behaviour is silently lost:// - `allowClear` — the clear (X) affordance- // - `selectingKeyOnly` — key-only selection semantics- // - `definitionPopoverRenderer` — custom definition popover// - `closeOnChange={false}` — keep-open-after-select// - a forwarded `ref` — the rebuilt trigger can't receive it- const newMenuSupportsCallSite =- !allowClear && !selectingKeyOnly && !definitionPopoverRenderer && closeOnChange && ref == null+ //+ // `selectingKeyOnly` (key-based onChange) and `definitionPopoverRenderer`+ // (the hover definition card) are superseded by the rebuilt menu itself —+ // its onChange already commits the resolved key and its preview pane+ // replaces the definition popover — so they no longer gate the new menu.+ const newMenuSupportsCallSite = !allowClear && closeOnChange && ref == nullif (useNewMenu && newMenuSupportsCallSite) {return (<TaxonomicPopoverMenu<ValueType>@@ -254,7 +257,7 @@ export const TaxonomicPopover = forwardRef(function TaxonomicPopover_<)}return (- <span className="relative inline-flex max-w-full min-w-0">+ <span className={taxonomicTriggerWrapperClassName(buttonPropsRest.fullWidth)}>{legacyEl}<TaxonomicMenuToggle /></span>diff --git a/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopoverMenu.tsx b/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopoverMenu.tsxindex 00e962e7afbb..94518b9c0ac8 100644--- a/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopoverMenu.tsx+++ b/frontend/src/lib/components/TaxonomicPopover/TaxonomicPopoverMenu.tsx@@ -25,6 +25,7 @@ import { IconChevronDown } from '@posthog/icons'import { TaxonomicFilterHeadless } from 'lib/components/TaxonomicFilter/headless'import { MenuFilterEntry, TaxonomicFilterMenu } from 'lib/components/TaxonomicFilter/menu'+import { taxonomicTriggerWrapperClassName } from 'lib/components/TaxonomicFilter/menu/triggerLayout'import {AllowedProperties,DataWarehousePopoverField,@@ -145,7 +146,7 @@ export function TaxonomicPopoverMenu<ValueType extends TaxonomicFilterValue = Taconst { value, renderValue, placeholder = 'Select', placeholderClass, triggerButtonProps } = propsreturn (- <span className="relative inline-flex max-w-full min-w-0">+ <span className={taxonomicTriggerWrapperClassName(triggerButtonProps?.fullWidth)}>{buildTriggerButton({value,renderValue,diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 31c61a073e71..7289c2746504 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -490,8 +490,7 @@ export const FEATURE_FLAGS = {TASK_TOOL: 'phai-task-tool', // owner: @kappa90 #team-posthog-aiTASKS: 'tasks', // owner: #team-ai-observabilityTAXONOMIC_FILTER_CATEGORY_DROPDOWN: 'taxonomic-filter-category-dropdown', // owner: @pauldambra #team-product-analytics multivariate=control,pill- TAXONOMIC_FILTER_HEADLESS: 'taxonomic-filter-headless', // owner: @adamleith, opt-in to the headless useTaxonomicFilter rewrite- TAXONOMIC_FILTER_MENU_REBUILD: 'taxonomic-filter-menu-rebuild', // owner: @adamleith, opt-in to the new TaxonomicFilterMenu (column / preview-pane) for series row pickers+ TAXONOMIC_FILTER_MENU_REBUILD: 'taxonomic-filter-menu-rebuild', // owner: @adamleith, opt-in to the rebuilt TaxonomicFilter — headless filter panel + new popover menu (column / preview-pane)TOGGLE_PROPERTY_ARRAYS: 'toggle-property-arrays', // owner: @arthurdedeus #team-customer-analyticsTRACING: 'tracing', // owner: #team-apm (@jonmcwest, @frankh)TRAFFIC_TYPE_VIRTUAL_PROPERTIES: 'traffic-type-virtual-properties', // owner: #team-web-analytics