Skip to content

feat(taxonomic-filter): explicit opt-in for stale event results#59816

Merged
pauldambra merged 8 commits into
masterfrom
posthog-code/taxonomic-filter-exclude-stale-events
May 25, 2026
Merged

feat(taxonomic-filter): explicit opt-in for stale event results#59816
pauldambra merged 8 commits into
masterfrom
posthog-code/taxonomic-filter-exclude-stale-events

Conversation

@pauldambra
Copy link
Copy Markdown
Member

Problem

Changes

How did you test this code?

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Publish to changelog?

Docs update

🤖 Agent context

## Problem

The taxonomic filter's Events and Custom Events tabs were including event
definitions that hadn't been seen for more than 30 days alongside fresh
events, marking them visually with a "Stale" tag but not hiding them.
Users searching for a common term (`url`, `email`, `utm`) frequently end
up with stale or legacy events at positions where they expect current
ones. The MCP event_definitions tool had no way to make this same
distinction.

## Changes

Backend:
- New `STALE_EVENT_DAYS = 30` constant in `posthog/taxonomy/taxonomy.py`.
- New `?exclude_stale=true` query parameter on the
  `/api/projects/.../event_definitions/` list endpoint. Filters by
  `last_seen_at` against `NOW() - INTERVAL '30 days'`. Event definitions
  with a NULL `last_seen_at` (manually created, not yet ingested) are
  kept so newly-defined events remain discoverable.
- `@extend_schema(parameters=[...])` on the list method so the flag
  surfaces in OpenAPI / generated MCP tool definitions with a
  description telling LLM callers to retry with `exclude_stale=false`
  when a search returns zero results.
- Three parameterized backend tests in a dedicated `APIBaseTest`
  subclass (the existing test class is wrapped in `freeze_time`, which
  Postgres `NOW()` does not respect).

Frontend:
- `STALE_EVENT_SECONDS` in `lib/constants` now derives from a frontend
  `STALE_EVENT_DAYS = 30` so the threshold has a single value on each
  side rather than drifting independently.
- `infiniteListLogic.loadRemoteItems` adds `exclude_stale=true` to its
  `searchParams` for the Events / Custom Events tabs when the new
  `includeStaleEvents` reducer is `false`. Putting the flag in
  searchParams (rather than baking it into the tab's `endpoint` URL via
  `taxonomicGroups`) keeps the group definitions stable and avoided
  pushing the `taxonomicGroups` selector past kea's 16-input cap.
- New `setIncludeStaleEvents` action + reducer in
  `taxonomicFilterLogic`. Resets back to `false` on `setSearchQuery`
  and `setActiveTab` so the user has to re-opt-in for every new query.
- Empty-state "Include stale events" button shown only on the Events
  and Custom Events tabs after a search that returned no fresh
  matches.
- Telemetry additions (all additive — existing payload shapes
  unchanged):
  - `taxonomic_filter_search_query` gains `excludeStale`.
  - `taxonomic filter item selected` gains `wasStale` (only set for
    Events / Custom Events selections).
  - New `taxonomic filter include stale toggled` event captured when
    the user clicks the empty-state button.

MCP: types regenerated via `hogli build:openapi` so the new parameter
appears in `services/mcp/src/api/generated.ts` and
`products/event_definitions/frontend/generated/api.schemas.ts`.

## How did you test this code?

This PR was written by an agent. Automated tests run:
- `hogli test posthog/api/test/test_event_definition.py` — 37/37 pass,
  including the three new parameterized exclude_stale cases.
- `hogli test frontend/src/lib/components/TaxonomicFilter/` —
  362/362 pass.
- `ruff check` and `ruff format` on touched Python files — clean.
- `pnpm format` on touched frontend files — clean.
- `hogli build:openapi` — confirmed `exclude_stale` shows up in the
  generated MCP and frontend types with the retry-on-empty hint.

The agent did not manually click through the UI.

## 🤖 Agent context

Written by PostHog Code (Claude Opus 4.7). Discussion before
implementation considered whether the API should auto-fall-back to
including stale results on zero matches; we explicitly chose **not**
to, so the contract stays "`exclude_stale` is a pure filter" — the MCP
client is responsible for retrying with `exclude_stale=false` if it
wants stale results.

The frontend originally tried to thread `includeStaleEvents` through
`taxonomicGroups` as a 17th selector input — kea's selector tuple type
caps at 16, which broke logic mounting in tests. Reworked to inject
`exclude_stale` into searchParams inside `infiniteListLogic` instead,
which also avoids `taxonomicGroups` recomputing every time the toggle
flips.

This change defaults users to seeing fewer rows on the Events tab —
that's an ordering / position-0 effect. The taxonomic-filter skill
flags such changes for explicit human sign-off; the human asked for
this design.

Generated-By: PostHog Code
Task-Id: 2649f7ae-c1f7-40ae-8866-be024f3f1285
Copy link
Copy Markdown
Member Author

pauldambra commented May 24, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 24, 2026

🎭 Playwright didn't run on this PR — your changes touch code that could affect E2E behavior, but Playwright is opt-in via label now to keep CI cost down.

Add the run-playwright label if you want an E2E sweep before merging — CI will pick it up automatically.

Most PRs don't need this. Real regressions still get caught on master and fix-forward.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 24, 2026

Size Change: +4.32 kB (+0.01%)

Total Size: 79.8 MB

📦 View Changed
Filename Size Change
frontend/dist-report/exporter/_chunks/chunk 8.32 MB +1.07 kB (+0.01%)
frontend/dist-report/posthog-app/_chunks/chunk 8.52 MB +1.07 kB (+0.01%)
frontend/dist-report/render-query/src/render-query/render-query 27.1 MB +1.09 kB (0%)
frontend/dist-report/toolbar/src/toolbar/toolbar 15.6 MB +1.09 kB (+0.01%)
ℹ️ View Unchanged
Filename Size
frontend/dist-report/decompression-worker/src/scenes/session-recordings/player/snapshot-processing/decompressionWorker 2.85 kB
frontend/dist-report/exporter/_parent/products/actions/frontend/pages/Action 24.9 kB
frontend/dist-report/exporter/_parent/products/actions/frontend/pages/Actions 1.3 kB
frontend/dist-report/exporter/_parent/products/business_knowledge/frontend/scenes/BusinessKnowledgeScene 19 kB
frontend/dist-report/exporter/_parent/products/conversations/frontend/components/Assignee/CyclotronJobInputAssignee 1.64 kB
frontend/dist-report/exporter/_parent/products/conversations/frontend/components/SlaBusinessHours/CyclotronJobInputBusinessHours 3.02 kB
frontend/dist-report/exporter/_parent/products/conversations/frontend/components/TicketTags/CyclotronJobInputTicketTags 1.02 kB
frontend/dist-report/exporter/_parent/products/conversations/frontend/scenes/settings/SupportSettingsScene 1.78 kB
frontend/dist-report/exporter/_parent/products/conversations/frontend/scenes/ticket/SupportTicketScene 33.9 kB
frontend/dist-report/exporter/_parent/products/conversations/frontend/scenes/tickets/SupportTicketsScene 1.04 kB
frontend/dist-report/exporter/_parent/products/customer_analytics/frontend/CustomerAnalyticsScene 35.3 kB
frontend/dist-report/exporter/_parent/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/CustomerAnalyticsConfigurationScene 2.61 kB
frontend/dist-report/exporter/_parent/products/customer_analytics/frontend/scenes/CustomerJourneyBuilderScene/CustomerJourneyBuilderScene 2.15 kB
frontend/dist-report/exporter/_parent/products/customer_analytics/frontend/scenes/CustomerJourneyTemplatesScene/CustomerJourneyTemplatesScene 7.82 kB
frontend/dist-report/exporter/_parent/products/data_warehouse/DataWarehouseScene 46.7 kB
frontend/dist-report/exporter/_parent/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene 1.08 kB
frontend/dist-report/exporter/_parent/products/data_warehouse/frontend/scenes/SchemaScene/SchemaScene 24 kB
frontend/dist-report/exporter/_parent/products/data_warehouse/frontend/scenes/SourceScene/SourceScene 1.03 kB
frontend/dist-report/exporter/_parent/products/data_warehouse/frontend/scenes/SourcesScene/SourcesScene 6.27 kB
frontend/dist-report/exporter/_parent/products/deployments/frontend/Deployment 4.01 kB
frontend/dist-report/exporter/_parent/products/deployments/frontend/DeploymentProject 5.54 kB
frontend/dist-report/exporter/_parent/products/deployments/frontend/Deployments 9.27 kB
frontend/dist-report/exporter/_parent/products/early_access_features/frontend/EarlyAccessFeature 991 B
frontend/dist-report/exporter/_parent/products/early_access_features/frontend/EarlyAccessFeatures 3.2 kB
frontend/dist-report/exporter/_parent/products/endpoints/frontend/EndpointScene 40 kB
frontend/dist-report/exporter/_parent/products/endpoints/frontend/EndpointsScene 24 kB
frontend/dist-report/exporter/_parent/products/error_tracking/frontend/scenes/ErrorTrackingFingerprintsScene/ErrorTrackingIssueFingerprintsScene 7.34 kB
frontend/dist-report/exporter/_parent/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene 101 kB
frontend/dist-report/exporter/_parent/products/error_tracking/frontend/scenes/ErrorTrackingScene/ErrorTrackingScene 27.1 kB
frontend/dist-report/exporter/_parent/products/feature_flags/frontend/FeatureFlagTemplatesScene 7.34 kB
frontend/dist-report/exporter/_parent/products/games/368Hedgehogs/368Hedgehogs 5.58 kB
frontend/dist-report/exporter/_parent/products/games/FlappyHog/FlappyHog 6.09 kB
frontend/dist-report/exporter/_parent/products/legal_documents/frontend/scenes/LegalDocumentNewScene 59.7 kB
frontend/dist-report/exporter/_parent/products/legal_documents/frontend/scenes/LegalDocumentsScene 5.28 kB
frontend/dist-report/exporter/_parent/products/links/frontend/LinkScene 25.2 kB
frontend/dist-report/exporter/_parent/products/links/frontend/LinksScene 4.51 kB
frontend/dist-report/exporter/_parent/products/live_debugger/frontend/LiveDebugger 19.4 kB
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/clusters/LLMAnalyticsClusterScene 21.6 kB
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/clusters/LLMAnalyticsClustersScene 54.9 kB
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/datasets/LLMAnalyticsDatasetScene 20.9 kB
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/datasets/LLMAnalyticsDatasetsScene 3.59 kB
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/evaluations/EvaluationTemplates 881 B
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/evaluations/LLMAnalyticsEvaluation 59.8 kB
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/evaluations/LLMAnalyticsEvaluationsScene 28.1 kB
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/LLMAnalyticsScene 118 kB
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/LLMAnalyticsSessionScene 14.9 kB
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/LLMAnalyticsTraceScene 130 kB
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/LLMAnalyticsUsers 832 B
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/LLMASessionFeedbackDisplay 5.15 kB
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/playground/LLMAnalyticsPlaygroundScene 37.7 kB
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/prompts/LLMPromptScene 29.1 kB
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/prompts/LLMPromptsScene 4.79 kB
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/skills/LLMSkillScene 895 B
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/skills/LLMSkillsScene 912 B
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/tags/LLMAnalyticsTag 27.4 kB
frontend/dist-report/exporter/_parent/products/llm_analytics/frontend/tags/LLMAnalyticsTagsScene 7.26 kB
frontend/dist-report/exporter/_parent/products/logs/frontend/LogsScene 17.9 kB
frontend/dist-report/exporter/_parent/products/logs/frontend/scenes/LogsAlertDetailScene/LogsAlertDetailScene 17.3 kB
frontend/dist-report/exporter/_parent/products/logs/frontend/scenes/LogsSamplingDetailScene/LogsSamplingDetailScene 5.27 kB
frontend/dist-report/exporter/_parent/products/logs/frontend/scenes/LogsSamplingNewScene/LogsSamplingNewScene 2.21 kB
frontend/dist-report/exporter/_parent/products/managed_migrations/frontend/ManagedMigration 14.9 kB
frontend/dist-report/exporter/_parent/products/mcp_analytics/frontend/MCPAnalyticsScene 38.7 kB
frontend/dist-report/exporter/_parent/products/mcp_analytics/frontend/MCPAnalyticsToolDetail 18.5 kB
frontend/dist-report/exporter/_parent/products/metrics/frontend/MetricsScene 1.15 kB
frontend/dist-report/exporter/_parent/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart 6.95 kB
frontend/dist-report/exporter/_parent/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart 4.57 kB
frontend/dist-report/exporter/_parent/products/replay_vision/frontend/replay_scanners/ReplayScanner 22.2 kB
frontend/dist-report/exporter/_parent/products/replay_vision/frontend/replay_scanners/ReplayScannersScene 12.4 kB
frontend/dist-report/exporter/_parent/products/revenue_analytics/frontend/RevenueAnalyticsScene 25.9 kB
frontend/dist-report/exporter/_parent/products/session_summaries/frontend/SessionGroupSummariesTable 5.01 kB
frontend/dist-report/exporter/_parent/products/session_summaries/frontend/SessionGroupSummaryScene 19.2 kB
frontend/dist-report/exporter/_parent/products/tasks/frontend/TaskDetailScene 23.5 kB
frontend/dist-report/exporter/_parent/products/tasks/frontend/TaskTracker 14.6 kB
frontend/dist-report/exporter/_parent/products/tracing/frontend/TracingScene 54 kB
frontend/dist-report/exporter/_parent/products/user_interviews/frontend/UserInterview 6.81 kB
frontend/dist-report/exporter/_parent/products/user_interviews/frontend/UserInterviewResponse 5.64 kB
frontend/dist-report/exporter/_parent/products/user_interviews/frontend/UserInterviews 4.15 kB
frontend/dist-report/exporter/_parent/products/visual_review/frontend/scenes/VisualReviewIndexScene 2.52 kB
frontend/dist-report/exporter/_parent/products/visual_review/frontend/scenes/VisualReviewRunScene 44.6 kB
frontend/dist-report/exporter/_parent/products/visual_review/frontend/scenes/VisualReviewRunsScene 7.28 kB
frontend/dist-report/exporter/_parent/products/visual_review/frontend/scenes/VisualReviewSettingsScene 11.1 kB
frontend/dist-report/exporter/_parent/products/visual_review/frontend/scenes/VisualReviewSnapshotHistoryScene 13.9 kB
frontend/dist-report/exporter/_parent/products/visual_review/frontend/scenes/VisualReviewSnapshotOverviewScene 19.5 kB
frontend/dist-report/exporter/_parent/products/workflows/frontend/TemplateLibrary/MessageTemplate 16.6 kB
frontend/dist-report/exporter/_parent/products/workflows/frontend/Workflows/WorkflowScene 111 kB
frontend/dist-report/exporter/_parent/products/workflows/frontend/WorkflowsScene 60.1 kB
frontend/dist-report/exporter/src/exporter/exporter 19.1 kB
frontend/dist-report/exporter/src/exporter/scenes/ExporterDashboardScene 1.95 kB
frontend/dist-report/exporter/src/exporter/scenes/ExporterHeatmapScene 19.6 kB
frontend/dist-report/exporter/src/exporter/scenes/ExporterInsightScene 2.98 kB
frontend/dist-report/exporter/src/exporter/scenes/ExporterInterviewScene 309 kB
frontend/dist-report/exporter/src/exporter/scenes/ExporterNotebookScene 2.71 MB
frontend/dist-report/exporter/src/exporter/scenes/ExporterRecordingScene 1.1 kB
frontend/dist-report/exporter/src/exporterSharedChunkAnchors 1.19 kB
frontend/dist-report/exporter/src/lib/components/Cards/TextCard/TextCardMarkdownEditor 11.3 kB
frontend/dist-report/exporter/src/lib/components/MonacoDiffEditor 471 B
frontend/dist-report/exporter/src/lib/lemon-ui/LemonMarkdown/MermaidDiagram 2.22 kB
frontend/dist-report/exporter/src/lib/lemon-ui/LemonTextArea/LemonTextAreaMarkdown 808 B
frontend/dist-report/exporter/src/lib/lemon-ui/Link/Link 359 B
frontend/dist-report/exporter/src/lib/monaco/CodeEditorInline 798 B
frontend/dist-report/exporter/src/lib/monaco/vimMode 211 kB
frontend/dist-report/exporter/src/lib/ui/Button/ButtonPrimitives 422 B
frontend/dist-report/exporter/src/queries/nodes/WebVitals/WebVitals 7.48 kB
frontend/dist-report/exporter/src/queries/nodes/WebVitals/WebVitalsPathBreakdown 3.96 kB
frontend/dist-report/exporter/src/queries/schema 723 kB
frontend/dist-report/exporter/src/scenes/approvals/changeRequestsLogic 850 B
frontend/dist-report/exporter/src/scenes/authentication/passkeyLogic 790 B
frontend/dist-report/exporter/src/scenes/data-pipelines/TransformationsScene 6.51 kB
frontend/dist-report/exporter/src/scenes/insights/views/BoxPlot/BoxPlot 5.36 kB
frontend/dist-report/exporter/src/scenes/insights/views/CalendarHeatMap/CalendarHeatMap 9.11 kB
frontend/dist-report/exporter/src/scenes/insights/views/RegionMap/RegionMap 29.7 kB
frontend/dist-report/exporter/src/scenes/insights/views/WorldMap/WorldMap 1.04 MB
frontend/dist-report/exporter/src/scenes/models/ModelsScene 19 kB
frontend/dist-report/exporter/src/scenes/models/NodeDetailScene 17 kB
frontend/dist-report/monaco-editor-worker/src/lib/monaco/workers/monacoEditorWorker 288 kB
frontend/dist-report/monaco-json-worker/src/lib/monaco/workers/monacoJsonWorker 419 kB
frontend/dist-report/monaco-typescript-worker/src/lib/monaco/workers/monacoTsWorker 7.02 MB
frontend/dist-report/posthog-app/_parent/products/actions/frontend/pages/Action 25.1 kB
frontend/dist-report/posthog-app/_parent/products/actions/frontend/pages/Actions 1.36 kB
frontend/dist-report/posthog-app/_parent/products/business_knowledge/frontend/scenes/BusinessKnowledgeScene 19 kB
frontend/dist-report/posthog-app/_parent/products/conversations/frontend/components/Assignee/CyclotronJobInputAssignee 1.67 kB
frontend/dist-report/posthog-app/_parent/products/conversations/frontend/components/SlaBusinessHours/CyclotronJobInputBusinessHours 3.06 kB
frontend/dist-report/posthog-app/_parent/products/conversations/frontend/components/TicketTags/CyclotronJobInputTicketTags 1.06 kB
frontend/dist-report/posthog-app/_parent/products/conversations/frontend/scenes/settings/SupportSettingsScene 1.82 kB
frontend/dist-report/posthog-app/_parent/products/conversations/frontend/scenes/ticket/SupportTicketScene 26.6 kB
frontend/dist-report/posthog-app/_parent/products/conversations/frontend/scenes/tickets/SupportTicketsScene 1.07 kB
frontend/dist-report/posthog-app/_parent/products/customer_analytics/frontend/CustomerAnalyticsScene 34 kB
frontend/dist-report/posthog-app/_parent/products/customer_analytics/frontend/scenes/CustomerAnalyticsConfigurationScene/CustomerAnalyticsConfigurationScene 2.65 kB
frontend/dist-report/posthog-app/_parent/products/customer_analytics/frontend/scenes/CustomerJourneyBuilderScene/CustomerJourneyBuilderScene 2.18 kB
frontend/dist-report/posthog-app/_parent/products/customer_analytics/frontend/scenes/CustomerJourneyTemplatesScene/CustomerJourneyTemplatesScene 7.86 kB
frontend/dist-report/posthog-app/_parent/products/data_warehouse/DataWarehouseScene 1.74 kB
frontend/dist-report/posthog-app/_parent/products/data_warehouse/frontend/scenes/NewSourceScene/NewSourceScene 1.15 kB
frontend/dist-report/posthog-app/_parent/products/data_warehouse/frontend/scenes/SchemaScene/SchemaScene 24.1 kB
frontend/dist-report/posthog-app/_parent/products/data_warehouse/frontend/scenes/SourceScene/SourceScene 1.06 kB
frontend/dist-report/posthog-app/_parent/products/data_warehouse/frontend/scenes/SourcesScene/SourcesScene 6.31 kB
frontend/dist-report/posthog-app/_parent/products/deployments/frontend/Deployment 4.05 kB
frontend/dist-report/posthog-app/_parent/products/deployments/frontend/DeploymentProject 5.58 kB
frontend/dist-report/posthog-app/_parent/products/deployments/frontend/Deployments 9.31 kB
frontend/dist-report/posthog-app/_parent/products/early_access_features/frontend/EarlyAccessFeature 1.16 kB
frontend/dist-report/posthog-app/_parent/products/early_access_features/frontend/EarlyAccessFeatures 3.24 kB
frontend/dist-report/posthog-app/_parent/products/endpoints/frontend/EndpointScene 40.1 kB
frontend/dist-report/posthog-app/_parent/products/endpoints/frontend/EndpointsScene 21.9 kB
frontend/dist-report/posthog-app/_parent/products/error_tracking/frontend/scenes/ErrorTrackingFingerprintsScene/ErrorTrackingIssueFingerprintsScene 7.38 kB
frontend/dist-report/posthog-app/_parent/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ErrorTrackingIssueScene 101 kB
frontend/dist-report/posthog-app/_parent/products/error_tracking/frontend/scenes/ErrorTrackingScene/ErrorTrackingScene 27.1 kB
frontend/dist-report/posthog-app/_parent/products/feature_flags/frontend/FeatureFlagTemplatesScene 7.38 kB
frontend/dist-report/posthog-app/_parent/products/games/368Hedgehogs/368Hedgehogs 5.61 kB
frontend/dist-report/posthog-app/_parent/products/games/FlappyHog/FlappyHog 6.12 kB
frontend/dist-report/posthog-app/_parent/products/legal_documents/frontend/scenes/LegalDocumentNewScene 59.7 kB
frontend/dist-report/posthog-app/_parent/products/legal_documents/frontend/scenes/LegalDocumentsScene 5.31 kB
frontend/dist-report/posthog-app/_parent/products/links/frontend/LinkScene 25.2 kB
frontend/dist-report/posthog-app/_parent/products/links/frontend/LinksScene 4.55 kB
frontend/dist-report/posthog-app/_parent/products/live_debugger/frontend/LiveDebugger 19.5 kB
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/clusters/LLMAnalyticsClusterScene 21.7 kB
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/clusters/LLMAnalyticsClustersScene 55 kB
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/datasets/LLMAnalyticsDatasetScene 21 kB
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/datasets/LLMAnalyticsDatasetsScene 3.63 kB
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/evaluations/EvaluationTemplates 915 B
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/evaluations/LLMAnalyticsEvaluation 59.8 kB
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/evaluations/LLMAnalyticsEvaluationsScene 28.1 kB
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/LLMAnalyticsScene 119 kB
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/LLMAnalyticsSessionScene 15 kB
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/LLMAnalyticsTraceScene 130 kB
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/LLMAnalyticsUsers 866 B
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/LLMASessionFeedbackDisplay 5.18 kB
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/playground/LLMAnalyticsPlaygroundScene 37.7 kB
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/prompts/LLMPromptScene 29.2 kB
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/prompts/LLMPromptsScene 4.82 kB
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/skills/LLMSkillScene 929 B
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/skills/LLMSkillsScene 946 B
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/tags/LLMAnalyticsTag 27.4 kB
frontend/dist-report/posthog-app/_parent/products/llm_analytics/frontend/tags/LLMAnalyticsTagsScene 7.29 kB
frontend/dist-report/posthog-app/_parent/products/logs/frontend/LogsScene 17.8 kB
frontend/dist-report/posthog-app/_parent/products/logs/frontend/scenes/LogsAlertDetailScene/LogsAlertDetailScene 17.3 kB
frontend/dist-report/posthog-app/_parent/products/logs/frontend/scenes/LogsSamplingDetailScene/LogsSamplingDetailScene 5.31 kB
frontend/dist-report/posthog-app/_parent/products/logs/frontend/scenes/LogsSamplingNewScene/LogsSamplingNewScene 2.26 kB
frontend/dist-report/posthog-app/_parent/products/managed_migrations/frontend/ManagedMigration 14.9 kB
frontend/dist-report/posthog-app/_parent/products/mcp_analytics/frontend/MCPAnalyticsScene 38.7 kB
frontend/dist-report/posthog-app/_parent/products/mcp_analytics/frontend/MCPAnalyticsToolDetail 18.5 kB
frontend/dist-report/posthog-app/_parent/products/metrics/frontend/MetricsScene 1.18 kB
frontend/dist-report/posthog-app/_parent/products/product_analytics/frontend/insights/trends/TrendsBarChart/TrendsBarChart 6.99 kB
frontend/dist-report/posthog-app/_parent/products/product_analytics/frontend/insights/trends/TrendsLineChart/TrendsLineChart 4.61 kB
frontend/dist-report/posthog-app/_parent/products/replay_vision/frontend/replay_scanners/ReplayScanner 22.2 kB
frontend/dist-report/posthog-app/_parent/products/replay_vision/frontend/replay_scanners/ReplayScannersScene 12.5 kB
frontend/dist-report/posthog-app/_parent/products/revenue_analytics/frontend/RevenueAnalyticsScene 26 kB
frontend/dist-report/posthog-app/_parent/products/session_summaries/frontend/SessionGroupSummariesTable 5.05 kB
frontend/dist-report/posthog-app/_parent/products/session_summaries/frontend/SessionGroupSummaryScene 19.2 kB
frontend/dist-report/posthog-app/_parent/products/tasks/frontend/TaskDetailScene 23.6 kB
frontend/dist-report/posthog-app/_parent/products/tasks/frontend/TaskTracker 14.6 kB
frontend/dist-report/posthog-app/_parent/products/tracing/frontend/TracingScene 54.1 kB
frontend/dist-report/posthog-app/_parent/products/user_interviews/frontend/UserInterview 6.85 kB
frontend/dist-report/posthog-app/_parent/products/user_interviews/frontend/UserInterviewResponse 5.68 kB
frontend/dist-report/posthog-app/_parent/products/user_interviews/frontend/UserInterviews 4.19 kB
frontend/dist-report/posthog-app/_parent/products/visual_review/frontend/scenes/VisualReviewIndexScene 2.56 kB
frontend/dist-report/posthog-app/_parent/products/visual_review/frontend/scenes/VisualReviewRunScene 44.7 kB
frontend/dist-report/posthog-app/_parent/products/visual_review/frontend/scenes/VisualReviewRunsScene 7.32 kB
frontend/dist-report/posthog-app/_parent/products/visual_review/frontend/scenes/VisualReviewSettingsScene 11.1 kB
frontend/dist-report/posthog-app/_parent/products/visual_review/frontend/scenes/VisualReviewSnapshotHistoryScene 13.9 kB
frontend/dist-report/posthog-app/_parent/products/visual_review/frontend/scenes/VisualReviewSnapshotOverviewScene 19.6 kB
frontend/dist-report/posthog-app/_parent/products/workflows/frontend/TemplateLibrary/MessageTemplate 16.6 kB
frontend/dist-report/posthog-app/_parent/products/workflows/frontend/Workflows/WorkflowScene 104 kB
frontend/dist-report/posthog-app/_parent/products/workflows/frontend/WorkflowsScene 60.2 kB
frontend/dist-report/posthog-app/src/index 61 kB
frontend/dist-report/posthog-app/src/layout/panel-layout/ai-first/tabs/NavTabChat 6.85 kB
frontend/dist-report/posthog-app/src/lib/components/Cards/TextCard/TextCardMarkdownEditor 11.3 kB
frontend/dist-report/posthog-app/src/lib/components/MonacoDiffEditor 471 B
frontend/dist-report/posthog-app/src/lib/lemon-ui/LemonMarkdown/MermaidDiagram 2.25 kB
frontend/dist-report/posthog-app/src/lib/lemon-ui/LemonTextArea/LemonTextAreaMarkdown 842 B
frontend/dist-report/posthog-app/src/lib/lemon-ui/Link/Link 359 B
frontend/dist-report/posthog-app/src/lib/monaco/CodeEditorInline 832 B
frontend/dist-report/posthog-app/src/lib/monaco/vimMode 211 kB
frontend/dist-report/posthog-app/src/lib/ui/Button/ButtonPrimitives 426 B
frontend/dist-report/posthog-app/src/queries/nodes/WebVitals/WebVitals 7.52 kB
frontend/dist-report/posthog-app/src/queries/nodes/WebVitals/WebVitalsPathBreakdown 4 kB
frontend/dist-report/posthog-app/src/queries/schema 723 kB
frontend/dist-report/posthog-app/src/scenes/activity/explore/EventsScene 3.28 kB
frontend/dist-report/posthog-app/src/scenes/activity/explore/SessionsScene 4.69 kB
frontend/dist-report/posthog-app/src/scenes/activity/live/LiveEventsTable 5.58 kB
frontend/dist-report/posthog-app/src/scenes/agentic/AgenticAuthorize 5.84 kB
frontend/dist-report/posthog-app/src/scenes/approvals/ApprovalDetail 16.6 kB
frontend/dist-report/posthog-app/src/scenes/approvals/changeRequestsLogic 884 B
frontend/dist-report/posthog-app/src/scenes/audit-logs/AdvancedActivityLogsScene 40 kB
frontend/dist-report/posthog-app/src/scenes/AuthenticatedShell 171 kB
frontend/dist-report/posthog-app/src/scenes/authentication/AccountConnected 3.33 kB
frontend/dist-report/posthog-app/src/scenes/authentication/AgenticAccountMismatch 2.73 kB
frontend/dist-report/posthog-app/src/scenes/authentication/CLIAuthorize 11.7 kB
frontend/dist-report/posthog-app/src/scenes/authentication/CLILive 4.37 kB
frontend/dist-report/posthog-app/src/scenes/authentication/credential-review/CredentialReview 3.9 kB
frontend/dist-report/posthog-app/src/scenes/authentication/EmailMFAVerify 3.36 kB
frontend/dist-report/posthog-app/src/scenes/authentication/InviteSignup 15.4 kB
frontend/dist-report/posthog-app/src/scenes/authentication/Login 10.2 kB
frontend/dist-report/posthog-app/src/scenes/authentication/Login2FA 4.6 kB
frontend/dist-report/posthog-app/src/scenes/authentication/passkeyLogic 824 B
frontend/dist-report/posthog-app/src/scenes/authentication/PasswordReset 4.71 kB
frontend/dist-report/posthog-app/src/scenes/authentication/PasswordResetComplete 3.34 kB
frontend/dist-report/posthog-app/src/scenes/authentication/signup/SignupContainer 28.5 kB
frontend/dist-report/posthog-app/src/scenes/authentication/signup/verify-email/VerifyEmail 5.12 kB
frontend/dist-report/posthog-app/src/scenes/authentication/TwoFactorReset 4.37 kB
frontend/dist-report/posthog-app/src/scenes/authentication/VercelConnect 5.33 kB
frontend/dist-report/posthog-app/src/scenes/authentication/VercelLinkError 2.61 kB
frontend/dist-report/posthog-app/src/scenes/billing/AuthorizationStatus 1.07 kB
frontend/dist-report/posthog-app/src/scenes/billing/Billing 833 B
frontend/dist-report/posthog-app/src/scenes/billing/BillingSection 21.1 kB
frontend/dist-report/posthog-app/src/scenes/cohorts/Cohort 28.4 kB
frontend/dist-report/posthog-app/src/scenes/cohorts/CohortCalculationHistory 6.58 kB
frontend/dist-report/posthog-app/src/scenes/cohorts/Cohorts 9.78 kB
frontend/dist-report/posthog-app/src/scenes/coupons/Coupons 1.06 kB
frontend/dist-report/posthog-app/src/scenes/dashboard/Dashboard 1.62 kB
frontend/dist-report/posthog-app/src/scenes/dashboard/dashboards/Dashboards 19.8 kB
frontend/dist-report/posthog-app/src/scenes/dashboard/dashboards/templates/DashboardTemplateCopyScene 6.06 kB
frontend/dist-report/posthog-app/src/scenes/data-management/DataManagementScene 986 B
frontend/dist-report/posthog-app/src/scenes/data-management/definition/DefinitionEdit 17.2 kB
frontend/dist-report/posthog-app/src/scenes/data-management/definition/DefinitionView 24.4 kB
frontend/dist-report/posthog-app/src/scenes/data-management/MaterializedColumns/MaterializedColumns 12 kB
frontend/dist-report/posthog-app/src/scenes/data-management/variables/SqlVariableEditScene 7.6 kB
frontend/dist-report/posthog-app/src/scenes/data-pipelines/batch-exports/BatchExportScene 60.9 kB
frontend/dist-report/posthog-app/src/scenes/data-pipelines/DataPipelinesNewScene 2.66 kB
frontend/dist-report/posthog-app/src/scenes/data-pipelines/DestinationsScene 3.03 kB
frontend/dist-report/posthog-app/src/scenes/data-pipelines/legacy-plugins/LegacyPluginScene 21 kB
frontend/dist-report/posthog-app/src/scenes/data-pipelines/TransformationsScene 2.27 kB
frontend/dist-report/posthog-app/src/scenes/data-pipelines/WebScriptsScene 2.89 kB
frontend/dist-report/posthog-app/src/scenes/data-warehouse/DataWarehouseScene 1.69 kB
frontend/dist-report/posthog-app/src/scenes/data-warehouse/editor/EditorScene 1.48 kB
frontend/dist-report/posthog-app/src/scenes/debug/DebugScene 20.3 kB
frontend/dist-report/posthog-app/src/scenes/debug/hog/HogRepl 7.72 kB
frontend/dist-report/posthog-app/src/scenes/experiments/Experiment 206 kB
frontend/dist-report/posthog-app/src/scenes/experiments/Experiments 20.4 kB
frontend/dist-report/posthog-app/src/scenes/experiments/SharedMetrics/SharedMetric 6.41 kB
frontend/dist-report/posthog-app/src/scenes/experiments/SharedMetrics/SharedMetrics 889 B
frontend/dist-report/posthog-app/src/scenes/exports/ExportsScene 4.33 kB
frontend/dist-report/posthog-app/src/scenes/feature-flags/FeatureFlag 146 kB
frontend/dist-report/posthog-app/src/scenes/feature-flags/FeatureFlags 1.08 kB
frontend/dist-report/posthog-app/src/scenes/groups/Group 15.4 kB
frontend/dist-report/posthog-app/src/scenes/groups/Groups 4.26 kB
frontend/dist-report/posthog-app/src/scenes/groups/GroupsNew 7.69 kB
frontend/dist-report/posthog-app/src/scenes/health/categoryDetail/HealthCategoryDetailScene 7.59 kB
frontend/dist-report/posthog-app/src/scenes/health/HealthScene 12.5 kB
frontend/dist-report/posthog-app/src/scenes/health/pipelineStatus/PipelineStatusScene 9.45 kB
frontend/dist-report/posthog-app/src/scenes/heatmaps/scenes/heatmap/HeatmapNewScene 5.38 kB
frontend/dist-report/posthog-app/src/scenes/heatmaps/scenes/heatmap/HeatmapRecordingScene 4.27 kB
frontend/dist-report/posthog-app/src/scenes/heatmaps/scenes/heatmap/HeatmapScene 6.9 kB
frontend/dist-report/posthog-app/src/scenes/heatmaps/scenes/heatmaps/HeatmapsScene 4.23 kB
frontend/dist-report/posthog-app/src/scenes/hog-functions/HogFunctionScene 59.6 kB
frontend/dist-report/posthog-app/src/scenes/inbox/InboxScene 63.3 kB
frontend/dist-report/posthog-app/src/scenes/insights/InsightQuickStart/InsightQuickStart 5.77 kB
frontend/dist-report/posthog-app/src/scenes/insights/InsightScene 34.7 kB
frontend/dist-report/posthog-app/src/scenes/insights/views/BoxPlot/BoxPlot 5.39 kB
frontend/dist-report/posthog-app/src/scenes/insights/views/CalendarHeatMap/CalendarHeatMap 5.14 kB
frontend/dist-report/posthog-app/src/scenes/insights/views/RegionMap/RegionMap 29.8 kB
frontend/dist-report/posthog-app/src/scenes/insights/views/WorldMap/WorldMap 5.13 kB
frontend/dist-report/posthog-app/src/scenes/instance/AsyncMigrations/AsyncMigrations 13.5 kB
frontend/dist-report/posthog-app/src/scenes/instance/DeadLetterQueue/DeadLetterQueue 5.74 kB
frontend/dist-report/posthog-app/src/scenes/instance/QueryPerformance/QueryPerformance 8.97 kB
frontend/dist-report/posthog-app/src/scenes/instance/SystemStatus/SystemStatus 17.4 kB
frontend/dist-report/posthog-app/src/scenes/IntegrationsRedirect/IntegrationsRedirect 1.08 kB
frontend/dist-report/posthog-app/src/scenes/marketing-analytics/MarketingAnalyticsScene 40.5 kB
frontend/dist-report/posthog-app/src/scenes/max/Max 990 B
frontend/dist-report/posthog-app/src/scenes/models/ModelsScene 19 kB
frontend/dist-report/posthog-app/src/scenes/models/NodeDetailScene 17 kB
frontend/dist-report/posthog-app/src/scenes/moveToPostHogCloud/MoveToPostHogCloud 4.81 kB
frontend/dist-report/posthog-app/src/scenes/new-tab/NewTabScene 1.82 kB
frontend/dist-report/posthog-app/src/scenes/notebooks/NotebookCanvasScene 3.82 kB
frontend/dist-report/posthog-app/src/scenes/notebooks/NotebookPanel/NotebookPanel 5.79 kB
frontend/dist-report/posthog-app/src/scenes/notebooks/NotebookScene 9.03 kB
frontend/dist-report/posthog-app/src/scenes/notebooks/NotebooksScene 7.95 kB
frontend/dist-report/posthog-app/src/scenes/oauth/OAuthAuthorize 980 B
frontend/dist-report/posthog-app/src/scenes/onboarding/coupon/OnboardingCouponRedemption 1.55 kB
frontend/dist-report/posthog-app/src/scenes/onboarding/Onboarding 790 kB
frontend/dist-report/posthog-app/src/scenes/onboarding/sdks/SdkDoctorScene 9.77 kB
frontend/dist-report/posthog-app/src/scenes/organization/ConfirmOrganization/ConfirmOrganization 4.87 kB
frontend/dist-report/posthog-app/src/scenes/organization/Create/Create 1 kB
frontend/dist-report/posthog-app/src/scenes/organization/Deactivated 1.48 kB
frontend/dist-report/posthog-app/src/scenes/organization/PendingDeletion 2.45 kB
frontend/dist-report/posthog-app/src/scenes/persons/PersonScene 19 kB
frontend/dist-report/posthog-app/src/scenes/persons/PersonsScene 6.09 kB
frontend/dist-report/posthog-app/src/scenes/PreflightCheck/PreflightCheck 5.91 kB
frontend/dist-report/posthog-app/src/scenes/product-tours/ProductTour 275 kB
frontend/dist-report/posthog-app/src/scenes/product-tours/ProductTours 5.03 kB
frontend/dist-report/posthog-app/src/scenes/project-homepage/ProjectHomepage 18.4 kB
frontend/dist-report/posthog-app/src/scenes/project/Create/Create 1.18 kB
frontend/dist-report/posthog-app/src/scenes/resource-transfer/ResourceTransfer 9.53 kB
frontend/dist-report/posthog-app/src/scenes/saved-insights/SavedInsights 1 kB
frontend/dist-report/posthog-app/src/scenes/session-recordings/detail/SessionRecordingDetail 2.1 kB
frontend/dist-report/posthog-app/src/scenes/session-recordings/file-playback/SessionRecordingFilePlaybackScene 4.82 kB
frontend/dist-report/posthog-app/src/scenes/session-recordings/kiosk/SessionRecordingsKiosk 10.3 kB
frontend/dist-report/posthog-app/src/scenes/session-recordings/player/snapshot-processing/DecompressionWorkerManager 329 B
frontend/dist-report/posthog-app/src/scenes/session-recordings/playlist/SessionRecordingsPlaylistScene 5.45 kB
frontend/dist-report/posthog-app/src/scenes/session-recordings/SessionRecordings 1.12 kB
frontend/dist-report/posthog-app/src/scenes/session-recordings/settings/SessionRecordingsSettingsScene 2.31 kB
frontend/dist-report/posthog-app/src/scenes/sessions/SessionProfileScene 15.4 kB
frontend/dist-report/posthog-app/src/scenes/settings/SettingsScene 3.9 kB
frontend/dist-report/posthog-app/src/scenes/sites/Site 1.53 kB
frontend/dist-report/posthog-app/src/scenes/startups/StartupProgram 21.5 kB
frontend/dist-report/posthog-app/src/scenes/StripeConfirmInstall/StripeConfirmInstall 3.88 kB
frontend/dist-report/posthog-app/src/scenes/subscriptions/SubscriptionScene 14.5 kB
frontend/dist-report/posthog-app/src/scenes/subscriptions/SubscriptionsScene 5.53 kB
frontend/dist-report/posthog-app/src/scenes/surveys/forms/SurveyFormBuilder 1.89 kB
frontend/dist-report/posthog-app/src/scenes/surveys/Survey 1.36 kB
frontend/dist-report/posthog-app/src/scenes/surveys/Surveys 26.7 kB
frontend/dist-report/posthog-app/src/scenes/surveys/wizard/SurveyWizard 72.7 kB
frontend/dist-report/posthog-app/src/scenes/themes/CustomCssScene 3.91 kB
frontend/dist-report/posthog-app/src/scenes/toolbar-launch/ToolbarLaunch 2.82 kB
frontend/dist-report/posthog-app/src/scenes/Unsubscribe/Unsubscribe 2 kB
frontend/dist-report/posthog-app/src/scenes/web-analytics/SessionAttributionExplorer/SessionAttributionExplorerScene 6.97 kB
frontend/dist-report/posthog-app/src/scenes/web-analytics/WebAnalyticsScene 10.5 kB
frontend/dist-report/posthog-app/src/scenes/wizard/Wizard 4.8 kB
frontend/dist-report/posthog-app/src/sharedChunkAnchors 1.19 kB

compressed-size-action

@github-actions
Copy link
Copy Markdown
Contributor

ClickHouse migration SQL per cloud environment

No ClickHouse migrations changed in this PR.

@pauldambra
Copy link
Copy Markdown
Member Author

Note

🤖 Automated comment by QA Swarm — not written by a human

Verdict: 💬 APPROVE WITH NITS (MEDIUM)

Four reviewer perspectives applied (qa-team, paul-reviewer, xp-reviewer, security-audit). The stale-events behaviour is well-scoped, the SQL is parameterised, tenant isolation is preserved by the upstream WHERE (project_id = %(project_id)s OR (project_id IS NULL AND team_id = %(project_id)s)) in create_event_definitions_sql, and the new test class is parameterised with a clear comment justifying why freeze_time had to be dropped (Postgres NOW() doesn't honour it). Nice touch.

Findings below are all non-blocking.


🟡 MEDIUM

[security + database] SQL predicate has no supporting indexposthog/api/event_definition.py:269-276

last_seen_at > NOW() - %(stale_interval)s::interval will sequential-scan posthog_eventdefinition rows for the team. For most teams this is fine (already team-scoped + LIMITed) but for teams with very wide event-definition tables this becomes the dominant cost in the autocomplete hot path. Worth a quick EXPLAIN against a large tenant — if it's slow, a partial/expression index on (team_id, last_seen_at) would help. Not blocking.

[paul + xp] Unsafe-ish cast item as EventDefinitionfrontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx:963 (convergent: paul + xp)

The cast is guarded by sourceGroupType === Events || CustomEvents, but the underlying TaxonomicFilterValue for the Events tab can include action-like shapes in some call sites. It happens to be benign because isDefinitionStale only reads last_seen_at and tolerates undefined — but the cast hides that contract. A narrow type guard ("last_seen_at" in item ? isDefinitionStale(item) : undefined) would document the safe path without as. Not blocking — the failure mode is "returns undefined" which is already the non-events-tab path.

🟢 LOW / NIT

[paul] Comment in reducer says what not whyfrontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx:460-463

The 4-line block comment explains the resetting behaviour. The reducer itself (with setSearchQuery: () => false, setActiveTab: () => false) already says this. The "why" — re-opt-in deliberately rather than carry stale results across unrelated queries — is the only sentence worth keeping, and even that is arguable. Up to you.

[paul] Empty-state-only placement of the togglefrontend/src/lib/components/TaxonomicFilter/InfiniteList.tsx:689-697

Once you've clicked "Include stale events" and the list populates, the toggle disappears. You can only turn it back off by setting a new search or switching tabs (which is the implicit reset). i wonder if folks will hunt for it. data-attr is in place which is great — the taxonomic filter include stale toggled event will tell us if users actually do this more than once per session. ship as you see fit.

[xp] STALE_EVENT_DAYS duplicated across frontend + backendfrontend/src/lib/constants.tsx:127 and posthog/taxonomy/taxonomy.py:4

Both constants are 30 and conceptually the same business rule. Today the backend constant is what actually filters and the frontend constant just feeds isDefinitionStale for the wasStale telemetry. If someone bumps one and forgets the other, the telemetry and the filter diverge silently. Not a blocker — they're 1 line each — but worth a comment cross-linking them, or pulling the value into a single source if there's an obvious place.

[security] Tenant isolation preserved — informational

Confirmed: the new predicate is appended to search_query which is concatenated into the WHERE clause of create_event_definitions_sql after the team/project filter on posthog_eventdefinition.team_id / project_id. No bypass. The %(stale_interval)s parameter is bound, not interpolated.


Convergence

Finding Reviewers
Cast safety on item as EventDefinition paul + xp
No supporting index on last_seen_at predicate qa-team-database + security-audit-perf

Per-reviewer assessment

Reviewer Risk One-line take
🔒 security-audit 🟢 LOW Parameter binding correct, team scoping intact, no PII added to telemetry.
🗄️ qa-team (database/perf) 🟡 MEDIUM New predicate adds a last_seen_at filter with no index; fine for typical tenants, worth confirming on the largest.
🧑‍💻 paul-reviewer 🟢 LOW data-attr ✅, comment-explaining-what ❌, cast smells, ship as you see fit.
🎓 xp-reviewer 🟡 MEDIUM Tests are parameterised (loved that), but two 30s in two languages is duplication waiting to drift.

Copy link
Copy Markdown
Member Author

@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

🤖 Automated comment by QA Swarm — not written by a human

Inline findings from a 4-perspective review (qa-team, paul-reviewer, xp-reviewer, security-audit). Top-level summary in a separate comment.

Comment thread posthog/api/event_definition.py
Comment thread frontend/src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx Outdated
Comment thread frontend/src/lib/components/TaxonomicFilter/InfiniteList.tsx
Comment thread posthog/taxonomy/taxonomy.py
Comment thread posthog/api/test/test_event_definition.py
- `event_definition.py`: add comment documenting the access-pattern
  assumption for the new `last_seen_at` predicate. The team-scoped
  `(team_id, name)` index already narrows the row set per tenant and
  the response is paginated, so the unindexed `last_seen_at` filter
  is bounded by upstream constraints. Flagged by qa-team-database +
  security-audit (convergent) on PR #59816 — the data warehouse can
  still re-EXPLAIN this if the largest tenants start showing it in
  slow-query logs.
- `taxonomicFilterLogic.tsx`: replace `item as EventDefinition` cast
  with a structural `'last_seen_at' in item` guard. Documents the
  shape contract for the `wasStale` telemetry property and lets
  `isDefinitionStale` accept the runtime-shaped object without a
  bare-faced type assertion. Flagged by paul-reviewer + xp-reviewer
  (convergent) on PR #59816.

No behaviour change. Tests still pass (`test_event_definition.py::
TestEventDefinitionExcludeStale` 3/3, `taxonomicFilterLogic.test.ts`
63/63).

Generated-By: PostHog Code
Task-Id: 2649f7ae-c1f7-40ae-8866-be024f3f1285
@pauldambra pauldambra marked this pull request as ready for review May 24, 2026 17:23
@pauldambra pauldambra added the stamphog Request AI review from stamphog label May 24, 2026
@assign-reviewers-posthog assign-reviewers-posthog Bot requested a review from a team May 24, 2026 17:23
github-actions[bot]
github-actions Bot previously approved these changes May 24, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additive feature that safely filters stale events via a new opt-in API parameter. SQL injection is not a concern since the interval value comes from a hardcoded constant. The missing-index concern from the bot review is explicitly acknowledged in a code comment with documented reasoning (team-scoped index + pagination narrows rows before the predicate). All other inline feedback was NITs or positive.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 24, 2026

Reviews (1): Last reviewed commit: "fix(taxonomic-filter): address QA Swarm ..." | Re-trigger Greptile

The comment said the predicate runs after `(team_id, name)` narrows
the row set, but the actual pre-filter uses `project_id` (from
`create_event_definitions_sql`). Corrected to "project-scoped
pre-filter" — the performance reasoning is unchanged.

Caught by qa-team in second qa-swarm pass on PR #59816.

Generated-By: PostHog Code
Task-Id: 2649f7ae-c1f7-40ae-8866-be024f3f1285
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 54a5c8f5ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread posthog/api/event_definition.py
@pauldambra
Copy link
Copy Markdown
Member Author

Note

🤖 Automated comment by QA Swarm — not written by a human

Multi-perspective review pass 2 — HEAD f5fcbd1b

Verdict: 💬 APPROVE WITH NITS

The second qa-swarm pass on the updated HEAD found no new blocking issues. Two MEDIUM convergent findings worth tracking:

Key findings

🟡 MEDIUM (convergent: qa-team + xp)isDefinitionStale boundary discrepancy (frontend/src/lib/utils/definitions.ts:8)
The client-side isDefinitionStale uses diff(seconds) > STALE_EVENT_SECONDS while the backend SQL uses last_seen_at > NOW() - '30 days'::interval. An event exactly at the 30-day boundary is excluded server-side but not flagged stale client-side, so wasStale telemetry can under-report at the boundary. Not a UX bug — the item doesn't appear in results — but affects telemetry fidelity.

🟡 MEDIUM (xp) — OnceAndOnlyOnce violation (infiniteListLogic.ts:252)
The events-tab predicate (type === Events || type === CustomEvents) appears 4 times under 4 different local names: eventsTab, affectsThisTab, canOfferStaleToggle, isEventTab. Not a bug, but a future tab type added to the events family requires 4 coordinated edits.

🟢 LOW (paul)setIncludeStaleEvents listener in infiniteListLogic is load-bearing (the explicit loadRemoteItems call is what triggers the list refresh on button click — without it, state updates but list doesn't reload).

🟢 LOW (qa-team) — No test for the exact 30-day boundary case (fresh=1d, stale=45d, ancient=365d, never-seen=null; missing: exactly=30d).

Fix committed

f5fcbd1b — corrected inaccurate index name in SQL comment (said (team_id, name) index; actual pre-filter is on project_id).

Convergence

  • Boundary discrepancy: qa-team/reliability + xp (independently flagged same issue)

Reviewer summaries

Reviewer Assessment
🔍 qa-team Clean on security/correctness; minor doc inaccuracy fixed; boundary telemetry gap noted
👤 paul Confirmed loadRemoteItems listener is load-bearing; wants reducer reset tests
📐 xp OnceAndOnlyOnce on events-tab predicate; boundary consistency concern
🛡 security-audit skip (not re-run; prior pass found no issues)

Automated by QA Swarm — not a human review

@github-actions github-actions Bot dismissed their stale review May 24, 2026 17:34

New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.

github-actions[bot]
github-actions Bot previously approved these changes May 24, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additive, opt-in feature with backward-compatible defaults. SQL uses parameterized intervals from a hardcoded constant (no injection risk), test coverage is solid, and generated types are properly updated. All substantive review comments are resolved; the lone unresolved Codex P2 comment about the strict > boundary at exactly 30 days is a negligible real-world difference, not a showstopper.

Shows the "Include stale events" button that appears when a search on
the Events tab returns no results because all matches are filtered out
by exclude_stale=true.

Generated-By: PostHog Code
Task-Id: 2649f7ae-c1f7-40ae-8866-be024f3f1285
@github-actions github-actions Bot dismissed their stale review May 24, 2026 21:07

New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.

github-actions[bot]
github-actions Bot previously approved these changes May 24, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Purely additive, backward-compatible feature. The new exclude_stale SQL predicate uses a properly parameterized interval from a hardcoded constant (no injection risk), null values are handled correctly to keep newly-defined events discoverable, tests cover default/false/true cases, and all generated types are updated. All substantive review comments are resolved.

@posthog
Copy link
Copy Markdown
Contributor

posthog Bot commented May 24, 2026

Visual changes approved by @pauldambra — baseline updated in d82d399.

View this run in PostHog

4 changed.

3 updated
Run: 43e7ea7f-15b4-4db0-b3c3-b4ff17dec2ae

Co-authored-by: pauldambra <984817+pauldambra@users.noreply.github.com>
@github-actions github-actions Bot dismissed their stale review May 24, 2026 21:23

New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.

github-actions[bot]
github-actions Bot previously approved these changes May 24, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additive, backward-compatible opt-in filter. SQL uses a parameterized interval from a hardcoded constant (no injection risk), null handling keeps newly-defined events discoverable, tests cover default/false/true cases, generated types are updated, and all substantive review comments are resolved.

@pauldambra pauldambra enabled auto-merge (squash) May 24, 2026 21:37
3 updated
Run: 31ab1f99-122a-4d85-895d-2c10c351d1d4

Co-authored-by: pauldambra <984817+pauldambra@users.noreply.github.com>
@github-actions github-actions Bot dismissed their stale review May 24, 2026 21:39

New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.

github-actions[bot]
github-actions Bot previously approved these changes May 24, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Purely additive, backward-compatible opt-in feature. SQL uses a parameterized interval from a hardcoded constant (no injection risk), null handling keeps newly-defined events discoverable, tests cover default/false/true cases, and generated types are updated in both consumer packages. All substantive review comments are resolved.

7 updated
Run: e63c9606-52ba-460c-97a0-13705b59c5f7

Co-authored-by: pauldambra <984817+pauldambra@users.noreply.github.com>
@github-actions github-actions Bot dismissed their stale review May 24, 2026 21:54

New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.

github-actions[bot]
github-actions Bot previously approved these changes May 24, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Purely additive, backward-compatible opt-in feature. The SQL predicate uses a properly parameterized interval from a hardcoded constant (no injection risk), null handling preserves newly-defined events, tests cover all three cases, generated types are updated in both consumer packages, and all substantive review comments are resolved.

4 updated
Run: e3f7810a-6170-47ae-b81d-c66137864fc0

Co-authored-by: pauldambra <984817+pauldambra@users.noreply.github.com>
@github-actions github-actions Bot dismissed their stale review May 25, 2026 08:01

New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Purely additive, backward-compatible opt-in feature. The SQL predicate is parameterized from a hardcoded constant (no injection risk), null handling correctly preserves never-seen events, tests cover all three cases, and generated types are updated in both consumer packages. All inline review comments are resolved with no substantive unaddressed concerns.

@pauldambra pauldambra merged commit c479a77 into master May 25, 2026
235 checks passed
@pauldambra pauldambra deleted the posthog-code/taxonomic-filter-exclude-stale-events branch May 25, 2026 08:21
@deployment-status-posthog
Copy link
Copy Markdown

deployment-status-posthog Bot commented May 25, 2026

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-05-25 08:54 UTC Run
prod-us ✅ Deployed 2026-05-25 09:10 UTC Run
prod-eu ✅ Deployed 2026-05-25 09:11 UTC Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stamphog Request AI review from stamphog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant