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.

fix(taxonomic-filter): give the search intent experiment a real control arm (#114947)

Paul D'Ambrace4f194c9bbd
diff --git a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx
index c5de435dcc75..dbaee792172b 100644
--- a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx
@@ -1021,13 +1021,13 @@ export const SearchIntentSuggestsAnotherTabNarrow: Story = {
},
}
-/** Every arm: the predicted group moves to the top of the "All" list before the results show. */
+/** Promote arm: the predicted group moves to the top of the "All" list before the results show. */
export const SearchIntentPromotesGroup: Story = {
render: (args) => <SearchIntentStoryRender args={args} tab={TaxonomicFilterGroupType.SuggestedFilters} />,
args: { taxonomicFilterLogicKey: 'search-intent-promotes-group', taxonomicGroupTypes: SEARCH_INTENT_GROUP_TYPES },
decorators: [searchIntentPersonPropertiesMock],
parameters: {
- featureFlags: { [FEATURE_FLAGS.TAXONOMIC_FILTER_SEARCH_INTENT]: 'control' },
+ featureFlags: { [FEATURE_FLAGS.TAXONOMIC_FILTER_SEARCH_INTENT]: 'promote' },
testOptions: { waitForSelector: SEARCH_INTENT_ALL_TAB_FIRST_ROW },
},
}
diff --git a/frontend/src/lib/components/TaxonomicFilter/taxonomicSearchIntentLogic.test.ts b/frontend/src/lib/components/TaxonomicFilter/taxonomicSearchIntentLogic.test.ts
index 022631b63547..1a2ca3391be6 100644
--- a/frontend/src/lib/components/TaxonomicFilter/taxonomicSearchIntentLogic.test.ts
+++ b/frontend/src/lib/components/TaxonomicFilter/taxonomicSearchIntentLogic.test.ts
@@ -164,45 +164,53 @@ describe('taxonomicSearchIntentLogic', () => {
})
it.each([
- ['on the All tab before the results reveal', TaxonomicFilterGroupType.PersonProperties, false, false, 'model'],
- ['on the All tab from a rule match', TaxonomicFilterGroupType.PersonProperties, false, false, 'rule'],
- ['on the All tab after the results reveal', TaxonomicFilterGroupType.EventProperties, true, false, 'model'],
- ['on a specific tab', TaxonomicFilterGroupType.EventProperties, false, true, 'model'],
+ ['on the All tab from a rule match', TaxonomicFilterGroupType.PersonProperties, false, 'rule'],
+ ['on a specific tab', TaxonomicFilterGroupType.EventProperties, true, 'model'],
+ ])('in the promote arm, an answer that lands %s puts %s first', async (_, first, onSpecificTab, method) => {
+ enroll('promote')
+ answer = { ...PERSON_PROPERTIES_ANSWER, method }
+ if (onSpecificTab) {
+ filterLogic.actions.setActiveTab(TaxonomicFilterGroupType.EventProperties)
+ }
+ await search('email')
+
+ expect(filterLogic.values.suggestedFilterGroupOrder[0]).toEqual(first)
+ })
+
+ it.each([
+ { variant: 'control', revealed: false, promotes: false },
+ { variant: 'banner', revealed: false, promotes: false },
+ { variant: 'promote', revealed: false, promotes: true },
+ { variant: 'control', revealed: true, promotes: false },
+ { variant: 'banner', revealed: true, promotes: false },
+ { variant: 'promote', revealed: true, promotes: false },
])(
- 'in the promote arm, an answer that lands %s puts %s first',
- async (_, first, revealed, onSpecificTab, method) => {
- enroll('promote')
- answer = { ...PERSON_PROPERTIES_ANSWER, method }
- if (onSpecificTab) {
- filterLogic.actions.setActiveTab(TaxonomicFilterGroupType.EventProperties)
- }
+ 'on the All tab, the $variant arm with results revealed $revealed promotes the predicted group: $promotes',
+ async ({ variant, revealed, promotes }) => {
+ enroll(variant)
+ answer = { ...PERSON_PROPERTIES_ANSWER, suggests_switch: false }
+ const captureSpy = jest.spyOn(posthog, 'capture')
filterLogic.actions.setSearchQuery('email')
if (revealed) {
filterLogic.actions.openRevealBarrier()
}
await expectLogic(logic).toFinishAllListeners()
- expect(filterLogic.values.suggestedFilterGroupOrder[0]).toEqual(first)
+ expect(filterLogic.values.suggestedFilterGroupOrder[0]).toEqual(
+ promotes ? TaxonomicFilterGroupType.PersonProperties : TaxonomicFilterGroupType.EventProperties
+ )
+ expect(captureSpy).toHaveBeenCalledWith(
+ 'taxonomic filter search intent predicted',
+ expect.objectContaining({
+ variant,
+ wouldPromote: true,
+ inTime: !revealed,
+ shown: promotes,
+ })
+ )
}
)
- it.each(['control', 'banner'])('promotes the predicted group on the All tab in the %s arm too', async (variant) => {
- enroll(variant)
- answer = { ...PERSON_PROPERTIES_ANSWER, suggests_switch: false }
- const captureSpy = jest.spyOn(posthog, 'capture')
- await search('email')
-
- expect(filterLogic.values.suggestedFilterGroupOrder[0]).toEqual(TaxonomicFilterGroupType.PersonProperties)
- expect(captureSpy).toHaveBeenCalledWith(
- 'taxonomic filter search intent predicted',
- expect.objectContaining({
- variant,
- wouldPromote: true,
- shown: true,
- })
- )
- })
-
it('stops asking after the project turns out not to be enrolled', async () => {
enroll('banner')
useMocks({
diff --git a/frontend/src/lib/components/TaxonomicFilter/taxonomicSearchIntentLogic.ts b/frontend/src/lib/components/TaxonomicFilter/taxonomicSearchIntentLogic.ts
index a61a33aae47d..8760db2d1d65 100644
--- a/frontend/src/lib/components/TaxonomicFilter/taxonomicSearchIntentLogic.ts
+++ b/frontend/src/lib/components/TaxonomicFilter/taxonomicSearchIntentLogic.ts
@@ -45,6 +45,11 @@ export function isSearchIntentVariant(value: unknown): value is SearchIntentVari
return SEARCH_INTENT_VARIANTS.includes(value as SearchIntentVariant)
}
+// Only the All tab reads the promoted group order, so a promotion from another tab changes nothing.
+function wouldPromoteIntent(intent: SearchIntent): boolean {
+ return intent.is_confident && !!intent.group_type && intent.activeTab === TaxonomicFilterGroupType.SuggestedFilters
+}
+
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface taxonomicSearchIntentLogicValues {
featureFlags: FeatureFlagsSet // featureFlagLogic
@@ -213,13 +218,10 @@ export const taxonomicSearchIntentLogic = kea<taxonomicSearchIntentLogicType>([
if (!intent || !values.variant) {
return
}
- // Only the All tab reads the promoted group order, so a promotion from another tab changes nothing.
- const canPromote =
- intent.is_confident &&
- !!intent.group_type &&
- intent.activeTab === TaxonomicFilterGroupType.SuggestedFilters
+ const wouldPromote = wouldPromoteIntent(intent)
// Promote only while the results still show skeletons, so no row moves under the cursor.
- const promoted = canPromote && !values.revealBarrierOpen && values.activeTab === intent.activeTab
+ const inTime = !values.revealBarrierOpen && values.activeTab === intent.activeTab
+ const promoted = values.variant === 'promote' && wouldPromote && inTime
if (promoted) {
actions.setIntentPromotedGroupType(intent.group_type as TaxonomicFilterGroupType)
}
@@ -234,8 +236,9 @@ export const taxonomicSearchIntentLogic = kea<taxonomicSearchIntentLogicType>([
source: intent.method,
promptVersion: intent.prompt_version,
suggestsSwitch: intent.suggests_switch,
- wouldPromote: canPromote,
- shown: promoted || (values.variant === 'banner' && !!values.suggestedSwitch),
+ wouldPromote,
+ inTime,
+ shown: values.variant === 'banner' ? !!values.suggestedSwitch : promoted,
query: intent.model_query ?? undefined,
})
},
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index d176fe261ce1..4e42a7cd8857 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -576,7 +576,7 @@ export const FEATURE_FLAGS = {
TASKS_STREAM_VIA_PROXY: 'tasks-stream-via-proxy', // owner: #team-ai-observability
TAXONOMIC_FILTER_EVENT_MATCH: 'taxonomic-filter-event-match', // owner: @pauldambra, asks the decision model which core events an events search with no results describes, then suggests them in the empty state
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)
- TAXONOMIC_FILTER_SEARCH_INTENT: 'taxonomic-filter-search-intent', // owner: @pauldambra multivariate=control,banner,promote, classifies a picker search with the decision model. Every arm promotes the predicted group on the All tab; only banner also suggests the right tab
+ TAXONOMIC_FILTER_SEARCH_INTENT: 'taxonomic-filter-search-intent', // owner: @pauldambra multivariate=control,banner,promote, classifies a picker search with the decision model. control changes nothing, banner suggests the right tab, promote moves the predicted group to the top of the All tab
TEXT_CARD_WORD_ART: 'text-card-word-art', // owner: @jonmcwest, gates the word art insert button in dashboard text cards
TODAY_RAIL_NAV: 'today-rail-nav', // owner: @k11kirky, replaces the left navigation with a rail (Home, Spaces, Library, Tools) and makes the Today briefing the homepage
TODAY_REPORT_JEV: 'today-report-jev', // owner: @puemos, asks the decision model to label the problem, cause and fix in a Today report, to mark the numbers a source states, and to pick the code excerpt a finding describes