Skip to content

feat: record insight views by source and dashboard context - #106556

Draft
vdekrijger wants to merge 42 commits into
codex/insight-view-context-compatibilityfrom
codex/cache-warming-view-context
Draft

vdekrijger wants to merge 42 commits into
codex/insight-view-context-compatibilityfrom
codex/cache-warming-view-context

Conversation

@vdekrijger

@vdekrijger vdekrijger commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Insight view history cannot distinguish standalone usage from dashboard usage. Recording those contexts separately lets consumers make that distinction later.

Changes

Stack: #106552 (fields) → #106785 (compatibility) → this PR (recording) → #108313 (warming policy).

  • The branch now includes master through fix: prepare insight view consumers for contextual history #106785. The two uniqueness migrations are renumbered to 0016 and 0017, after the migrations master added. Their operations are unchanged.
  • The view context choices are now a named enum, so the generated type is InsightViewQueryContextEnumApi.
  • The facade function insight_view_contexts returns frozen InsightViewContext rows, not a queryset. The product boundary check requires it, and fix: require standalone demand for standalone cache warming #108313 filters those rows.
  • insight_view_contexts takes an optional viewed_since, so a caller that needs recent views does not load an insight's whole view history.

Rollback application code only as far as #106785. Do not reverse uniqueness migrations after contextual rows exist. The bounded-lock constraint removal still needs migration review.

MCP source attribution is supported, but explicit MCP insight-query execution recording remains a follow-up. Verify caller coverage before using this history for warming.

How did you test this code?

Focused recording, API and legacy warming tests cover source/context separation, access checks, anonymous views, concurrency and compatibility. The split removes the selector and its tests; no recording behavior is intentionally changed. Frontend behavior and generated API contracts are unchanged from the previous revision. Current-head CI and human migration review remain required; no production deployment is claimed.

The focused run completed all test assertions, then Python segfaulted during shutdown. A clean process exit is not claimed.

After the merge with master: the facade, insight API, sharing, dashboard and warming test files and the dashboardLogic and insightLogic Jest files ran locally. Four shared-link tests fail locally and on a master-based tree alike, because of a local ClickHouse schema setup error. CI is the reference run.

Release status

  • No feature flag controls this change
  • This change is behind a feature flag and is not available to users
  • This change makes a previously flagged feature available to everyone

Automatic notifications

  • Publish to changelog?

Docs update

Internal deployment order is above. No visible UI change.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: Codex, GPT-6

Skills: posthog-pr-finish, brainstorming, writing-pr-descriptions. Tools: Git, gh, Flox, pytest. Split the existing recording and warming changes at the author's request. No customer data or operational metrics are included. No new third-party review or manual UI validation is claimed.

@vdekrijger vdekrijger self-assigned this Sep 25, 2026
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

⚠️ Trunk lane — backend Python lane

This PR is assigned to the backend Python lane. It runs backend Python tests and may merge in parallel with PRs in other lanes.

⚠️ Complexity (TypeScript) — 11 functions above the limit (max 66)

Cyclomatic complexity above the limit in changed typescript files (10 for production files, 15 for test files). Warn only: worth simplifying when you next touch these functions.

Function Location Complexity Limit
refreshDashboardItems frontend/src/scenes/dashboard/dashboardLogic.tsx:5833 66 10
<anonymous> frontend/src/scenes/dashboard/dashboardLogic.tsx:2692 22 10
addWidgetTiles frontend/src/scenes/dashboard/dashboardLogic.tsx:6579 20 10
refreshDashboardItem frontend/src/scenes/dashboard/dashboardLogic.tsx:5745 18 10
saveLayoutOrColorsSuccess frontend/src/scenes/dashboard/dashboardLogic.tsx:6710 18 10
copyToDashboard frontend/src/scenes/dashboard/dashboardLogic.tsx:2887 16 10
updateWidgetTile frontend/src/scenes/dashboard/dashboardLogic.tsx:2967 15 10
<anonymous> frontend/src/scenes/dashboard/dashboardLogic.tsx:6076 15 10
onQueryChange frontend/src/scenes/insights/insightUsageLogic.ts:127 14 10
refreshInsightTile frontend/src/scenes/dashboard/dashboardLogic.tsx:341 11 10
moveToDashboardSuccess frontend/src/scenes/dashboard/dashboardLogic.tsx:5557 11 10
✅ Duplication (Python) — clean

New Python code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

✅ Duplication (TypeScript) — clean

New TypeScript code duplication introduced by this branch. Fails at 70+ tokens in app code, or 150+ tokens when both copies live in test files. Advisory while the gate proves itself: extract a shared helper instead of copying.

⚠️ Bundle size — 🔺 +4.4 KiB (+0.0%)

Uncompressed size of every built .js bundle, compared against the base branch.

Total: 81.07 MiB · 🔺 +4.4 KiB (+0.0%)

File Size Δ vs base
render-query/src/render-query/render-query.js 22.18 MiB 🔺 +4.4 KiB (+0.0%)

Posted automatically by build-bundle-size-report · uncompressed bytes from dist-report

⚠️ Eager graph — 1 over budget

How much code each root ships on the eager path — downloaded and parsed before the surface is interactive. Measured from the esbuild output chunks (post-tree-shake, static imports only); lazy import() / React.lazy chunks are not counted.

Root Eager (shipped) Δ vs base Budget
entry (logged-out pages, app bootstrap)
src/index.tsx
1.05 MiB · 26 files no change █████████░ 92.0% of 1.14 MiB
logged-out boot: index + App + bootApp (preloaded by every page, including /login)
src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
2.88 MiB · 539 files 🔺 +386 B (+0.0%) ██████████ 99.4% of 2.89 MiB
🟡 authenticated shell (every logged-in page)
src/scenes/AuthenticatedShell.tsx
3.92 MiB · 1,239 files 🔺 +386 B (+0.0%) ██████████ 100.3% of 3.91 MiB
dashboard scene
src/scenes/dashboard/Dashboard.tsx
7.63 MiB · 2,975 files 🔺 +778 B (+0.0%) ██████████ 96.4% of 7.92 MiB
today home path
src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
4.52 MiB · 1,690 files 🔺 +386 B (+0.0%) █████████░ 92.5% of 4.88 MiB
AI-first home path
src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
5.95 MiB · 2,218 files 🔺 +718 B (+0.0%) ██████████ 97.1% of 6.13 MiB
events scene
src/scenes/activity/explore/EventsScene.tsx
6.58 MiB · 2,445 files 🔺 +779 B (+0.0%) ██████████ 95.3% of 6.91 MiB
web analytics scene
src/scenes/web-analytics/WebAnalyticsScene.tsx
7.66 MiB · 2,852 files 🔺 +778 B (+0.0%) ██████████ 96.3% of 7.96 MiB
replay detail scene
src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
6.76 MiB · 2,498 files 🔺 +3.9 KiB (+0.1%) ██████████ 95.3% of 7.09 MiB

🟢 node_modules/monaco-editor/ stays out of src/index.tsx
🟢 products/product_analytics/frontend/insights/activityDescriptions stays out of src/index.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/svg/ stays out of src/index.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/components/ stays out of src/index.tsx
🟢 node_modules/monaco-editor/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/lemon-ui/LemonTable/LemonTable.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 node_modules/@dnd-kit/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/layout/navigation-3000/navigationLogic.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/scenes/dashboard/dashboardLogic.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/lemon-ui/LemonMarkdown/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/components/RichContentEditor/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/components/CodeSnippet/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/taxonomy/core-filter-definitions-by-group.json stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 node_modules/zod/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/logic/billing/billingLogic.tsx stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 src/lib/components/ProductEmptyState/productSetupPreloadLogic.ts stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 node_modules/kea-test-utils/ stays out of src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
🟢 node_modules/monaco-editor/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 products/product_analytics/frontend/insights/activityDescriptions stays out of src/scenes/AuthenticatedShell.tsx
🟢 node_modules/kea-test-utils/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 products/dashboards/frontend/widgets/previews/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/layout/panel-layout/ProjectTree/menus/SessionReplayMenuItems.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/taxonomy/core-filter-definitions-by-group.json stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/layout/navigation/projectNoticeLogic.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/layout/navigation/ImpersonationNotice/ImpersonationNotice.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/cohorts/cohortSavedToast.ts stays out of src/scenes/AuthenticatedShell.tsx
🟢 products/wizard/frontend/runs/WizardRunDetailsDrawer.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/layout/today/TodayShell.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/layout/today/TodayContextPanelFloating.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/layout/today/TodaySidePanel.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/layout/today/TodayTopBar.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/layout/today/todayRailItems.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 products/subscriptions/frontend/components/Subscriptions/exportNudge/exportNudgeLogic.ts stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/billing/paymentEntryLogic.ts stays out of src/scenes/AuthenticatedShell.tsx
🟢 products/conversations/frontend/components/SidePanel/sidepanelTicketsLogic.ts stays out of src/scenes/AuthenticatedShell.tsx
🟢 node_modules/zod/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/authentication/auth/loginLogic.ts stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/authentication/shared/passkeyLogic.ts stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/cohorts/CohortFilters/constants.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 products/persons/frontend/logics/personsLogic.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/surveys/constants.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 node_modules/@tiptap/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 node_modules/prosemirror- stays out of src/scenes/AuthenticatedShell.tsx
🟢 node_modules/re2js/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 node_modules/react-markdown/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/lib/components/Command/Command.tsx stays out of src/scenes/AuthenticatedShell.tsx
🟢 packages/quill/packages/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 zod/v4/locales/de.js stays out of src/scenes/AuthenticatedShell.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/svg/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 node_modules/@posthog/brand/dist/generated/hoggies/components/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 packages/quill/packages/quill/dist/ stays out of src/scenes/dashboard/Dashboard.tsx
🟢 node_modules/@tiptap/ stays out of src/scenes/dashboard/Dashboard.tsx
🟢 node_modules/prosemirror- stays out of src/scenes/dashboard/Dashboard.tsx
🟢 node_modules/marked/ stays out of src/scenes/dashboard/Dashboard.tsx
🟢 node_modules/frimousse/ stays out of src/scenes/dashboard/Dashboard.tsx
🟢 src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx stays out of src/scenes/dashboard/Dashboard.tsx
🟢 src/scenes/web-analytics/tiles/WebAnalyticsTile.tsx stays out of src/scenes/dashboard/Dashboard.tsx
🟢 src/queries/validators.js stays out of src/scenes/dashboard/Dashboard.tsx
🟢 src/queries/web-analytics-validators.js stays out of src/scenes/dashboard/Dashboard.tsx
🟢 node_modules/re2js/ stays out of src/scenes/dashboard/Dashboard.tsx
🟢 node_modules/kea-test-utils/ stays out of src/scenes/dashboard/Dashboard.tsx
🟢 src/scenes/debug/HogDebug.tsx stays out of src/scenes/dashboard/Dashboard.tsx
🟢 src/queries/QueryEditor/QueryEditor.tsx stays out of src/scenes/dashboard/Dashboard.tsx
🟢 packages/quill/packages/quill/dist/ stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
🟢 src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
🟢 src/scenes/project-homepage/today/TodayReportPage.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
🟢 src/queries/Query/Query.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
🟢 packages/quill/packages/charts/ stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
🟢 products/posthog_ai/frontend/logics/runStreamLogic.ts stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
🟢 packages/quill/packages/quill/dist/ stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
🟢 products/posthog_ai/frontend/components/tool/widgets/VisualizationWidget.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
🟢 products/posthog_ai/frontend/components/tool/widgets/RecordingsWidget.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
🟢 src/queries/Query/Query.tsx stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
🟢 products/posthog_ai/frontend/api/primitives.ts stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
🟢 src/scenes/notebooks/Notebook/notebookLogic.ts stays out of src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
🟢 packages/quill/packages/quill/dist/ stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 node_modules/@tiptap/ stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 node_modules/prosemirror- stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 node_modules/marked/ stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 node_modules/frimousse/ stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 src/scenes/web-analytics/tiles/WebAnalyticsTile.tsx stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 src/queries/validators.js stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 src/queries/web-analytics-validators.js stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 node_modules/re2js/ stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 node_modules/kea-test-utils/ stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 src/queries/nodes/InsightViz/InsightViz.tsx stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 src/queries/nodes/DataVisualization/DataVisualization.tsx stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 src/queries/nodes/WebOverview/WebOverview.tsx stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 src/scenes/debug/HogDebug.tsx stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 src/queries/QueryEditor/QueryEditor.tsx stays out of src/scenes/activity/explore/EventsScene.tsx
🟢 packages/quill/packages/quill/dist/ stays out of src/scenes/web-analytics/WebAnalyticsScene.tsx
🟢 node_modules/@tiptap/ stays out of src/scenes/web-analytics/WebAnalyticsScene.tsx
🟢 node_modules/prosemirror- stays out of src/scenes/web-analytics/WebAnalyticsScene.tsx
🟢 node_modules/marked/ stays out of src/scenes/web-analytics/WebAnalyticsScene.tsx
🟢 node_modules/frimousse/ stays out of src/scenes/web-analytics/WebAnalyticsScene.tsx
🟢 src/scenes/web-analytics/LiveMetricsDashboard/LiveWebAnalyticsMetrics.tsx stays out of src/scenes/web-analytics/WebAnalyticsScene.tsx
🟢 products/product_analytics/frontend/insights/trends/WorldMap/countryVectors.tsx stays out of src/scenes/web-analytics/WebAnalyticsScene.tsx
🟢 src/queries/validators.js stays out of src/scenes/web-analytics/WebAnalyticsScene.tsx
🟢 node_modules/re2js/ stays out of src/scenes/web-analytics/WebAnalyticsScene.tsx
🟢 node_modules/kea-test-utils/ stays out of src/scenes/web-analytics/WebAnalyticsScene.tsx
🟢 src/scenes/debug/HogDebug.tsx stays out of src/scenes/web-analytics/WebAnalyticsScene.tsx
🟢 src/queries/QueryEditor/QueryEditor.tsx stays out of src/scenes/web-analytics/WebAnalyticsScene.tsx
🟢 packages/quill/packages/quill/dist/ stays out of src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
🟢 node_modules/@tiptap/ stays out of src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
🟢 node_modules/prosemirror- stays out of src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
🟢 node_modules/marked/ stays out of src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
🟢 src/scenes/settings/SettingsMap.tsx stays out of src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
🟢 @jspm/core/nodelibs/browser/fs stays out of src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
🟢 node_modules/re2js/ stays out of src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
🟢 node_modules/kea-test-utils/ stays out of src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
🟢 node_modules/d3/src/ stays out of src/scenes/session-recordings/detail/SessionRecordingDetail.tsx

Largest files eagerly shipped from src/index.tsx
Size File
126.7 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
24.5 KiB ../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js
6.3 KiB ../node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react.production.min.js
4.8 KiB ../node_modules/.pnpm/@jspm+core@2.1.0/node_modules/@jspm/core/nodelibs/browser/process.js
4.0 KiB ../node_modules/.pnpm/scheduler@0.23.2/node_modules/scheduler/cjs/scheduler.production.min.js
1.8 KiB src/lib/utils/bootTiming.ts
1.7 KiB ../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
1.7 KiB src/index.tsx
1.2 KiB src/RootErrorBoundary.tsx
1.1 KiB src/lib/utils/deferredAppContext.ts
Largest files eagerly shipped from src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
Size File
363.9 KiB ../node_modules/.pnpm/posthog-js@1.448.0_@types+react@18.3.31_react@18.3.1/node_modules/posthog-js/dist/module.mjs
224.1 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
126.7 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
108.2 KiB src/products.tsx
92.5 KiB src/lib/api.ts
68.9 KiB src/lib/lemon-ui/icons/icons.tsx
36.4 KiB ../node_modules/.pnpm/kea@4.0.0-pre.6_patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5_react@18.3.1/node_modules/kea/lib/index.cjs.js
29.7 KiB src/lib/constants.tsx
24.7 KiB ../node_modules/.pnpm/fuse.js@7.3.0/node_modules/fuse.js/dist/fuse.mjs
24.5 KiB ../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
Size File
363.9 KiB ../node_modules/.pnpm/posthog-js@1.448.0_@types+react@18.3.31_react@18.3.1/node_modules/posthog-js/dist/module.mjs
224.1 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
126.7 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
108.2 KiB src/products.tsx
92.5 KiB src/lib/api.ts
68.9 KiB src/lib/lemon-ui/icons/icons.tsx
40.3 KiB ../node_modules/.pnpm/@dnd-kit+core@6.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@dnd-kit/core/dist/core.esm.js
36.4 KiB ../node_modules/.pnpm/kea@4.0.0-pre.6_patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5_react@18.3.1/node_modules/kea/lib/index.cjs.js
32.6 KiB src/lib/utils/eventUsageLogic.ts
29.7 KiB src/lib/constants.tsx
Largest files eagerly shipped from src/scenes/dashboard/Dashboard.tsx
Size File
363.9 KiB ../node_modules/.pnpm/posthog-js@1.448.0_@types+react@18.3.31_react@18.3.1/node_modules/posthog-js/dist/module.mjs
224.1 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
126.7 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
116.4 KiB ../node_modules/.pnpm/posthog-js@1.448.0_@types+react@18.3.31_react@18.3.1/node_modules/posthog-js/dist/surveys-preview.js
108.2 KiB src/products.tsx
92.5 KiB src/lib/api.ts
82.4 KiB src/scenes/dashboard/dashboardLogic.tsx
68.9 KiB src/lib/lemon-ui/icons/icons.tsx
68.0 KiB ../products/posthog_ai/frontend/logics/runStreamLogic.ts
51.4 KiB ../products/canvas/frontend/editing/blockLibrary/componentSources.ts
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
Size File
363.9 KiB ../node_modules/.pnpm/posthog-js@1.448.0_@types+react@18.3.31_react@18.3.1/node_modules/posthog-js/dist/module.mjs
224.1 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
126.7 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
108.2 KiB src/products.tsx
92.5 KiB src/lib/api.ts
68.9 KiB src/lib/lemon-ui/icons/icons.tsx
40.3 KiB ../node_modules/.pnpm/@dnd-kit+core@6.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@dnd-kit/core/dist/core.esm.js
36.4 KiB ../node_modules/.pnpm/kea@4.0.0-pre.6_patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5_react@18.3.1/node_modules/kea/lib/index.cjs.js
32.6 KiB src/lib/utils/eventUsageLogic.ts
29.7 KiB src/lib/constants.tsx
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
Size File
363.9 KiB ../node_modules/.pnpm/posthog-js@1.448.0_@types+react@18.3.31_react@18.3.1/node_modules/posthog-js/dist/module.mjs
224.1 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
126.7 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
108.2 KiB src/products.tsx
92.5 KiB src/lib/api.ts
68.9 KiB src/lib/lemon-ui/icons/icons.tsx
68.0 KiB ../products/posthog_ai/frontend/logics/runStreamLogic.ts
41.7 KiB src/scenes/hog-functions/sub-templates/sub-templates.ts
40.3 KiB ../node_modules/.pnpm/@dnd-kit+core@6.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@dnd-kit/core/dist/core.esm.js
36.6 KiB src/lib/components/TaxonomicFilter/taxonomicFilterLogic.tsx
Largest files eagerly shipped from src/scenes/activity/explore/EventsScene.tsx
Size File
363.9 KiB ../node_modules/.pnpm/posthog-js@1.448.0_@types+react@18.3.31_react@18.3.1/node_modules/posthog-js/dist/module.mjs
224.1 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
126.7 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
108.2 KiB src/products.tsx
92.5 KiB src/lib/api.ts
82.4 KiB src/scenes/dashboard/dashboardLogic.tsx
68.9 KiB src/lib/lemon-ui/icons/icons.tsx
68.0 KiB ../products/posthog_ai/frontend/logics/runStreamLogic.ts
51.4 KiB ../products/canvas/frontend/editing/blockLibrary/componentSources.ts
44.5 KiB src/scenes/surveys/surveyLogic.tsx
Largest files eagerly shipped from src/scenes/web-analytics/WebAnalyticsScene.tsx
Size File
363.9 KiB ../node_modules/.pnpm/posthog-js@1.448.0_@types+react@18.3.31_react@18.3.1/node_modules/posthog-js/dist/module.mjs
224.1 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
126.7 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
116.4 KiB ../node_modules/.pnpm/posthog-js@1.448.0_@types+react@18.3.31_react@18.3.1/node_modules/posthog-js/dist/surveys-preview.js
108.2 KiB src/products.tsx
92.5 KiB src/lib/api.ts
82.4 KiB src/scenes/dashboard/dashboardLogic.tsx
68.9 KiB src/lib/lemon-ui/icons/icons.tsx
68.0 KiB ../products/posthog_ai/frontend/logics/runStreamLogic.ts
51.4 KiB ../products/canvas/frontend/editing/blockLibrary/componentSources.ts
Largest files eagerly shipped from src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
Size File
363.9 KiB ../node_modules/.pnpm/posthog-js@1.448.0_@types+react@18.3.31_react@18.3.1/node_modules/posthog-js/dist/module.mjs
333.0 KiB ../node_modules/.pnpm/posthog-js@1.448.0_@types+react@18.3.31_react@18.3.1/node_modules/posthog-js/dist/rrweb.js
224.1 KiB ../node_modules/.pnpm/@posthog+icons@0.39.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
126.7 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
108.2 KiB src/products.tsx
92.5 KiB src/lib/api.ts
68.9 KiB src/lib/lemon-ui/icons/icons.tsx
68.0 KiB ../products/posthog_ai/frontend/logics/runStreamLogic.ts
43.6 KiB src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts
40.3 KiB ../node_modules/.pnpm/@dnd-kit+core@6.3.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@dnd-kit/core/dist/core.esm.js

Posted automatically by check-eager-graph · sizes are eager output bytes (shipped, post-tree-shake) from the esbuild metafile · part of #32479

✅ Frontend layers — no new upward imports, 0 removed

Static imports from a lower frontend layer into a higher one (layers, lowest first: kernel, shell, query, features). Compared with the base branch, so an import that a PR also adds to layer-baseline.txt still shows here. Sizes are the source bytes on the eager path of every logged-in page.

Layer Eager source bytes Δ vs base
kernel 3.02 MiB no change
shell 2.43 MiB no change
query 56.9 KiB no change
features 274.7 KiB no change

Download the interactive layer graph for this PR.

Posted automatically by check-layers

✅ Toolbar bundle — eager 2.45 MiB within budget

What the toolbar ships to customer pages, measured from the esbuild output (minified, post-tree-shake). The eager set is the entry plus everything statically imported from it — fetched before any feature runs; deferred chunks load lazily. The eager guardrail is 5.72 MiB. Each output file must also stay below 10 MB, where CloudFront stops compressing it. The module boundary is enforced separately by check-toolbar-graph.

Metric Size Δ vs base Budget
Eager (shipped)
entry + static imports
2.45 MiB · 19 files 🔺 +389 B (+0.0%) ████░░░░░░ 42.8% of 5.72 MiB
Deferred (lazy) 2.19 MiB · 43 files no change n/a — loads on demand
Loader dist/toolbar.js 1.2 KiB no change █░░░░░░░░░ 6.0% of 19.5 KiB
Largest eagerly-shipped chunks
Size File
989.1 KiB dist/toolbar/toolbar-app-JC2JWST2.css
740.1 KiB dist/toolbar/chunk-chunk-JZIT2L72.js
286.3 KiB dist/toolbar/chunk-chunk-KTEM56AP.js
137.6 KiB dist/toolbar/chunk-chunk-3LKM7CSW.js
131.8 KiB dist/toolbar/chunk-chunk-FDH2IBXT.js
75.7 KiB dist/toolbar/toolbar-app-YP46CGOB.js
69.0 KiB dist/toolbar/chunk-chunk-TSAL54PB.js
33.8 KiB dist/toolbar/chunk-chunk-FFQPZ7IM.js
21.9 KiB dist/toolbar/chunk-chunk-SXNLSEUB.js
6.8 KiB dist/toolbar/chunk-chunk-DV7IWQNF.js

Posted automatically by check-toolbar-size · sizes are toolbar output bytes (shipped, post-tree-shake) from the esbuild metafile

✅ Dist folder size — 🔺 +126.9 KiB (+0.0%)

Total size of the built frontend/dist folder (all assets), compared against the base branch.

Total: 1026.85 MiB · 🔺 +126.9 KiB (+0.0%)

ℹ️ MCP UI apps size — 35 app(s), 37020.2 KB JS

Built size of each MCP UI app (main.js + styles.css).

App JS CSS
debug 1067.4 KB 225.2 KB
explain-chart 1351.4 KB 225.2 KB
action 994.8 KB 225.2 KB
action-list 1058.5 KB 225.2 KB
cohort 993.8 KB 225.2 KB
cohort-list 1057.5 KB 225.2 KB
email-template 993.6 KB 225.2 KB
error-details 998.7 KB 225.2 KB
error-issue 995.7 KB 225.2 KB
error-issue-list 1059.7 KB 225.2 KB
experiment 1055.6 KB 225.2 KB
experiment-list 1059.3 KB 225.2 KB
experiment-results 1057.7 KB 225.2 KB
feature-flag 1057.9 KB 225.2 KB
feature-flag-list 1061.6 KB 225.2 KB
feature-flag-testing 997.0 KB 225.2 KB
inline-scan 994.3 KB 225.2 KB
insight-actors 1057.0 KB 225.2 KB
llm-costs 1054.3 KB 225.2 KB
session-recording 996.0 KB 225.2 KB
survey 995.4 KB 225.2 KB
survey-global-stats 1054.3 KB 225.2 KB
survey-list 1059.2 KB 225.2 KB
survey-stats 1054.3 KB 225.2 KB
trace-span 994.2 KB 225.2 KB
trace-span-list 1058.8 KB 225.2 KB
vision-observation-list 1057.6 KB 225.2 KB
workflow 994.1 KB 225.2 KB
workflow-list 1057.9 KB 225.2 KB
workflow-setup-status 993.8 KB 225.2 KB
query-results 1320.8 KB 225.2 KB
render-ui 1427.7 KB 225.2 KB
visual-review-snapshots 998.7 KB 225.2 KB
workflow-data-suggestions 996.5 KB 225.2 KB
workflow-sending-rules 995.1 KB 225.2 KB
⚠️ Backend snapshots — 1 updated (1 modified, 0 added, 0 deleted)

Query snapshots: Backend query snapshots updated

Changes: 1 snapshots (1 modified, 0 added, 0 deleted)

What this means:

  • Query snapshots have been automatically updated to match current output
  • These changes reflect modifications to database queries or schema

Next steps:

  • Review the query changes to ensure they're intentional
  • If unexpected, investigate what caused the query to change

Review snapshot changes →

⚠️ Django migration SQL — 2 new migrations to review

We've detected new migrations on this PR. Review the SQL output for each migration:

products/product_analytics/backend/migrations/0016_insight_viewed_context_uniqueness.py

/home/runner/work/tmp/tool_cache/Python/3.14.7/x64/lib/python3.14/site-packages/anyio/from_thread.py:119: SyntaxWarning: 'return' in a 'finally' block
  return result
2026-11-13T08:31:45.413474Z [error    ] Path must be a valid database or directory containing databases. [posthog.exceptions_capture] pid=5918 tid=140247749024640
Traceback (most recent call last):
  File "/home/runner/work/posthog/posthog/posthog/geoip.py", line 15, in <module>
    geoip: Optional[GeoIP2] = GeoIP2(cache=8)
                              ~~~~~~^^^^^^^^^
  File "/home/runner/work/tmp/tool_cache/Python/3.14.7/x64/lib/python3.14/site-packages/django/contrib/gis/geoip2.py", line 114, in __init__
    raise GeoIP2Exception(
        "Path must be a valid database or directory containing databases."
    )
django.contrib.gis.geoip2.GeoIP2Exception: Path must be a valid database or directory containing databases.
/home/runner/work/tmp/tool_cache/Python/3.14.7/x64/lib/python3.14/site-packages/sshtunnel.py:1040: SyntaxWarning: 'return' in a 'finally' block
  return (ssh_host,
System check identified some issues:

WARNINGS:
?: (axes.W001) You are using the django-axes cache handler for login attempt tracking. Your cache configuration is however invalid and will not work correctly with django-axes. This can leave security holes in your login systems as attempts are not tracked correctly. Reconfigure settings.AXES_CACHE and settings.CACHES per django-axes configuration documentation.
?: (staticfiles.W004) The directory '/home/runner/work/posthog/posthog/frontend/dist' in the STATICFILES_DIRS setting does not exist.
--
-- Custom state/database change combination
--
SET lock_timeout = 0;
SET statement_timeout = 0;
CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS "insightviewed_context_unique" ON "posthog_insightviewed" (COALESCE(team_id, 0), COALESCE(user_id, 0), insight_id, source, COALESCE(dashboard_id, 0));
--
-- Concurrently drop index posthog_insightviewed_null_team_user_unique on posthog_insightviewed
--
SET lock_timeout = 0;
SET statement_timeout = 0;
DROP INDEX CONCURRENTLY IF EXISTS "posthog_insightviewed_null_team_user_unique";

products/product_analytics/backend/migrations/0017_remove_legacy_insight_view_uniqueness.py

2026-11-13T08:32:38.578921Z [error    ] Path must be a valid database or directory containing databases. [posthog.exceptions_capture] pid=7255 tid=140141995977600
Traceback (most recent call last):
  File "/home/runner/work/posthog/posthog/posthog/geoip.py", line 15, in <module>
    geoip: Optional[GeoIP2] = GeoIP2(cache=8)
                              ~~~~~~^^^^^^^^^
  File "/home/runner/work/tmp/tool_cache/Python/3.14.7/x64/lib/python3.14/site-packages/django/contrib/gis/geoip2.py", line 114, in __init__
    raise GeoIP2Exception(
        "Path must be a valid database or directory containing databases."
    )
django.contrib.gis.geoip2.GeoIP2Exception: Path must be a valid database or directory containing databases.
System check identified some issues:

WARNINGS:
?: (axes.W001) You are using the django-axes cache handler for login attempt tracking. Your cache configuration is however invalid and will not work correctly with django-axes. This can leave security holes in your login systems as attempts are not tracked correctly. Reconfigure settings.AXES_CACHE and settings.CACHES per django-axes configuration documentation.
?: (staticfiles.W004) The directory '/home/runner/work/posthog/posthog/frontend/dist' in the STATICFILES_DIRS setting does not exist.
BEGIN;
--
-- Raw Python operation
--
-- THIS OPERATION CANNOT BE WRITTEN AS SQL
--
-- Remove constraint posthog_unique_insightviewed from model insightviewed
--
ALTER TABLE "posthog_insightviewed" DROP CONSTRAINT "posthog_unique_insightviewed";
COMMIT;

Last updated: 2026-11-13 08:32 UTC (6a8bdba)

✅ Django migration risk — migration analysis complete

We've analyzed your migrations for potential risks.

Summary: 1 Safe | 1 Needs Review | 0 Blocked

⚠️ Needs Review

May have performance impact

product_analytics.0017_remove_legacy_insight_view_uniqueness
  └─ #1 ⚠️ RunPython: RunPython data migration needs review for performance
  └─ #2 ⚠️ RemoveConstraint: Unscored Django operation: RemoveConstraint (needs manual review)

✅ Safe

Brief or no lock, backwards compatible

product_analytics.0016_insight_viewed_context_uniqueness
  └─ #1 ✅ SeparateDatabaseAndState
     Wrapper operation - see nested operations for risk: CreateIndexConcurrently
     database_operations: CreateIndexConcurrently
     └─ #2 ✅ CreateIndexConcurrently
        PostHog concurrent-index helper: idempotent (timeout disabling + invalid-leftover recovery)
        model: None, index: insightviewed_context_unique
  └─ #3 ✅ DropIndexConcurrently
     PostHog concurrent-index helper: idempotent (timeout disabling + invalid-leftover recovery)
     model: None, index: posthog_insightviewed_null_team_user_unique

📚 How to Deploy These Changes Safely

RunPython:

Use batching for large data migrations:

  • Use .iterator() to avoid loading all rows into memory
  • Use .bulk_update() instead of saving individual objects
  • Batch size: 1,000-10,000 rows per batch
  • Add pauses between batches
  • Consider background jobs for very large updates (millions of rows)

See the migration safety guide

Last updated: 2026-11-13 08:33 UTC (6a8bdba)

@greptile-apps

greptile-apps Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Retrigger

[Medium risk] Separates dashboard and standalone insight view tracking.

The PR should not merge until shared notebook renders stop being counted as standalone insight demand.

Reviews (1) · Last reviewed commit: "fix(caching): separate standalone and da..."

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
Walkthrough

The change adds standalone, dashboard, and shared context to insight-view tracking. The viewed endpoint validates supplied context and records eligible demand. Dashboard and saved-insight views report context when their queries match saved settings without overrides. Shared-view handlers record shared context. View-context records use a revised uniqueness constraint, and cache warming can use recent standalone context to select insights.

Merge Risk: Low · up to 43978

Correct the deployment note and prevent modified dashboard tiles from being recorded as saved-query views. The identified attribution error does not change standalone cache-warming eligibility.

Security architecture risk: Moderate · up to 43978

Access checks limit where views can be attributed, but the database uniqueness change depends on deployment order and is difficult to reverse after contextual views have been written. Production data and rollout preconditions remain unverified.

Retained concerns

  • Medium · reliability · inferred: The new context writer needs the legacy uniqueness constraint removed before it writes distinct contexts for an existing user and insight. Once those rows exist, reversing the constraint-removal migration can fail. Correct rollout sequencing and application-only rollback therefore matter to recovery; the supplied evidence does not establish the production deployment state.
Security review details

Security Blast Radius

  • inferred — A holder of a valid share can refresh attributed demand for insights exposed by that share. The warmer can consume dashboard-free shared records when its flag is enabled, but selects only team-owned insights already present among stale cache candidates; inspected paths do not permit choosing an arbitrary other-team insight.

Security Findings and Attack Paths

  • inferred — No introduced cross-team read or arbitrary-insight write was established in the inspected flow. Shared views already updated generic history consumed by the legacy warmer; the new shared context can reach the flagged selector, so that reachability alone does not establish increased attacker scope. Whether shared traffic should count as standalone demand remains a policy question.

Trust Boundaries and Controls

  • observed — The shared handler retains share-specific authentication, enabled and unexpired share resolution, and public-sharing checks before rendering. Request-source classification can use client-supplied headers, but source attribution is separate from the inspected share and insight access controls.

Resilience and Maintainability Implications

  • observed — Same-context writes use a database conflict target and coalesce timestamp updates within one minute. Legacy updates target only empty-source, dashboard-free history, limiting interference after the uniqueness transition completes.

Hardening Proposals

  • proposed — Before enabling contextual writers, verify normalized-key uniqueness against production data and explicitly validate migration ordering and the intended application-versus-schema rollback procedure.
Pre-merge checks: Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description covers the problem, main changes, testing, release status, documentation, and agent context. However, it contains material inconsistencies: frontend and generated API changes are prese… Update the description to accurately describe frontend, generated API, and feature-flagged warming changes; correct the migration numbers; add the required Test rationale: entry; and retain exactly one plain-bullet Release status line.
Full details: Description check

Explanation

The description covers the problem, main changes, testing, release status, documentation, and agent context. However, it contains material inconsistencies: frontend and generated API changes are present despite being described as unchanged, warming behavior changed behind a feature flag, and the stated migration numbers differ from the supplied diff. The required Test rationale field is missing, and Release status retains all three checkbox lines instead of exactly one plain bullet.

Resolution

Update the description to accurately describe frontend, generated API, and feature-flagged warming changes; correct the migration numbers; add the required Test rationale: entry; and retain exactly one plain-bullet Release status line.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@trunk-io

trunk-io Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

Failed Test Failure Summary Logs
Scenes-App/SidePanels SidePanelNotebooks smoke-test The test timed out while waiting for a loading indicator or spinner to disappear. Logs ↗︎

View Full Report ↗︎ ⋅ Docs

@vdekrijger vdekrijger changed the title fix(caching): separate standalone and dashboard warming demand fix(caching): use context-specific demand for standalone warming Sep 25, 2026
@vdekrijger vdekrijger changed the title fix(caching): use context-specific demand for standalone warming fix(caching): attribute insight views by user, context and source Sep 25, 2026
@posthog

posthog Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

👋 Visual changes detected for this PR.

Review and approve in PostHog Visual Review

If these changes are unexpected, they may be caused by a flaky test or a broken snapshot on master. Don't approve — rerun the job or wait for a fix.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Omit dashboard context for tiles with non-empty filters_overrides. · dashboardLogic.tsx:4598-4602

frontend/src/scenes/dashboard/dashboardLogic.tsx:4598-4602
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Omit dashboard context for tiles with non-empty filters_overrides.

reportDashboardViewed sends every tile insight through reportInsightsViewed, which always includes query_context: 'dashboard' and dashboard_id. The request contract requires modified queries to omit query_context, so overridden tiles receive incorrect dashboard attribution. Send those tiles in a separate request without query_context or dashboard_id. They do not affect standalone-demand warming because that path filters for dashboard_id IS NULL.

🟡 Other comments (1)
posthog/management/migration_analysis/atomic_false_acknowledged_migrations.txt-49-52 (1)

49-52: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Fix the prerequisite PR number in the comment.

Line 51 names PR106552 as the consumer release. PR106552 contains only the schema migration. Per the stack description, the consumer-compatibility release is PR106785. The wrong number can lead an operator to deploy 0013 before legacy writers stop depending on the dropped anonymous index.

Proposed fix
-# Existing consumers must be fully deployed from PR106552 first; both index operations are retry-safe.
+# Consumer compatibility (PR106785) must be fully deployed first; both index operations are retry-safe.
🧹 Nitpick comments (1)
posthog/api/sharing.py (1)

1451-1456: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Optionally batch notebook context writes.

Each record_insight_view_context call performs one filter query and one upsert. Batch the IDs in one call to avoid repeated database work. get_connected_insight_ids() already restricts notebook references to self.team, so resource.team_id is valid and sibling-team grouping is not required.

Suggested fix
                 # Saved notebook insights consume the standalone query without dashboard overrides.
                 for insight in referenced_insights:
                     record_insight_view(insight_id=insight.pk)
-                    record_insight_view_context(
-                        team_id=insight.team_id, insight_ids=[insight.pk], user_id=None, source=EventSource.SHARED
-                    )
+                record_insight_view_context(
+                    team_id=resource.team_id,
+                    insight_ids=[insight.pk for insight in referenced_insights],
+                    user_id=None,
+                    source=EventSource.SHARED,
+                )

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: PostHog/posthog/.coderabbit.yaml

Review profile: QUIET

Plan: Enterprise

Run ID: ce631baf-316d-4afd-aa70-9c26fcb7e482

📥 Commits

Reviewing files that changed from the base of the PR and between 399441b and 43978cf.

⛔ Files ignored due to path filters (2)
  • products/product_analytics/frontend/generated/api.schemas.ts is excluded by !**/generated/**
  • products/product_analytics/frontend/generated/api.zod.ts is excluded by !**/generated/**
📒 Files selected for processing (7)
  • posthog/api/sharing.py
  • posthog/event_usage.py
  • posthog/management/migration_analysis/atomic_false_acknowledged_migrations.txt
  • products/product_analytics/backend/migrations/0013_insight_viewed_context_uniqueness.py
  • products/product_analytics/backend/migrations/0014_remove_legacy_insight_view_uniqueness.py
  • products/product_analytics/backend/migrations/max_migration.txt
  • products/product_analytics/backend/view_context.py

Included review availability: Your plan provides up to 12 included reviews per hour; 8 remain after this review.

@vdekrijger vdekrijger changed the title fix(caching): attribute insight views by user, context and source feat: record insight views by source and dashboard context Sep 29, 2026
@scheduled-actions-posthog

Copy link
Copy Markdown
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the stale label – otherwise this will be closed in another week. If you want to permanently keep it open, use the waiting label.

@scheduled-actions-posthog

Copy link
Copy Markdown
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the stale label – otherwise this will be closed in another week. If you want to permanently keep it open, use the waiting label.

@scheduled-actions-posthog

Copy link
Copy Markdown
Contributor

This PR was closed due to lack of activity. Feel free to reopen if it's still relevant.

@scheduled-actions-posthog

Copy link
Copy Markdown
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, please remove the stale label – otherwise this will be closed in another week. If you want to permanently keep it open, use the waiting label.

…tibility' into codex/cache-warming-view-context

Brings in master through the compatibility branch. The two insight view
uniqueness migrations are renumbered to 0015 and 0016, after the migrations
master added, with no change to their operations.
A serializer choice list without a class gets a generated enum name taken from
the field. Define the values as an enum so the generated type keeps one name.
The facade returned a queryset of the model, which the model crossing check
does not allow for new code. Return frozen InsightViewContext rows instead.
Also fix type errors in the view context tests.
A caller that only needs recent views, such as cache warming, no longer
loads every view row its candidate insights ever had.
…e-warming-view-context

Renumbers the two uniqueness migrations to 0016 and 0017, after the
migration master added. Their operations are unchanged.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant