Skip to content

feat(toolbar): add events, vitals, more and experiments to the side panel - #121480

Merged
trunk-io[bot] merged 4 commits into
rafa/toolbar-extension-actions-flagsfrom
rafa/toolbar-extension-events-vitals
Oct 28, 2026
Merged

trunk-io[bot] merged 4 commits into
rafa/toolbar-extension-actions-flagsfrom
rafa/toolbar-extension-events-vitals

Conversation

@rafaeelaudibert

@rafaeelaudibert rafaeelaudibert commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Problem

  • Developers check their posthog-js setup with the toolbar's event debugger, web vitals and debug info. The side panel had none of these, so they still needed the floating toolbar.
  • People build no-code web experiments by editing their page in the toolbar. The experiments editor is the last floating toolbar tool the side panel lacks. Product tours and field notes are out of scope for this stack.

Changes

Events, web vitals and more

  • Events: a live stream of the events the page's posthog-js captures. It has search with /regex/, the PostHog, custom and replay filters, the hide toggles, pinning, pause, clear and export, and each event's properties.
  • Web vitals: the project's P90 metrics for the page's path, the page load's own metrics, and the "autocapture is off" state.
  • More menu:
    • Debug info, read from the page's posthog-js, and a link to the current session recording.
    • The PII masking preview on the page.
    • Screenshots for events.
  • Not ported: hedgehog mode. It needs new Function through pixi.js, which Manifest V3 extension code can't run.
  • Dark mode: the panel follows the browser's dark mode.
  • Efficiency:
    • The page agent forwards replay $snapshot payloads only when the replay filter is on.
    • It stops forwarding when Events closes or the panel disconnects.
    • The panel shows the newest 200 filtered rows.
  • Toolbar fixes:
    • A failed screenshot no longer leaves the toolbar's spinner stuck.
    • Uploading with no event selected fails instead of reporting success.
  • Mechanical: the event debugger's row, menu items and JSON export, WebVitalsReport, readPosthogDebugInfo and the PII masking stylesheet helpers move out of the toolbar components. The floating toolbar and the panel both use them.
Live events Web vitals Debug info
15-events 16-web-vitals 17-debug-info
PII masking Screenshot for an event Dark mode
18-pii-masking 18b-screenshot-for-event 21-events-dark
Tool bar at 320px Tool list at 320px
19-navigation-narrow 20-tools-narrow

Web experiments

  • Experiments in the side panel:
    • The project's web experiments list, with search.
    • Creating and editing an experiment: variants, and transforms per variant (selector, HTML and CSS).
    • Picking elements on the page for a transform.
    • Save as draft or save, and "Open in PostHog".
  • Live preview: opening a variant previews it on the page, and edits update the page as the user types. The page goes back to its original state when the user leaves the experiment, saves it, closes the tool, or the page tools restart.
  • Disabled experiments: a page whose snippet sets disable_web_experiments shows the toolbar's warning.
  • Toolbar fixes in experimentsTabLogic:
    • The form reloads when the selected experiment changes, not when the experiments list reloads. A list reload no longer wipes a new experiment's form.
    • Leaving an experiment restores the page and clears the stored original HTML. A later selection can't write it back onto another page.
    • A failed save reports a failure instead of a success.
  • Selector matching: selectors are validated with the same non-deep query that the preview and posthog-js use. A shadow DOM selector can't pass validation and then fail to apply.
  • Mechanical: the toolbar's experiment components (WebExperimentVariant, its header, the transform field and header, and SelectorEditor) now take values and callbacks. The floating toolbar and the panel both drive them.
Experiments list Variant editor with a transform
22-experiments-list 23-experiment-editor
Variant preview on the page Experiments disabled on the page
24-experiment-preview 25-web-experiments-disabled

How did you test this code?

Events, web vitals and more:

  • Loaded the built extension in Playwright Chromium against an invented site with a stubbed posthog-js and a mocked PostHog API. The run checked:
    • the event stream, filters and event detail;
    • web vitals;
    • debug info and the recording link;
    • PII masking on the page;
    • the screenshot preview;
    • the panel at 320px and in dark mode.
  • Not checked: Firefox, a real posthog-js build, a real PostHog backend, and the browser's real side panel UI.

Web experiments:

  • Loaded the built extension in Playwright Chromium against an invented site and a mocked PostHog API. The run checked:
    • the list;
    • creating an experiment, with a picked element and an HTML transform;
    • previewing variants on the page;
    • saving with the bearer token;
    • the page going back to its original state;
    • the disabled warning.
  • Not checked: Firefox, a real PostHog backend, and the browser's real side panel UI.

Test rationale:

Events, web vitals and more:

  • pagePosthogBridge.test.ts checks that a debug info request ends when the page has no posthog-js. Without that check the request hangs until the timeout.
  • It also checks that the bridge subscribes to page events once and fans them out.
  • No jest test covers the two screenshot fixes. The Playwright run covers the preview and the upload.

Web experiments: experimentsTabLogic.test.ts covers each toolbar regression on the floating toolbar:

  • A list reload keeps a new experiment's form.
  • Leaving a previewed experiment puts the page back.
  • A previous experiment's snapshot is never restored onto a changed page.
  • A failed save dispatches a failure, not a success.

Release status

  • No feature flag controls this change

Docs update

The extension README and TELEMETRY.md cover the new tools and experiments.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: Claude Code, Claude Opus 5.5 (claude-opus-5-5)

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

🚨 Trunk lane — universal lane

This PR is assigned to the universal lane. It cannot merge in parallel with other PRs, so it can take longer to merge. Ask dev-ex if you think this is wrong.

⚠️ Complexity (TypeScript) — 14 functions above the limit (max 31)

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
Toolbar frontend/src/toolbar/bar/Toolbar.tsx:479 31 10
ToolbarInfoMenu frontend/src/toolbar/bar/Toolbar.tsx:370 24 10
ExtensionEventsMenu frontend/src/toolbar/extension/ExtensionEventsMenu.tsx:31 19 10
iframeEventListener frontend/src/toolbar/bar/toolbarLogic.ts:1010 16 10
EventDebugMenu frontend/src/toolbar/debug/EventDebugMenu.tsx:45 16 10
handleCommand frontend/src/toolbar/extension/extensionPageExperimentsLogic.ts:280 15 10
run frontend/src/toolbar/extension/pageAgent.ts:156 14 10
inspectElementSelected frontend/src/toolbar/experiments/experimentsTabLogic.tsx:522 13 10
ExtensionScreenshotForEvent frontend/src/toolbar/extension/ExtensionScreenshotForEvent.tsx:13 13 10
setMode frontend/src/toolbar/extension/extensionPageToolbarLogic.ts:224 13 10
setVisibleMenu frontend/src/toolbar/bar/toolbarLogic.ts:765 11 10
ExtensionExperimentEditor frontend/src/toolbar/extension/ExtensionExperimentEditor.tsx:26 11 10
ToolBody frontend/src/toolbar/extension/ExtensionPageToolbarTools.tsx:28 11 10
handleCommand frontend/src/toolbar/extension/extensionPageEventsLogic.ts:237 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.

⚠️ Comment density — 3% of added code lines are comments (115 of 3483)

This section warns when comments are more than 3% of the code lines a PR adds, and alerts above 6%. Before agent-assisted PRs, the typical share was about 2%. Only full-line comments count. Docstrings, generated files, snapshots, migrations, and workflow files are left out.

Comments that restate the code, record how the change came about, or narrate the next line add noise for the next reader. Keep the comments that explain a reason the code cannot show, and remove the rest. See .agents/skills/writing-code-comments/SKILL.md for the house rules.

Files with the most added comment lines:

File Comment lines Added lines
frontend/src/toolbar/extension/pageToolbarBridge.ts 14 115
frontend/src/toolbar/extension/extensionExperimentsLogic.ts 11 258
frontend/src/toolbar/extension/extensionPageEventsLogic.ts 9 268
frontend/src/toolbar/extension/extensionPageExperimentsLogic.ts 9 330
frontend/src/toolbar/extension/extensionPageMoreLogic.ts 9 364
frontend/src/toolbar/experiments/webExperimentEditorContext.ts 8 43
frontend/src/toolbar/actions/SelectorCountContext.ts 5 20
frontend/src/toolbar/experiments/experimentsTabLogic.tsx 5 46

This check does not block merging. It updates on every push and clears when the share drops.

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

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

Total: 77.11 MiB · 🔺 +1.7 KiB (+0.0%)

No file changed by more than 1000 B.

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

⚠️ Eager graph — 3 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.01 MiB · 25 files no change █████████░ 88.1% 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.97 MiB · 621 files no change ██████████ 97.9% of 3.03 MiB
🟡 authenticated shell (every logged-in page)
src/scenes/AuthenticatedShell.tsx
7.58 MiB · 2,566 files no change ██████████ 101.1% of 7.50 MiB
dashboard scene
src/scenes/dashboard/Dashboard.tsx
9.95 MiB · 3,731 files no change ██████████ 99.3% of 10.01 MiB
🟡 today home path
src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
7.76 MiB · 2,659 files no change ██████████ 100.3% of 7.74 MiB
🟡 AI-first home path
src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/ai-first/AiFirstHomepage.tsx
8.01 MiB · 2,652 files no change ██████████ 101.3% of 7.91 MiB
events scene
src/scenes/activity/explore/EventsScene.tsx
9.39 MiB · 3,512 files no change ██████████ 97.9% of 9.59 MiB
web analytics scene
src/scenes/web-analytics/WebAnalyticsScene.tsx
10.33 MiB · 3,764 files no change ██████████ 95.3% of 10.83 MiB
replay detail scene
src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
8.41 MiB · 3,088 files no change █████████░ 88.8% of 9.47 MiB

🟢 node_modules/monaco-editor/ stays out of src/index.tsx
🟢 src/lib/components/ActivityLog/describers 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/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/scenes/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/monaco-editor/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/lib/components/ActivityLog/describers 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
🟢 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
🟢 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
🟢 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/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/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
🟢 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/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/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

Largest files eagerly shipped from src/index.tsx
Size File
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
24.6 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.7 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.7 KiB ../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
1.7 KiB src/index.tsx
1.6 KiB src/lib/utils/bootTiming.ts
1.2 KiB src/RootErrorBoundary.tsx
949 B src/scenes/ChunkLoadErrorBoundary.tsx
Largest files eagerly shipped from src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
Size File
322.9 KiB ../node_modules/.pnpm/posthog-js@1.438.23_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
217.5 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.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.1 KiB src/products.tsx
86.2 KiB src/lib/api.ts
68.3 KiB src/lib/lemon-ui/icons/icons.tsx
41.9 KiB ../node_modules/.pnpm/@dnd-kit+core@6.0.8_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
27.0 KiB ../node_modules/.pnpm/tailwind-merge@2.2.2/node_modules/tailwind-merge/dist/bundle-mjs.mjs
24.6 KiB ../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
Size File
322.9 KiB ../node_modules/.pnpm/posthog-js@1.438.23_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
286.4 KiB src/taxonomy/core-filter-definitions-by-group.json
239.9 KiB ../packages/quill/packages/quill/dist/index.js
217.5 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
153.8 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.1 KiB src/products.tsx
94.5 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
92.5 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
86.2 KiB src/lib/api.ts
Largest files eagerly shipped from src/scenes/dashboard/Dashboard.tsx
Size File
322.9 KiB ../node_modules/.pnpm/posthog-js@1.438.23_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
286.4 KiB src/taxonomy/core-filter-definitions-by-group.json
239.9 KiB ../packages/quill/packages/quill/dist/index.js
217.5 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
153.8 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
144.1 KiB ../packages/quill/packages/primitives/dist/index.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.1 KiB src/products.tsx
94.5 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
92.5 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx + src/scenes/project-homepage/ProjectHomepage.tsx + src/scenes/project-homepage/today/TodayHome.tsx
Size File
322.9 KiB ../node_modules/.pnpm/posthog-js@1.438.23_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
286.4 KiB src/taxonomy/core-filter-definitions-by-group.json
239.9 KiB ../packages/quill/packages/quill/dist/index.js
217.5 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
153.8 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.1 KiB src/products.tsx
94.5 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
92.5 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
86.2 KiB src/lib/api.ts
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
322.9 KiB ../node_modules/.pnpm/posthog-js@1.438.23_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
286.4 KiB src/taxonomy/core-filter-definitions-by-group.json
239.9 KiB ../packages/quill/packages/quill/dist/index.js
217.5 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
153.8 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
144.1 KiB ../packages/quill/packages/primitives/dist/index.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.1 KiB src/products.tsx
94.5 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
92.5 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
Largest files eagerly shipped from src/scenes/activity/explore/EventsScene.tsx
Size File
322.9 KiB ../node_modules/.pnpm/posthog-js@1.438.23_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
286.4 KiB src/taxonomy/core-filter-definitions-by-group.json
239.9 KiB ../packages/quill/packages/quill/dist/index.js
217.5 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
153.8 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
144.1 KiB ../packages/quill/packages/primitives/dist/index.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.1 KiB src/products.tsx
94.5 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
92.5 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
Largest files eagerly shipped from src/scenes/web-analytics/WebAnalyticsScene.tsx
Size File
322.9 KiB ../node_modules/.pnpm/posthog-js@1.438.23_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
286.4 KiB src/taxonomy/core-filter-definitions-by-group.json
239.9 KiB ../packages/quill/packages/quill/dist/index.js
217.5 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
182.9 KiB src/queries/validators.js
153.8 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
144.1 KiB ../packages/quill/packages/primitives/dist/index.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.1 KiB src/products.tsx
94.5 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
Largest files eagerly shipped from src/scenes/session-recordings/detail/SessionRecordingDetail.tsx
Size File
322.9 KiB ../node_modules/.pnpm/posthog-js@1.438.23_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
316.1 KiB ../node_modules/.pnpm/posthog-js@1.438.23_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/rrweb.js
286.4 KiB src/taxonomy/core-filter-definitions-by-group.json
239.9 KiB ../packages/quill/packages/quill/dist/index.js
217.5 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
153.8 KiB ../node_modules/.pnpm/re2js@0.4.1/node_modules/re2js/build/index.esm.js
126.8 KiB ../node_modules/.pnpm/react-dom@18.3.1_react@18.3.1/node_modules/react-dom/cjs/react-dom.production.min.js
102.1 KiB src/products.tsx
94.5 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
92.5 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js

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

✅ Toolbar bundle — eager 2.30 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.30 MiB · 18 files 🔺 +699 B (+0.0%) ████░░░░░░ 40.3% of 5.72 MiB
Deferred (lazy) 2.11 MiB · 40 files 🔺 +1.1 KiB (+0.1%) 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
914.6 KiB dist/toolbar/toolbar-app-YBVNN4Q2.css
695.4 KiB dist/toolbar/chunk-chunk-JXHLL4XQ.js
260.0 KiB dist/toolbar/chunk-chunk-WXVSJG6X.js
131.8 KiB dist/toolbar/chunk-chunk-FDH2IBXT.js
130.4 KiB dist/toolbar/chunk-chunk-LPBNVREQ.js
75.6 KiB dist/toolbar/toolbar-app-SI5TXLK3.js
69.0 KiB dist/toolbar/chunk-chunk-TSAL54PB.js
35.6 KiB dist/toolbar/chunk-chunk-ZIESNPDZ.js
21.7 KiB dist/toolbar/chunk-chunk-O7M5PFP7.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 — 🔺 +14.3 KiB (+0.0%)

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

Total: 971.13 MiB · 🔺 +14.3 KiB (+0.0%)

✅ Playwright — all passed

All tests passed.

View test results →

✅ Hogbox preview — ready, open the preview

▶ Open the preview

🔑 Login test@posthog.com / 12345678 (demo data)
🧩 Running this PR's backend and frontend, on the PostHog :master base
🔗 Link stable across rebuilds: a re-push swaps the box underneath, the URL stays
🔒 Access tailnet only (PostHog VPN)
🛠️ Admin inspect & debug state in hogland
💤 Idle sleeps after ~30 min idle (snapshot to S3, zero node cost) and wakes on your next visit in ~30s, behind a brief "waking up" screen

commit 97b113e · box box-a18947dc804a · ready in 1088s (push → usable) · build log · rebuilds on every push, torn down on close

@parameterai

parameterai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Risk: No findings

This increment wires the web-experiments editor into the extension side panel: the panel edits a copy of the experiment form, commands flow to the page over the extension port, and the page previews variants. The command channel stays extension-only (the page cannot reach it), page-sourced state is rendered only as escaped text, and all HTML/CSS applied to the page goes through the existing sanitizers, so no new attack surface is introduced.

Sentinel reviewed 97b113e · Review settings

@posthog posthog 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.

PostHog Review · Standard · reviewed dc016e1: 8 Should fix. This pull request is large, so the review ran in 4 parts with less depth than usual.

This is the only automatic review while this pull request is a draft. Comment @posthog review to review new changes sooner. Otherwise, a review of the new changes runs when you mark it ready for review.

Comment on lines +46 to +49
openWebVitals: () => {
if (!webVitalsToolbarLogic.findMounted()) {
webVitalsToolbarLogic.mount()
}

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.

P2 · Start collecting web vitals before the tool opens

When the page emits $web_vitals before the user opens this tool, webVitalsToolbarLogic has no listener yet and permanently misses those measurements. Opening the tool leaves the affected local metric cards spinning, and Reload only fetches remote metrics. Mount the collector when the page tools start, as ToolbarApp already does.

Comment on lines +60 to +64
const next: PageToolbarWebVitalsState = {
autocaptureEnabled: !!posthog?.webVitalsAutocapture?.isEnabled,
pathname: window.location.pathname,
localWebVitals: webVitals?.localWebVitals ?? NO_WEB_VITALS,
remoteWebVitals: webVitals?.remoteWebVitals ?? NO_WEB_VITALS,

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.

P2 · Refresh web vitals when the page path changes

After an SPA navigates with pushState, this state labels retained metrics with the new pathname. The extension forwards navigation to currentPageLogic.setHref, but webVitalsToolbarLogic resets and fetches through urlToAction; pushState emits no popstate. Wire page URL changes to reset local metrics and fetch the new path's remote metrics.

Comment on lines +52 to +54
reducers({
// The page filters with the search a moment later, so the input keeps what the user typed meanwhile.
searchText: ['', { setSearchText: (_, { searchText }) => searchText }],

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.

P2 · Restore the page's search when reopening Events

After filtering Events, switching to another tool and reopening Events remounts extensionEventsLogic with an empty searchText. The page keeps eventDebugMenuLogic mounted with the previous filter, so the list remains filtered while the input appears empty. Include the page's search in its state and restore the input when the panel logic mounts.

Comment on lines +116 to +118
uploadScreenshot: () => {
actions.sendMoreCommand({ type: 'upload-screenshot' })
capturePageToolUsed('screenshot-for-event')

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.

P2 · Block duplicate screenshot commands before the page acknowledges them

Clicking Upload twice before the page's throttled state update sends two upload-screenshot commands. submitUpload starts both media uploads before its first breakpoint, leaving the superseded upload unattached and wasting bandwidth and storage. The remote screenshot.uploading flag cannot close this window; set and guard pending state locally when dispatching.

Comment on lines +44 to +49
<LemonButton
size="small"
type="secondary"
icon={<IconRefresh />}
onClick={() => sendCommand({ tool: 'web-vitals', command: { type: 'reload-web-vitals' } })}
data-attr="toolbar-extension-web-vitals-reload"

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.

P2 · Disable web vitals reload while a request is running

When web vitals requests are slow, Reload stays enabled and every click starts another getWebVitals request. The loader checks its breakpoint only after the HTTP request completes, so superseded requests continue consuming network and server resources. Forward remoteWebVitalsLoading through the bridge and disable Reload while the request runs.

Comment on lines +230 to +232
expandedEventId: expandedEvent ?? null,
expandedProperties: open && !Array.isArray(expandedProperties) ? expandedProperties : {},
expandedEventPayload,

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.

P2 · Send expanded event payloads separately from streaming row updates

With a large $snapshot expanded, each incoming event changes pageState, so PageToolbarHost retransmits the unchanged recording payload up to ten times per second. Both expandedProperties and expandedEventPayload contain its properties, multiplying serialization and panel rendering costs. Send expanded details separately when the selection changes.

Comment on lines +47 to +48
if (!webVitalsToolbarLogic.findMounted()) {
webVitalsToolbarLogic.mount()

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.

P2 · Unmount the web vitals router before resetting the context

Opening Web vitals permanently mounts webVitalsToolbarLogic and its router connection. When the panel closes long enough for PageToolbarHost.stop(), resetting the context leaves the router's popstate listener attached because its cleanup runs only on unmount. Reopening accumulates listeners and duplicate navigation dispatches; explicitly tear down these mounts before resetting.

Comment on lines +225 to +227
if (reply.kind === 'event-captured') {
for (const callback of this.eventCapturedCallbacks) {
callback(reply.event)

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.

P2 · Validate captured event payloads at the page boundary

Any script on the inspected page can forge an event-captured reply through window.postMessage. A payload such as { event: null } passes directly into eventDebugMenuLogic; classifyEvent then throws on startsWith, blocking toolbar state generation while the poisoned event remains stored. Validate the event schema before invoking callbacks.

@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team October 21, 2026 18:42
listeners(({ actions }) => ({
sendMoreCommand: ({ command }) => actions.sendCommand({ tool: 'more', command }),
openSessionRecording: ({ url }) => {
void openTab(url)

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.

Low: Page-supplied URL passed to tabs.create without a scheme check

url here is debugInfo.sessionReplayUrl, which the page agent reads from the page's own window.posthog.get_session_replay_url(). Any script on the page can override that to return an arbitrary string, and the extension then opens it with tabs.create when the user clicks "View current session recording". Browsers reject javascript: there, but Chrome does allow chrome:// pages (which web content can't navigate to itself) and any http(s) URL, so a page can make the extension's trusted UI open an attacker-chosen page. The floating toolbar's Link already filters this; the panel path should at least restrict to http(s), ideally to the configured UI host.

Suggested change
void openTab(url)
if (/^https?:\/\//i.test(url)) {
void openTab(url)
}

@veria-ai

veria-ai Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

PR overview

The PR adds events, web vitals, and additional tools to the toolbar side panel, including an action to open the current session recording.

One issue remains open, with none addressed so far: the session-recording action opens a page-supplied URL without checking its scheme. If a page script overrides that URL, a user clicking the action can be sent to an attacker-chosen website or a Chrome internal page. The impact is limited to user-triggered navigation; browsers reject javascript: URLs in this API.

Open issues (1)

Fixed/addressed: 0 · PR risk: 4/10

@rafaeelaudibert
rafaeelaudibert force-pushed the rafa/toolbar-extension-events-vitals branch from dc016e1 to 7411919 Compare October 21, 2026 19:42

@posthog posthog 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.

PostHog Review · Standard · reviewed 7411919: no findings. This pull request is large, so the review ran in 4 parts with less depth than usual.

@trunk-io

trunk-io Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

Failed Test Failure Summary Logs
Scenes-App/People/Person PersonNotFound smoke-test The page timed out waiting for loading indicators to disappear. Logs ↗︎

View Full Report ↗︎ ⋅ Docs

@rafaeelaudibert
rafaeelaudibert force-pushed the rafa/toolbar-extension-events-vitals branch from 7411919 to d043bfb Compare October 21, 2026 20:44
@rafaeelaudibert
rafaeelaudibert removed this pull request from stack #121485 October 21, 2026 21:11
@rafaeelaudibert
rafaeelaudibert removed this pull request from stack #121637 October 27, 2026 01:03
@rafaeelaudibert rafaeelaudibert changed the title feat(toolbar): add events, web vitals and more tools to the side panel feat(toolbar): add events, vitals, more and experiments to the side panel Oct 27, 2026
@trunk-io

trunk-io Bot commented Oct 27, 2026

Copy link
Copy Markdown

Stacked PR 121483 was cancelled: the stack changed after it was queued.

@posthog posthog 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.

PostHog Review · Standard · reviewed 97b113e: 1 Should fix. This pull request is large, so the review ran in 4 parts with less depth than usual.

Comment on lines +290 to +293
case 'set-experiment-form':
tab.setExperimentFormValues(command.form)
// Shows the edited HTML and CSS on the page as the user types.
tab.applyVariant(values.selectedVariant)

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.

P2 · Apply experiment previews only when their transforms change

Editing an experiment's name sends set-experiment-form, which unconditionally calls applyVariant. That restores every saved subtree and reapplies all selected transforms, repeating sanitization and DOM replacement despite unchanged preview content. On large targets this causes unnecessary layout work and resets live DOM state; skip preview application for metadata-only edits.

@rafaeelaudibert
rafaeelaudibert requested review from a team, MattBro and fercgomes and removed request for a team October 27, 2026 02:03
@rafaeelaudibert rafaeelaudibert added the stamphog Request AI approval (no full review) label Oct 27, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Not approved yet — waiting on the conditions below.

Re-add the stamphog label to request another review once you have addressed this.

The size gate refused this pull request: it changes 4316 substantive lines across 53 files, and the ceiling for auto-review is 800 lines (4435 lines across 59 files once docs, generated files and snapshots are counted). The other gates passed, but this one alone is enough to stop it, and stamphog won't review it.

The simplest way forward is to split it into smaller pull requests. The description already suggests natural seams: the events, web vitals and "more" menu work, the web experiments editor, and the mechanical moves of shared components and helpers out of the toolbar. Each could go up on its own. If splitting isn't practical, ask a human reviewer to look at it directly.

Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
size ✗ too large for auto-review (4316L substantive in global — ceiling is 800L; 4316L, 53F total, 4435L/59F incl. docs/generated/snapshots)
tier ✓ T1-agent / T1d-complex (4435L, 59F, single-area, feat)
stamphog 2.6.1 .stamphog/policy.yml @ unknown · reviewed head 05cedbd

@stamphog stamphog Bot removed the stamphog Request AI approval (no full review) label Oct 27, 2026
@fercgomes

Copy link
Copy Markdown
Contributor
Screen.Recording.2026-10-27.at.08.57.15.mov

screenshot upload feature is broken

@fercgomes fercgomes 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.

fixing the screenshot upload bug and this should be good

@lricoy

lricoy commented Oct 27, 2026

Copy link
Copy Markdown
Member

This looks really nice!

@rafaeelaudibert
rafaeelaudibert force-pushed the rafa/toolbar-extension-events-vitals branch from 05cedbd to 1adafc5 Compare October 27, 2026 21:14
@trunk-io

trunk-io Bot commented Oct 28, 2026

Copy link
Copy Markdown

Stacked PR 123749 was cancelled: it waited too long to become mergeable.

rafaeelaudibert and others added 4 commits October 28, 2026 00:54
- Events: the toolbar's event debugger runs in the content script, fed by
  the page agent's eventCaptured forwarding. The panel shows the newest
  200 filtered rows with search, type filters, the hide toggles, pinning,
  pause, clear, export and the open event's properties.
- Web vitals: the toolbar's web vitals logic runs in the page, with the
  project's P90 metrics and the page load's $web_vitals.
- More: debug info read from the page's posthog-js, the current session
  recording link, the PII masking preview and screenshots for events.
- The panel follows the browser's dark mode.
- Mechanical: EventRow, the debugger's menu items, the JSON export,
  WebVitalsReport and the PII masking warnings move out of their toolbar
  components, and screenshots skip the extension's overlay root.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The side panel lists the project's web experiments, creates and edits
them, and previews each variant on the page. The content script runs
the toolbar's experimentsLogic and experimentsTabLogic, so picking an
element, the HTML sanitization and the transforms match the floating
toolbar. The page goes back to its original state when the user leaves
an experiment, saves it, or closes the tool. A page whose snippet sets
disable_web_experiments shows the toolbar's warning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s editor

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…typegen

kea-typegen prints the connected selectedExperimentId type without its
'new' literal, so the regenerated inline types didn't parse. Read the
value through experimentsTabLogic's selector instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rafaeelaudibert
rafaeelaudibert requested a review from a team as a code owner October 28, 2026 04:03
@rafaeelaudibert
rafaeelaudibert force-pushed the rafa/toolbar-extension-events-vitals branch from 1adafc5 to 8fed4a4 Compare October 28, 2026 04:05
@trunk-io
trunk-io Bot merged commit c213467 into master Oct 28, 2026
224 checks passed
@trunk-io
trunk-io Bot deleted the rafa/toolbar-extension-events-vitals branch October 28, 2026 11:59
@trunk-io

trunk-io Bot commented Oct 28, 2026

Copy link
Copy Markdown

This pull request was merged into master as part of stacked PR 123749.

@deployment-status-posthog

deployment-status-posthog Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-10-28 12:20 UTC Run
prod-us ✅ Deployed 2026-10-28 12:40 UTC Run
prod-eu ✅ Deployed 2026-10-28 12:38 UTC Run

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.

3 participants