Skip to content

chore(analytics): remove unused event usage actions - #107471

Open
pauldambra wants to merge 1 commit into
posthog/inline-single-use-event-usage-actionsfrom
posthog/remove-unused-event-usage-actions
Open

pauldambra wants to merge 1 commit into
posthog/inline-single-use-event-usage-actionsfrom
posthog/remove-unused-event-usage-actions

Conversation

@pauldambra

Copy link
Copy Markdown
Member

Robot-written PR.

Problem

Unused tracking actions make eventUsageLogic harder to maintain. Why: the old actions have no callers but still appear in Kea types and connections.

Changes

  • Remove 25 uncalled tracking actions and their stale Kea connections. This is a mechanical cleanup; it should not change captured events.
  • Stack this change on the caller cleanup.

How did you test this code?

  • Ran the event usage, experiment, and survey Jest suites.
  • Ran frontend lint, format, TypeScript check, and targeted Kea typegen.
  • Did not test the app manually; the change removes code with no call sites.

Release status

  • No feature flag controls this change

Automatic notifications

  • Publish to changelog?

Docs update

None. This change only removes unused internal actions.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Agent: Codex CLI, gpt-6-astra

No matching issue or duplicate PR was found. The /writing-pr-descriptions skill guided this body. This cloud task did not run a local CodeRabbit review.


Created with PostHog Desktop

Generated-By: PostHog Desktop
Task-Id: 9f22c075-697f-4cfb-bd0b-92913c9032c5
@pauldambra pauldambra self-assigned this Sep 27, 2026
@pauldambra
pauldambra added this pull request to stack #107472 September 27, 2026 21:37
@posthog

posthog Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

FLASH MODE - Faster, but stupid, use regular ReviewHog for a heavy review

🦔 PostHog Review reviewed this pull request

Nothing worth raising this time. Enjoy the moment:

A panda relaxing and waving

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🤖 CI report

✅ Trunk lane — non-backend lane

This PR is assigned to the non-backend lane. It does not run backend Python tests and may merge in parallel with PRs in other lanes.

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

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
<anonymous> frontend/src/scenes/surveys/surveyLogic.tsx:4050 33 10
refreshExperimentResults frontend/src/scenes/experiments/experimentLogic.tsx:2448 27 10
saveExperiment frontend/src/scenes/experiments/ExperimentForm/createExperimentLogic.ts:384 22 10
moveMetricsBetweenSections frontend/src/scenes/experiments/experimentLogic.tsx:3264 22 10
<anonymous> frontend/src/scenes/surveys/surveyLogic.tsx:3304 19 10
<anonymous> frontend/src/scenes/surveys/surveyLogic.tsx:3945 19 10
<anonymous> frontend/src/scenes/experiments/experimentLogic.tsx:3903 15 10
setFunnelsMetric frontend/src/scenes/experiments/experimentLogic.tsx:1716 13 10
<anonymous> frontend/src/scenes/surveys/surveyLogic.tsx:3564 13 10
loadConsolidatedSurveyResultsSuccess frontend/src/scenes/surveys/surveyLogic.tsx:2089 12 10
setDefaultForQuestionType frontend/src/scenes/surveys/surveyLogic.tsx:2547 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.5 KiB (-0.0%)

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

Total: 68.86 MiB · 🟢 -4.5 KiB (-0.0%)

File Size Δ vs base
render-query/src/render-query/render-query.js 20.24 MiB 🟢 -4.5 KiB (-0.0%)

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

✅ Eager graph — within 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.57 MiB · 22 files no change █████████░ 85.2% of 1.84 MiB
logged-out boot: index + App + bootApp (preloaded by every page, including /login)
src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
3.56 MiB · 628 files 🟢 -4.4 KiB (-0.1%) █████████░ 88.3% of 4.03 MiB
authenticated shell (every logged-in page)
src/scenes/AuthenticatedShell.tsx
7.36 MiB · 2,326 files 🟢 -4.4 KiB (-0.1%) █████████░ 88.2% of 8.34 MiB

🟢 node_modules/monaco-editor/ stays out of src/index.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/index.tsx
🟢 [object Object] stays out of src/index.tsx
🟢 [object Object] 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/monaco-editor/ stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/lib/components/ActivityLog/describers stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
🟢 src/scenes/session-recordings/player/sessionRecordingPlayerLogic.ts stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.tsx
🟢 [object Object] stays out of src/scenes/AuthenticatedShell.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.5 KiB ../node_modules/.pnpm/@jspm+core@2.1.0/node_modules/@jspm/core/nodelibs/browser/process.js
3.9 KiB ../node_modules/.pnpm/scheduler@0.23.2/node_modules/scheduler/cjs/scheduler.production.min.js
1.4 KiB ../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js
1.3 KiB src/index.tsx
1.3 KiB src/RootErrorBoundary.tsx
912 B ../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js
854 B src/scenes/ChunkLoadErrorBoundary.tsx
Largest files eagerly shipped from src/index.tsx + src/scenes/App.tsx + src/scenes/bootApp.ts
Size File
301.8 KiB ../node_modules/.pnpm/posthog-js@1.434.14_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
267.6 KiB ../node_modules/.pnpm/@posthog+icons@0.38.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
100.4 KiB src/lib/api.ts
85.5 KiB src/products.tsx
69.1 KiB src/lib/lemon-ui/icons/icons.tsx
46.2 KiB src/lib/utils/eventUsageLogic.ts
38.7 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
33.9 KiB ../node_modules/.pnpm/kea@4.0.0-pre.6_patch_hash=139b8d1f1304f9d9da452a9a1244c94ea679dbcb85687d8999563146879fb6f5_react@18.3.1/node_modules/kea/lib/index.cjs.js
28.3 KiB src/scenes/scenes.ts
Largest files eagerly shipped from src/scenes/AuthenticatedShell.tsx
Size File
301.8 KiB ../node_modules/.pnpm/posthog-js@1.434.14_@types+react@18.3.27_react@18.3.1/node_modules/posthog-js/dist/module.mjs
271.7 KiB src/taxonomy/core-filter-definitions-by-group.json
267.6 KiB ../node_modules/.pnpm/@posthog+icons@0.38.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js
153.7 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
100.4 KiB src/lib/api.ts
98.5 KiB ../packages/quill/packages/quill/dist/index.js
93.3 KiB ../node_modules/.pnpm/prosemirror-view@1.40.1/node_modules/prosemirror-view/dist/index.js
90.6 KiB ../node_modules/.pnpm/@tiptap+core@3.20.6_@tiptap+pm@3.20.6/node_modules/@tiptap/core/dist/index.js
85.5 KiB src/products.tsx

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.37 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.37 MiB · 19 files no change ████░░░░░░ 41.4% of 5.72 MiB
Deferred (lazy) 2.10 MiB · 44 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
791.7 KiB dist/toolbar/toolbar-app-XDB3CY2H.css
650.8 KiB dist/toolbar/chunk-chunk-OLZXKW3U.js
483.6 KiB dist/toolbar/chunk-chunk-LP5DDLVQ.js
138.3 KiB dist/toolbar/chunk-chunk-FVYKO6VU.js
131.8 KiB dist/toolbar/chunk-chunk-FDH2IBXT.js
75.2 KiB dist/toolbar/toolbar-app-M6TDBA3J.js
69.0 KiB dist/toolbar/chunk-chunk-TSAL54PB.js
35.6 KiB dist/toolbar/chunk-chunk-GL4SRUHV.js
21.0 KiB dist/toolbar/chunk-chunk-Z4YQYAC3.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 — 🟢 -94.6 KiB (-0.0%)

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

Total: 944.57 MiB · 🟢 -94.6 KiB (-0.0%)

✅ Playwright — all passed

All tests passed.

View test results →

@pauldambra
pauldambra marked this pull request as ready for review September 27, 2026 21:42
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team September 27, 2026 21:43
@pr-assigner-resolver-posthog

Copy link
Copy Markdown

👀 Auto-assigned reviewers

These soft owners were skipped because they only have minor changes here. Nothing blocks merge, so self-assign if you'd like a look:

  • @PostHog/conversations (frontend/src/scenes/owners.yaml)

Soft owners come from each directory's owners.yaml and each product's product.yaml (resolved nearest-file-wins). The locator after each owner is the file that decided it. Generated files and lockfiles are ignored when deciding ownership.

@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦔 Hogbox preview · ✅ ready

▶ 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 de161cd · box box-647bbbf77e8f · ready in 651s (push → usable) · build log · rebuilds on every push, torn down on close

@pauldambra pauldambra added the stamphog Request AI approval (no full review) label Sep 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.

Approved.

Pure removal of dead analytics-tracking actions and their stale Kea connections; grep confirms no remaining call sites anywhere in the tree, so this is a contained, reversible cleanup outside risky territory.

  • Author wrote 0% of the modified lines and has 26 merged PRs in these paths (familiarity MODERATE).
Gate mechanics and policy version
Gate Result
prerequisites ✓ all clear
deny-list ✓ no deny categories matched
size ✓ 415L, 5F substantive — within ceiling
tier ✓ T1-agent / T1d-complex (415L, 5F, single-area, chore)
stamphog 2.2.0 .stamphog/policy.yml @ de161cd · reviewed head de161cd

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-27T21:46:54.728780Z de161cd Draft marked ready
ℹ️ About Codex in GitHub

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

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

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: QUIET

Plan: Enterprise

Run ID: faffd512-5d1b-480b-bce8-e4389fe663a0

📥 Commits

Reviewing files that changed from the base of the PR and between 92d4235 and de161cd.

📒 Files selected for processing (5)
  • frontend/src/lib/utils/eventUsageLogic.ts
  • frontend/src/scenes/experiments/ExperimentForm/createExperimentLogic.ts
  • frontend/src/scenes/experiments/ExperimentTabContent/createDraftExperimentFromFlagLogic.ts
  • frontend/src/scenes/experiments/experimentLogic.tsx
  • frontend/src/scenes/surveys/surveyLogic.tsx
💤 Files with no reviewable changes (4)
  • frontend/src/scenes/surveys/surveyLogic.tsx
  • frontend/src/scenes/experiments/experimentLogic.tsx
  • frontend/src/scenes/experiments/ExperimentTabContent/createDraftExperimentFromFlagLogic.ts
  • frontend/src/lib/utils/eventUsageLogic.ts

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The change removes selected event actions, action creators, and PostHog capture listeners from eventUsageLogic. It also removes corresponding imports, action declarations, and connections from experiment creation, experiment management, and survey logic. Other event actions and the noted remaining logic connections are unchanged.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to de161

This cleanup removes unused telemetry wiring without an evidenced change to active user workflows. No actionable merge risk remains; the PR is ready after normal checks.

Architecture Summary

Architecture risk: 🔵 Low · up to de161

The change affects 1 system.

Changed systems: frontend

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — frontend (service) was modified; 5 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in frontend/src/lib/utils/eventUsageLogic.ts: Removed the HelpType import after deleting the help-button action declarations and handlers.
  • observed — Modified behavior in frontend/src/lib/utils/eventUsageLogic.ts: Removed the AI chat onboarding message, start, and step-time actions, plus the activation-sidebar task action. The account-owner action remains.
  • observed — Modified behavior in frontend/src/lib/utils/eventUsageLogic.ts: Removed the billing upgrade and downgrade click actions; the billing spend interaction action remains.
  • observed — Modified behavior in frontend/src/lib/utils/eventUsageLogic.ts: Removed the dashboard date-range-changed action and its optional date bounds.
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The description follows the required structure and clearly states the problem, mechanical changes, testing performed, release status, documentation impact, and agent context. It also states that manua…
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@posthog

posthog Bot commented Sep 27, 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.

@trunk-io

trunk-io Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

Failed Test Failure Summary Logs
the activity log logic humanizing insights can handle change of insight query as a query wrapped in an InsightVizNode The test exceeded the maximum allowed time of 15 seconds and timed out. Logs ↗︎
the activity log logic humanizing insights can handle change of a SQL insight query The test failed because it could not find the specified path 'scenes.PreflightCheck.preflightLogic' in the store. Logs ↗︎

View Full Report ↗︎ ⋅ Docs

This branch was successfully deployed

1 active deployment
preview-pr-107471 — de161cd7 Deployed Sep 27, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stamphog Request AI approval (no full review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant