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.

feat(taxonomic-filter): promote the predicted group in every arm (#107395)

Paul D'Ambra04014af8c5d6
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 18d1d8400754..af493beb84e3 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -3196,10 +3196,6 @@ snapshots:
hash: v1.k794b7964.7a64d4e031d99774addf09c78809b732e1de363b31f9c700218c8bf7575d3e2f.bm9u1TaKULFXL7zhr293AHvC82-5Puiypn88v0euEJU
filters-taxonomic-filter--renamed-series-selected-with-all-results--light:
hash: v1.k794b7964.1940698d5a4fcf5314afcc4f2f582228c3adcf8d8b7cc5f8725441f8a8d040b6.L87TGLih84ffADwLJZCeToQdaIewW50aBiH7MdbZ1CQ
- filters-taxonomic-filter--search-intent-control-keeps-order--dark:
- hash: v1.k794b7964.a697849cb795fb3b6831e77c4473f44b731cd37bf3c95fc2e222860ec8fbfc99.PYkSY0kqft5THgGC8cU6kc3FBsEI445P6wJiKTUKhi4
- filters-taxonomic-filter--search-intent-control-keeps-order--light:
- hash: v1.k794b7964.37b41323e066412ea5791d7139276a8511a214eab9560e688f059a58a26f4fed.0oJtl5BM6R1utvMNfrefc-Hz5Jj785IOLbcsoAoKin0
filters-taxonomic-filter--search-intent-promotes-group--dark:
hash: v1.k794b7964.36bfca465fa81a617cb228956bf5cbcbdfc742b8010f455688310ea35a353a67.EDotXLAmxjeQbl7CmhNRK8ItX_qcXIBHu938KCKvUS8
filters-taxonomic-filter--search-intent-promotes-group--light:
diff --git a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx
index 5eb2f9d2db89..f3e860966646 100644
--- a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx
+++ b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx
@@ -965,24 +965,13 @@ export const SearchIntentSuggestsAnotherTabNarrow: Story = {
},
}
-/** Control arm: the same answer arrives, and the "All" list keeps its usual group order. */
-export const SearchIntentControlKeepsOrder: Story = {
- render: (args) => <SearchIntentStoryRender args={args} tab={TaxonomicFilterGroupType.SuggestedFilters} />,
- args: { taxonomicFilterLogicKey: 'search-intent-control', taxonomicGroupTypes: SEARCH_INTENT_GROUP_TYPES },
- decorators: [searchIntentPersonPropertiesMock],
- parameters: {
- featureFlags: { [FEATURE_FLAGS.TAXONOMIC_FILTER_SEARCH_INTENT]: 'control' },
- testOptions: { waitForSelector: SEARCH_INTENT_ALL_TAB_FIRST_ROW },
- },
-}
-
-/** Promote arm: the predicted group moves to the top of the "All" list before the results show. */
+/** Every 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-promote', taxonomicGroupTypes: SEARCH_INTENT_GROUP_TYPES },
+ args: { taxonomicFilterLogicKey: 'search-intent-promotes-group', taxonomicGroupTypes: SEARCH_INTENT_GROUP_TYPES },
decorators: [searchIntentPersonPropertiesMock],
parameters: {
- featureFlags: { [FEATURE_FLAGS.TAXONOMIC_FILTER_SEARCH_INTENT]: 'promote' },
+ featureFlags: { [FEATURE_FLAGS.TAXONOMIC_FILTER_SEARCH_INTENT]: 'control' },
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 84b4936040af..022631b63547 100644
--- a/frontend/src/lib/components/TaxonomicFilter/taxonomicSearchIntentLogic.test.ts
+++ b/frontend/src/lib/components/TaxonomicFilter/taxonomicSearchIntentLogic.test.ts
@@ -164,21 +164,43 @@ describe('taxonomicSearchIntentLogic', () => {
})
it.each([
- ['on the All tab before the results reveal', TaxonomicFilterGroupType.PersonProperties, false, false],
- ['on the All tab after the results reveal', TaxonomicFilterGroupType.EventProperties, true, false],
- ['on a specific tab', TaxonomicFilterGroupType.EventProperties, false, true],
- ])('in the promote arm, an answer that lands %s puts %s first', async (_, first, revealed, onSpecificTab) => {
- enroll('promote')
- if (onSpecificTab) {
- filterLogic.actions.setActiveTab(TaxonomicFilterGroupType.EventProperties)
+ ['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'],
+ ])(
+ '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)
+ }
+ filterLogic.actions.setSearchQuery('email')
+ if (revealed) {
+ filterLogic.actions.openRevealBarrier()
+ }
+ await expectLogic(logic).toFinishAllListeners()
+
+ expect(filterLogic.values.suggestedFilterGroupOrder[0]).toEqual(first)
}
- filterLogic.actions.setSearchQuery('email')
- if (revealed) {
- filterLogic.actions.openRevealBarrier()
- }
- await expectLogic(logic).toFinishAllListeners()
+ )
+
+ 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(first)
+ 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 () => {
diff --git a/frontend/src/lib/components/TaxonomicFilter/taxonomicSearchIntentLogic.ts b/frontend/src/lib/components/TaxonomicFilter/taxonomicSearchIntentLogic.ts
index 8ca0e93f6b24..a61a33aae47d 100644
--- a/frontend/src/lib/components/TaxonomicFilter/taxonomicSearchIntentLogic.ts
+++ b/frontend/src/lib/components/TaxonomicFilter/taxonomicSearchIntentLogic.ts
@@ -215,16 +215,11 @@ export const taxonomicSearchIntentLogic = kea<taxonomicSearchIntentLogicType>([
}
// Only the All tab reads the promoted group order, so a promotion from another tab changes nothing.
const canPromote =
- intent.method === 'model' &&
intent.is_confident &&
!!intent.group_type &&
intent.activeTab === TaxonomicFilterGroupType.SuggestedFilters
// Promote only while the results still show skeletons, so no row moves under the cursor.
- const promoted =
- values.variant === 'promote' &&
- canPromote &&
- !values.revealBarrierOpen &&
- values.activeTab === intent.activeTab
+ const promoted = canPromote && !values.revealBarrierOpen && values.activeTab === intent.activeTab
if (promoted) {
actions.setIntentPromotedGroupType(intent.group_type as TaxonomicFilterGroupType)
}
@@ -240,7 +235,7 @@ export const taxonomicSearchIntentLogic = kea<taxonomicSearchIntentLogicType>([
promptVersion: intent.prompt_version,
suggestsSwitch: intent.suggests_switch,
wouldPromote: canPromote,
- shown: values.variant === 'banner' ? !!values.suggestedSwitch : promoted,
+ shown: promoted || (values.variant === 'banner' && !!values.suggestedSwitch),
query: intent.model_query ?? undefined,
})
},
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index bd647c9a9cae..99b96481ff17 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -528,7 +528,7 @@ export const FEATURE_FLAGS = {
TASKS: 'tasks', // owner: #team-ai-observability
TASKS_STREAM_VIA_PROXY: 'tasks-stream-via-proxy', // owner: #team-ai-observability
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, then suggests the right tab (banner) or promotes its group (promote)
+ 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_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
TEXT_CARD_WORD_ART: 'text-card-word-art', // owner: @jonmcwest, gates the word art insert button in dashboard text cards
TOOLBAR_PAID_HEATMAPS: 'toolbar-paid-heatmaps', // owner: #team-web-analytics
diff --git a/products/posthog_ai/evals/taxonomic_filter/eval_search_intent.py b/products/posthog_ai/evals/taxonomic_filter/eval_search_intent.py
index 4fce2d633d02..68143a7b3003 100644
--- a/products/posthog_ai/evals/taxonomic_filter/eval_search_intent.py
+++ b/products/posthog_ai/evals/taxonomic_filter/eval_search_intent.py
@@ -187,6 +187,14 @@ WRONG_TAB_CASES = [
tabs=PROPERTY_FILTER,
acceptable=("elements",),
),
+ # The SDK sets the library version on every event. The model answered this as the open tab with high confidence.
+ _case(
+ "lib_version_in_person_properties_tab",
+ "lib version",
+ active="person_properties",
+ tabs=PROPERTY_FILTER,
+ acceptable=("event_properties",),
+ ),
]
# The open tab already holds the answer. The picker must stay quiet: any banner here is noise.