: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(taxonomic-filter): explicit opt-in for stale event results (#59816)
Paul D'Ambrac479a77f406f
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex fa408419c8d5..26eeb3039626 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -521,9 +521,9 @@ snapshots:components-hogcharts-linechart--hovering-interior--light:hash: v1.k794b7964.a5de82ff7b46d82c52fc0d8ce4b4aba505884feadbc44c02bf216186ce1c8edd.wryTORlIhCWy9Ysreyx0oBnf_PwqdA3XUDWpiwx0uTQcomponents-hogcharts-linechart--hovering-multi-series--dark:- hash: v1.k794b7964.799f9aa75bc48ce4a6cdc0dcf5416758391d7d0fed8b513d24a9c18ba7331ff7.7okiBWGhBRr8A5BpL0tlt7086bDKl_B2TE6FH-E3TeQ+ hash: v1.k794b7964.bc43065d43bc1e1238b514efd6bfbb3d1a2cc53f18c3cdcb59fdac8df9fe259b.zwrzaU3pqo3joC6IzW5dlDzp63ST6fjfuPyou6_72uccomponents-hogcharts-linechart--hovering-multi-series--light:- hash: v1.k794b7964.0637d025985bb2187effa8e57f784f942e86de9e1c594c7e59fb49d1a4648de7.DWD4y-zS9gEy-6Ai7pcbenHlY87rjq-wBkYqdeKwNGo+ hash: v1.k794b7964.fbfe3904fa22e1871488ca2f9ddb30b569100259708a16b6fcb722a450857b1c.-4mxJ92opWKeOvWoHto-KHEH6pTxG56-q0ddN3nxW7Qcomponents-hogcharts-linechart--hovering-over-aux-series--dark:hash: v1.k794b7964.6b522e2b58799b5e9dbb17bee0e99b42c2ffc788c88cabe8f44e68ef82388086.7qlPt0jhAFGfLQ1whJLLTmgeJu1SIWk5rh7RVuUnJiocomponents-hogcharts-linechart--hovering-over-aux-series--light:@@ -1768,6 +1768,10 @@ snapshots:hash: v1.k794b7964.8c5d02ec4c497a87a0df0cf32bb695ffb728e4efa6ac8b17eaf9063c5ce98170.5sdWMbFrLaEyW5syvARRnAsh5IkpWjdemV1wq35_4owfilters-taxonomic-filter--autocapture-context-promotes-elements--light:hash: v1.k794b7964.22b6c7c9ce49bc9ed622417764cc41b2bde28d5a71a9fbc7e92131551dcebb63.jaTvGGOP2Q4wYsPwae28Qzm8_iG70pdBcAc_aAshTy4+ filters-taxonomic-filter--empty-events-with-stale-toggle--dark:+ hash: v1.k794b7964.58cb6300564a2a703d96ce3e69b884cf4009c6fa3ff46b638915be0d7f3b5f02.16dqA1SviZenMIon-EhxXL-vwoIrRFEbDDIDGT3MIm0+ filters-taxonomic-filter--empty-events-with-stale-toggle--light:+ hash: v1.k794b7964.7d9672075e2cafebbb615cbc7b8833c475bc999ef1dd188145059b4537c27228.l6SIczY-o8wbrx8D8moeGvK0dwqQ6W_iFFm3FzN7fB4filters-taxonomic-filter--events-free--dark:hash: v1.k794b7964.3274e2d1c3ba5b4e3a09b8188a3f401e8140f01d9b35a2a03858c59bd3c91709.J_nYjNfALjeDl5uYZ2ZTpWYCpwNvFG8NJOOthoqpFxkfilters-taxonomic-filter--events-free--light:@@ -4595,21 +4599,21 @@ snapshots:scenes-app-insights-funnels--funnel-left-to-right-breakdown-edit--light:hash: v1.k794b7964.414326f685dca45885b93d728ae8a75c7d8b600af35d76c9512a74a27e453006.IyZ8qHUwOv6qsBYvdUR1ZsK1Md_GNFCftDGvNZj78BQscenes-app-insights-funnels--funnel-left-to-right-edit--dark:- hash: v1.k794b7964.293297b83994468984576e5c15fa2cbbb2c4c0a7a8234959b9deba539efa383b.xupnP9sdcp25xPBOMzrhSHwtRpKPLKHaqLDBncapvQA+ hash: v1.k794b7964.c47bdb853ef9b6becfb675e2ca0bdbdb0c1b4385cf2442d50dd92752d90f7906.gaL7vRk-pWoOUkiPi-NGCd1W72x-M5l9jk5Qu-UcjwIscenes-app-insights-funnels--funnel-left-to-right-edit--light:hash: v1.k794b7964.c63132bb5b13cbe97938ebdb2e59e320ebc338bd12b2d3bfd6af81e56270650a.3gc3UBg-8GVo4HkNBH7UrogK2q1uh9pXPDjTdYGT8ncscenes-app-insights-funnels--funnel-left-to-right-edit-viewports--medium--dark:hash: v1.k794b7964.36814bd223fdaa124f92bbc2b45de89865c13890bf5f7a14179029dc7f33ca27.jq91_V-Z1EaJWopXWnh8EuqryG4eGkFxCIgXLCwkpv8scenes-app-insights-funnels--funnel-left-to-right-edit-viewports--medium--light:- hash: v1.k794b7964.39c531480ac09a585d44dc77debc1de29c1c16624a2ac2a833d773b9a965b304.cCY0VJA9FAt484n9ehqjKR_A3AFsJ5NrkEC5bnmr3to+ hash: v1.k794b7964.cc68bff62d0a7db2b578db64c882c5628141709e87e7ca10faae06924f83592f.kzJnzLpkgoJ2gnD9i0DTbNXRPEic_9tWqoh4cECAxQYscenes-app-insights-funnels--funnel-left-to-right-edit-viewports--superwide--dark:hash: v1.k794b7964.a5b932cb8770bae7203313301e6d82642abab2793cf1933cb2989bf9c92158b8.i2aZRg7zfr3AlQxv3uhnKZxydkU-GKdInMrfbIFfknsscenes-app-insights-funnels--funnel-left-to-right-edit-viewports--superwide--light:- hash: v1.k794b7964.c8cfc83215d08266525562e0f8ba98f089c5bba859a315e4171f17e33844d15f.zs-Vgs90ougz0BhCr0TcPwaYk0WyWho2WvF8rv_5zTg+ hash: v1.k794b7964.c95c5a49f7a20b7fcb1041dd26c73ee87c9a906cb229247a44fd4633bbdc9173.StrJ2VBA5acLqvnsiO2CS_o6qadxeaeO6ST8lxf5UdIscenes-app-insights-funnels--funnel-left-to-right-edit-viewports--wide--dark:hash: v1.k794b7964.293297b83994468984576e5c15fa2cbbb2c4c0a7a8234959b9deba539efa383b.O7SwG4Drfr3z02hcLNC1LsLsGWddouhybBp4xZaUE-Ascenes-app-insights-funnels--funnel-left-to-right-edit-viewports--wide--light:- hash: v1.k794b7964.6c391cbc05b64230fbd8defdbb960b131fd433409817497873fb9ffc705cd360.EIwByuofuT77yP259A9ffqfjSFwW9MrUDOvsZNA_aZM+ hash: v1.k794b7964.c63132bb5b13cbe97938ebdb2e59e320ebc338bd12b2d3bfd6af81e56270650a.KSiw8WpvjWXIDh87ExL4cPnopVJlTXvzU8N8ruh6Hi8scenes-app-insights-funnels--funnel-time-to-convert--dark:hash: v1.k794b7964.d64808d2bfc36017f89b57feeaa373e20188738a622801207fa1beb59d02fdd9.cFuKF_Ow887Z3X3BoNhtTvkUWY2vips9HDBe-B02eQEscenes-app-insights-funnels--funnel-time-to-convert--light:diff --git a/frontend/src/lib/components/TaxonomicFilter/InfiniteList.tsx b/frontend/src/lib/components/TaxonomicFilter/InfiniteList.tsxindex d4f2b6fc89a2..af9b2b5a8048 100644--- a/frontend/src/lib/components/TaxonomicFilter/InfiniteList.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/InfiniteList.tsx@@ -7,7 +7,7 @@ import { CSSProperties, useEffect, useState } from 'react'import { List, useListRef } from 'react-window'import { IconArchive, IconCheck, IconPin, IconPinFilled, IconPlus, IconSearch } from '@posthog/icons'-import { LemonDivider, LemonTag } from '@posthog/lemon-ui'+import { LemonButton, LemonDivider, LemonTag } from '@posthog/lemon-ui'import { AutoSizer } from 'lib/components/AutoSizer'import { ControlledDefinitionPopover } from 'lib/components/DefinitionPopover/DefinitionPopoverContents'@@ -643,12 +643,18 @@ export const InfiniteListRow = ({}function InfiniteListEmptyState(): JSX.Element {- const { searchQuery, taxonomicGroupTypes } = useValues(taxonomicFilterLogic)+ const { searchQuery, taxonomicGroupTypes, includeStaleEvents } = useValues(taxonomicFilterLogic)+ const { setIncludeStaleEvents } = useActions(taxonomicFilterLogic)- const { group, needsMoreSearchCharacters, minSearchQueryLength, isSuggestedFilters } = useValues(infiniteListLogic)+ const { group, needsMoreSearchCharacters, minSearchQueryLength, isSuggestedFilters, listGroupType } =+ useValues(infiniteListLogic)const emptySearchQuery = searchQuery.trim().length === 0const suggestedFiltersBeforeSearching = isSuggestedFilters && emptySearchQuery+ const canOfferStaleToggle =+ !emptySearchQuery &&+ !includeStaleEvents &&+ (listGroupType === TaxonomicFilterGroupType.Events || listGroupType === TaxonomicFilterGroupType.CustomEvents)return (<div className="no-infinite-results flex flex-col gap-y-1 items-center">{suggestedFiltersBeforeSearching ? (@@ -680,6 +686,16 @@ function InfiniteListEmptyState(): JSX.Element {</>)}</span>+ {canOfferStaleToggle && (+ <LemonButton+ type="secondary"+ size="xsmall"+ data-attr="taxonomic-include-stale-events"+ onClick={() => setIncludeStaleEvents(true)}+ >+ Include stale events+ </LemonButton>+ )}</>)}</div>diff --git a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsxindex 11bd3a608205..2375c3cf22fd 100644--- a/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/TaxonomicFilter.stories.tsx@@ -11,6 +11,7 @@ import { useDelayedOnMountEffect } from 'lib/hooks/useOnMountEffect'import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'+import { mswDecorator } from '~/mocks/browser'import { useAvailableFeatures } from '~/mocks/features'import { actionsModel } from '~/models/actionsModel'import { type AnyPropertyFilter, AvailableFeature, PropertyFilterType, PropertyOperator } from '~/types'@@ -501,3 +502,39 @@ export const CategoryDropdownPill: Story = {},},}++export const EmptyEventsWithStaleToggle: Story = {+ render: (args) => {+ useMountedLogic(actionsModel)+ const { setSearchQuery } = useActions(+ taxonomicFilterLogic({ ...args, taxonomicFilterLogicKey: args.taxonomicFilterLogicKey as string })+ )++ useOnMountEffect(() => setSearchQuery('my_ancient_event'))++ return (+ <div className="w-fit border rounded p-2 bg-surface-primary">+ <TaxonomicFilter {...args} />+ </div>+ )+ },+ args: {+ taxonomicFilterLogicKey: 'events-stale-toggle',+ taxonomicGroupTypes: [TaxonomicFilterGroupType.Events],+ },+ decorators: [+ mswDecorator({+ get: {+ '/api/projects/:team_id/event_definitions': [],+ },+ }),+ ],+ parameters: {+ testOptions: { waitForSelector: '[data-attr="taxonomic-include-stale-events"]' },+ docs: {+ description: {+ story: 'When a search on the Events tab returns no results (all matches are stale), an "Include stale events" button appears so users can opt in to seeing events older than 30 days.',+ },+ },+ },+}diff --git a/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts b/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.tsindex df7c34efa630..46a7cf390d60 100644--- a/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts+++ b/frontend/src/lib/components/TaxonomicFilter/infiniteListLogic.ts@@ -185,6 +185,7 @@ export const infiniteListLogic = kea<infiniteListLogicType>(['taxonomicGroupTypes','topMatchItemsWithSkeletons','anyGroupLoading',+ 'includeStaleEvents',],teamLogic,['currentTeamId'],@@ -195,7 +196,7 @@ export const infiniteListLogic = kea<infiniteListLogicType>([],actions: [taxonomicFilterLogic(props),- ['setSearchQuery', 'setActiveTab', 'selectItem', 'infiniteListResultsReceived'],+ ['setSearchQuery', 'setActiveTab', 'selectItem', 'infiniteListResultsReceived', 'setIncludeStaleEvents'],],})),actions({@@ -248,6 +249,9 @@ export const infiniteListLogic = kea<infiniteListLogicType>([return createEmptyListStorage(searchQuery)}+ const eventsTab =+ listGroupType === TaxonomicFilterGroupType.Events ||+ listGroupType === TaxonomicFilterGroupType.CustomEventsconst searchParams = {[`${values.group?.searchAlias || 'search'}`]: searchQuery,limit,@@ -261,6 +265,7 @@ export const infiniteListLogic = kea<infiniteListLogicType>([// TODO: remove this filter once we can support behavioral cohorts for feature flags, it's only// used in the feature flag property filter UI...(props.hideBehavioralCohorts ? { hide_behavioral_cohorts: 'true' } : {}),+ ...(eventsTab && !values.includeStaleEvents ? { exclude_stale: 'true' } : {}),}const start = performance.now()@@ -1033,6 +1038,14 @@ export const infiniteListLogic = kea<infiniteListLogicType>([}}},+ setIncludeStaleEvents: () => {+ const affectsThisTab =+ props.listGroupType === TaxonomicFilterGroupType.Events ||+ props.listGroupType === TaxonomicFilterGroupType.CustomEvents+ if (affectsThisTab && values.hasRemoteDataSource) {+ actions.loadRemoteItems({ offset: 0, limit: values.limit })+ }+ },togglePinnedRow: ({ rowIndex }) => {actions.setIndex(rowIndex)},diff --git a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsxindex e52fc4796b35..61127f53b2d9 100644--- a/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx+++ b/frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx@@ -54,6 +54,7 @@ import { IconCohort } from 'lib/lemon-ui/icons'import { Link } from 'lib/lemon-ui/Link'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { capitalizeFirstLetter, isString, objectsEqual, pluralize, toParams } from 'lib/utils'+import { isDefinitionStale } from 'lib/utils/definitions'import { getPrimaryPropertyForEvent } from 'lib/utils/primaryEventProperty'import {getEventDefinitionIcon,@@ -375,6 +376,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([items,}),openRevealBarrier: true,+ setIncludeStaleEvents: (includeStaleEvents: boolean) => ({ includeStaleEvents }),})),reducers(({ props, selectors }) => ({searchQuery: [@@ -456,6 +458,19 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([openRevealBarrier: () => true,},],+ includeStaleEvents: [+ // Per-session opt-in to surface event definitions whose last ingested occurrence+ // is older than STALE_EVENT_DAYS. Resets back to false on every fresh search so+ // the user re-opts in deliberately rather than carrying stale results across+ // unrelated queries.+ false,+ {+ setIncludeStaleEvents: (_, { includeStaleEvents }: { includeStaleEvents: boolean }) =>+ includeStaleEvents,+ setSearchQuery: () => false,+ setActiveTab: () => false,+ },+ ],})),selectors({selectedItemMeta: [() => [(_, props) => props.filter], (filter) => filter],@@ -1803,6 +1818,14 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([const wasFromRecents = hasRecentContext(item)const wasFromPinnedList = hasPinnedContext(item)+ const isEventTab =+ sourceGroupType === TaxonomicFilterGroupType.Events ||+ sourceGroupType === TaxonomicFilterGroupType.CustomEvents+ const wasStale =+ isEventTab && item && typeof item === 'object' && 'last_seen_at' in item+ ? isDefinitionStale(item)+ : undefined+posthog.capture('taxonomic filter item selected', {groupType: values.activeTab,sourceGroupType,@@ -1812,6 +1835,7 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([hadSearchInput,position: meta?.position,query: values.searchQuery || undefined,+ wasStale,...(wasQuickFilter && {filterName: item.name,propertyKey: item.propertyKey,@@ -1960,10 +1984,19 @@ export const taxonomicFilterLogic = kea<taxonomicFilterLogicType>([groupType: activeTaxonomicGroup?.type,inputMode,pastedFraction: totalLength > 0 ? Math.min(1, pastedChars / totalLength) : 0,+ excludeStale: !values.includeStaleEvents,})}},+ setIncludeStaleEvents: ({ includeStaleEvents }) => {+ posthog.capture('taxonomic filter include stale toggled', {+ includeStaleEvents,+ groupType: values.activeTab,+ searchQuery: values.searchQuery || undefined,+ })+ },+infiniteListResultsReceived: async ({ groupType, results }, breakpoint) => {if (groupType && !values.metaGroupTypes.has(groupType)) {const subLogic = values.infiniteListLogics[groupType]diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex 6da725a77441..a6081675b70b 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -124,7 +124,8 @@ export const EXPERIMENT_DEFAULT_DURATION = 14 // days// Event constantsexport const ACTION_TYPE = 'action_type'export const EVENT_TYPE = 'event_type'-export const STALE_EVENT_SECONDS = 30 * 24 * 60 * 60 // 30 days+export const STALE_EVENT_DAYS = 30+export const STALE_EVENT_SECONDS = STALE_EVENT_DAYS * 24 * 60 * 60/*** @deprecated should be removed once backend is updateddiff --git a/posthog/api/event_definition.py b/posthog/api/event_definition.pyindex dc4f4695f354..3ac31e16ed37 100644--- a/posthog/api/event_definition.py+++ b/posthog/api/event_definition.py@@ -30,7 +30,7 @@ from posthog.models.activity_logging.activity_log import Detail, log_activityfrom posthog.models.user import Userfrom posthog.models.utils import UUIDTfrom posthog.settings import EE_AVAILABLE-from posthog.taxonomy.taxonomy import CORE_EVENTS+from posthog.taxonomy.taxonomy import CORE_EVENTS, STALE_EVENT_DAYSfrom posthog.utils import get_safe_cache, relative_date_parse# If EE is enabled, we use ee.api.ee_event_definition.EnterpriseEventDefinitionSerializer@@ -266,6 +266,19 @@ class EventDefinitionViewSet(if exclude_hidden and EE_AVAILABLE:search_query = search_query + " AND (hidden IS NULL OR hidden = false)"+ exclude_stale = self.request.GET.get("exclude_stale", "false").lower() == "true"+ if exclude_stale:+ # `last_seen_at` is not indexed: the predicate runs after the project-scoped+ # pre-filter in `create_event_definitions_sql` has already narrowed the row+ # set per tenant, and the response is paginated. Worth re-checking with+ # EXPLAIN if the largest tenants start showing this in slow-query logs.+ search_query = (+ search_query+ + " AND (posthog_eventdefinition.last_seen_at IS NULL"+ + " OR posthog_eventdefinition.last_seen_at > NOW() - %(stale_interval)s::interval)"+ )+ params["stale_interval"] = f"{STALE_EVENT_DAYS} days"+verified_param = self.request.GET.get("verified")if verified_param is not None and EE_AVAILABLE:if verified_param.lower() == "true":@@ -343,6 +356,29 @@ class EventDefinitionViewSet(return results+ @extend_schema(+ parameters=[+ OpenApiParameter(+ "exclude_stale",+ OpenApiTypes.BOOL,+ location=OpenApiParameter.QUERY,+ required=False,+ description=(+ f"When true, omit events whose last ingested occurrence is older than {STALE_EVENT_DAYS} days. "+ "Events that have never been seen (`last_seen_at` is null) are kept so newly-defined events "+ "remain discoverable. Default false. If a search returns zero results with this filter on, "+ "retry with `exclude_stale=false` and tell the user the matches are stale."+ ),+ ),+ OpenApiParameter(+ "exclude_hidden",+ OpenApiTypes.BOOL,+ location=OpenApiParameter.QUERY,+ required=False,+ description="When true, omit events that have been explicitly hidden by a team admin (Enterprise only).",+ ),+ ],+ )def list(self, request, *args, **kwargs):queryset = self.filter_queryset(self.get_queryset())page = self.paginate_queryset(queryset)diff --git a/posthog/api/test/test_event_definition.py b/posthog/api/test/test_event_definition.pyindex bb02cbcabbaa..0a2ed903745c 100644--- a/posthog/api/test/test_event_definition.py+++ b/posthog/api/test/test_event_definition.py@@ -484,6 +484,43 @@ class TestEventDefinitionAPI(APIBaseTest):assert not other_team_event_exists+class TestEventDefinitionExcludeStale(APIBaseTest):+ """Stale filter tests need real wall-clock times so the Postgres NOW() comparison+ in `exclude_stale` matches the fixture last_seen_at values. The other test class is+ wrapped in freeze_time which Postgres NOW() does not respect."""++ @parameterized.expand(+ [+ (+ "default keeps stale events",+ "",+ {"fresh_event", "stale_event", "ancient_event", "never_seen_event"},+ ),+ (+ "explicit false keeps stale events",+ "?exclude_stale=false",+ {"fresh_event", "stale_event", "ancient_event", "never_seen_event"},+ ),+ (+ "true hides stale events but keeps never-seen",+ "?exclude_stale=true",+ {"fresh_event", "never_seen_event"},+ ),+ ]+ )+ def test_exclude_stale_filter(self, _description: str, query_string: str, expected_names: set[str]) -> None:+ now = timezone.now()+ EventDefinition.objects.create(team=self.team, name="fresh_event", last_seen_at=now - timedelta(days=1))+ EventDefinition.objects.create(team=self.team, name="stale_event", last_seen_at=now - timedelta(days=45))+ EventDefinition.objects.create(team=self.team, name="ancient_event", last_seen_at=now - timedelta(days=365))+ EventDefinition.objects.create(team=self.team, name="never_seen_event", last_seen_at=None)++ response = self.client.get(f"/api/projects/{self.team.pk}/event_definitions/{query_string}")+ assert response.status_code == status.HTTP_200_OK+ names = {row["name"] for row in response.json()["results"]}+ assert names == expected_names++@dataclasses.dataclassclass EventData:"""diff --git a/posthog/taxonomy/taxonomy.py b/posthog/taxonomy/taxonomy.pyindex 54b2f341021a..5c2ac4a4db99 100644--- a/posthog/taxonomy/taxonomy.py+++ b/posthog/taxonomy/taxonomy.py@@ -1,6 +1,8 @@import refrom typing import Literal, NotRequired, TypedDict+STALE_EVENT_DAYS = 30+class CoreFilterDefinition(TypedDict):"""Like the CoreFilterDefinition type in the frontend, except no JSX.Element allowed."""diff --git a/products/event_definitions/frontend/generated/api.schemas.ts b/products/event_definitions/frontend/generated/api.schemas.tsindex 2378b662d3ed..b033caf2e2e1 100644--- a/products/event_definitions/frontend/generated/api.schemas.ts+++ b/products/event_definitions/frontend/generated/api.schemas.ts@@ -249,6 +249,14 @@ export interface PrimaryPropertiesResponseApi {}export type EventDefinitionsListParams = {+ /**+ * When true, omit events that have been explicitly hidden by a team admin (Enterprise only).+ */+ exclude_hidden?: boolean+ /**+ * When true, omit events whose last ingested occurrence is older than 30 days. Events that have never been seen (`last_seen_at` is null) are kept so newly-defined events remain discoverable. Default false. If a search returns zero results with this filter on, retry with `exclude_stale=false` and tell the user the matches are stale.+ */+ exclude_stale?: boolean/*** Number of results to return per page.*/diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex a9cea5e0ae7e..f60b617008ca 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -43369,6 +43369,14 @@ export namespace Schemas {} as const;export type EventDefinitionsListParams = {+ /**+ * When true, omit events that have been explicitly hidden by a team admin (Enterprise only).+ */+ exclude_hidden?: boolean;+ /**+ * When true, omit events whose last ingested occurrence is older than 30 days. Events that have never been seen (`last_seen_at` is null) are kept so newly-defined events remain discoverable. Default false. If a search returns zero results with this filter on, retry with `exclude_stale=false` and tell the user the matches are stale.+ */+ exclude_stale?: boolean;/*** Number of results to return per page.*/