Skip to content

chore: remove posthog integration and analytics scaffold - #9634

Open
sriramveeraghanta wants to merge 2 commits into
previewfrom
chore/remove-posthog
Open

chore: remove posthog integration and analytics scaffold#9634
sriramveeraghanta wants to merge 2 commits into
previewfrom
chore/remove-posthog

Conversation

@sriramveeraghanta

@sriramveeraghanta sriramveeraghanta commented Aug 17, 2026

Copy link
Copy Markdown
Member

Description

Removes PostHog end to end.

The backend integration was live: track_event fired to the PostHog SDK from six call sites, and POSTHOG_API_KEY/POSTHOG_HOST were exposed through the unauthenticated GET /api/instances/ endpoint.

The frontend SDK was already removed in d61b157 (#8465), but that pass left ~700 lines of inert scaffold behind — invisible to a posthog grep because it is spelled ph. This PR finishes that job.

Backend

  • Delete bgtasks/event_tracking_task.py and utils/analytics_events.py
  • Remove all 6 track_event.delay(...) call sites (workspace/base.py, workspace/invite.py, workspace_project_join.py)
  • Drop POSTHOG_API_KEY / POSTHOG_HOST from settings
  • Stop returning posthog_api_key / posthog_host from GET /api/instances/
  • Drop the posthog==3.5.0 dependency

Frontend

  • Delete packages/constants/src/event-tracker/ — all 40 exports verified to have zero consumers
  • Remove 42 data-ph-element attributes across 36 files
  • Remove the dead shouldTrackEvents prop chain (20 sites) and trackerElements chain (6 files) — both were threaded through the tree but never read
  • Remove the Microsoft Clarity session-recording tag (layout.tsx, root.tsx) and its 2 turbo.json env entries

No behavioural change: nothing in the repo consumed any of this.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

N/A — pure removal, no UI change. The data-ph-element attributes were non-visual DOM annotations.

Test Scenarios

  • Workspace lifecycle — create a workspace, then delete it. Both former track_event sites must complete with no Celery errors in the worker log.
  • Invites — invite a member to a workspace, accept the invite, and join via a pre-accepted invite (process_workspace_project_invitations). Covers the remaining 4 call sites.
  • Instance configGET /api/instances/ returns 200 with no posthog_* keys, and enable_signup / has_unsplash_configured / has_llm_configured still hold correct values. (The endpoint is cached 2h — flush Redis first.) This guards the positional-tuple unpack in instance.py, which had to stay arity-matched with its config list.
  • Filter rows — on project / cycle / module / view / global-view layouts, confirm the "Clear all", "Save view", and "Update view" buttons still render and function.
  • Project states — under Project Settings → States, create, rename, and delete a state, and reorder groups. This exercises the whole shouldTrackEvents tree that was unwound.
  • Auth screens — sign-in page renders, "Forgot password" and "Sign in with unique code" links work.
  • Buildpnpm turbo run build and ruff check / manage.py check pass.

References

Supersedes the partial removal in #8465.

Reviewer notes — two things worth a look:

  1. API contract. GET /api/instances/ no longer returns posthog_api_key / posthog_host. Nothing in this repo read them, and I confirmed neither plane-ee nor plane-commercial does either — but the endpoint is AllowAny and cached for 2 hours, so any external consumer will get undefined and stale responses may linger after deploy.
  2. Downstream sync. plane-ee and plane-commercial keep their own copies of project-states with their own shouldTrackEvents props. They will not break (they don't import CE's), but expect merge conflicts there.

Left alone deliberately, as out of scope: removing Clarity orphaned the next/script compat shim (apps/web/app/compat/next/script.tsx, its Vite alias, types/next-script.d.ts) — now zero consumers. Separately, turbo.json still has 10 orphaned SENTRY_* env entries with no @sentry/* dependency anywhere. Both are easy follow-ups.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HD7dTidmtWWRRiFv3nmW3s

Summary by CodeRabbit

  • Privacy & Tracking
    • Removed product analytics and session-recording collection across workspace, project, authentication, and settings interactions.
    • Removed related tracking configuration and event instrumentation.
  • Bug Fixes
    • Simplified affected controls and filters while preserving their existing actions, permissions, and workflows.
  • Refactor
    • Cleaned up obsolete tracking settings and metadata from the application.

Removes the PostHog integration end to end, plus the inert autocapture
scaffold left behind by an earlier partial removal (d61b157,
"chore: remove posthog events (#8465)").

Backend:
- delete bgtasks/event_tracking_task.py and utils/analytics_events.py
- drop all 6 track_event.delay call sites
- drop POSTHOG_API_KEY / POSTHOG_HOST settings
- stop returning posthog_api_key / posthog_host from GET /api/instances/
- drop the posthog==3.5.0 dependency

Frontend:
- delete packages/constants/src/event-tracker (all 40 exports were unused)
- remove 42 data-ph-element attributes across 36 files
- remove the dead shouldTrackEvents and trackerElements prop chains
- remove the Microsoft Clarity session-recording tag

Note: GET /api/instances/ no longer returns posthog_api_key/posthog_host.
Nothing in this repo read them and neither do plane-ee or plane-commercial,
but the endpoint is AllowAny and cached for 2h.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HD7dTidmtWWRRiFv3nmW3s
Copilot AI lite review requested due to automatic review settings August 17, 2026 20:43
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 482d4726-58fc-48d0-a3cf-aff777c5634f

📥 Commits

Reviewing files that changed from the base of the PR and between 2894410 and cb2f67e.

📒 Files selected for processing (7)
  • apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(list)/header.tsx
  • apps/web/app/(all)/[workspaceSlug]/(projects)/workspace-views/header.tsx
  • apps/web/core/components/issues/header.tsx
  • apps/web/core/components/project-states/state-list.tsx
  • apps/web/core/components/project/settings/control-section.tsx
  • apps/web/core/components/web-hooks/form/delete-section.tsx
  • apps/web/core/components/web-hooks/form/form.tsx
🚧 Files skipped from review as they are similar to previous changes (7)
  • apps/web/core/components/web-hooks/form/delete-section.tsx
  • apps/web/core/components/project-states/state-list.tsx
  • apps/web/core/components/project/settings/control-section.tsx
  • apps/web/app/(all)/[workspaceSlug]/(projects)/workspace-views/header.tsx
  • apps/web/core/components/web-hooks/form/form.tsx
  • apps/web/core/components/issues/header.tsx
  • apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(list)/header.tsx

Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The change removes backend analytics events, PostHog configuration, session recording, frontend tracker constants, tracking attributes, and event-related component props. Workspace, invitation, filtering, state, and button behavior remains unchanged.

Changes

Backend analytics removal

Layer / File(s) Summary
Workspace and invitation event removal
apps/api/plane/app/views/workspace/*, apps/api/plane/authentication/utils/workspace_project_join.py
Workspace creation, deletion, invitation, and workspace-join flows no longer dispatch analytics events.
Analytics infrastructure and configuration removal
apps/api/plane/bgtasks/event_tracking_task.py, apps/api/plane/utils/analytics_events.py, apps/api/plane/settings/common.py, apps/api/plane/license/api/views/instance.py, apps/api/requirements/base.txt, packages/types/src/instance/base.ts
The event task, event constants, PostHog settings, instance response fields, type fields, and posthog requirement are removed.

Frontend tracking removal

Layer / File(s) Summary
Session recorder removal
apps/web/app/layout.tsx, apps/web/app/root.tsx, turbo.json
Session recorder environment handling and Microsoft Clarity script injection are removed.
Tracking prop cleanup
apps/web/core/components/rich-filters/filters-row.tsx, apps/web/core/components/project-states/*, apps/web/core/components/issues/issue-layouts/roots/*
trackerElements and shouldTrackEvents props are removed from component contracts and call paths.
Tracking attribute cleanup
apps/web/app/(all)/**, apps/web/core/components/**, packages/constants/src/**
Tracker constant imports and data-ph-element attributes are removed from frontend controls. Tracker constant exports and re-exports are deleted.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to cb2f6

This change removes unused analytics code, telemetry annotations, and exposed PostHog configuration without identified in-repository behavior impact. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: removing the PostHog integration and analytics scaffold.
Description check ✅ Passed The description covers the required sections, explains the backend and frontend changes, documents test scenarios, and identifies relevant references and scope.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/remove-posthog

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

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

@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown

React Doctor found 1 new issue in 1 file · 1 warning · score 82 / 100 (Needs work) · 0 fixed · vs preview

1 warning

core/components/project-states/state-item-title.tsx

  • ⚠️ L16 Import from a barrel file no-barrel-import

Reviewed by React Doctor for commit cb2f67e. See inline comments for fixes.

Collapse JSX elements and import statements that were left multi-line
after the tracker props and specifiers were removed. Whitespace only.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HD7dTidmtWWRRiFv3nmW3s

Copilot AI 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.

Pull request overview

This PR completes the removal of PostHog analytics and related tracking scaffolding across the Plane backend and frontend. It removes both the backend event tracking task/call-sites and the remaining frontend “ph” tracking attributes/props, and updates the instance config surface area accordingly.

Changes:

  • Backend: remove PostHog Celery task + event constants, remove all track_event.delay(...) call sites, drop POSTHOG_* settings/config exposure, and remove the posthog dependency.
  • Frontend: remove the unused event-tracker constants package exports, remove data-ph-element annotations, and unwind dead prop chains (trackerElements, shouldTrackEvents).
  • Ops/build config: remove Clarity session-recorder injection and related Turbo env entries; remove PostHog keys from instance config types.

Reviewed changes

Copilot reviewed 63 out of 63 changed files in this pull request and generated no comments.

Show a summary per file
File Description
turbo.json Removes Clarity/session-recorder env passthrough entries.
packages/types/src/instance/base.ts Removes posthog_* keys from the instance config type contract.
packages/constants/src/index.ts Stops exporting the removed event-tracker module.
packages/constants/src/event-tracker/index.ts Deletes inert event-tracker export surface.
packages/constants/src/event-tracker/core.ts Deletes inert tracker constants scaffold (~500 lines).
apps/web/core/components/workspace/sidebar/quick-actions.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/workspace/sidebar/projects-list.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/workspace/sidebar/projects-list-item.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/workspace/settings/member-columns.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/workspace/delete-workspace-section.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/web-hooks/form/form.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/web-hooks/form/delete-section.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/rich-filters/filters-row.tsx Removes unused trackerElements prop plumbing and data-ph-element usage.
apps/web/core/components/project/settings/member-columns.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/project/settings/helper.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/project/settings/control-section.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/project/member-list.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/project/header.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/project-states/state-list.tsx Removes dead shouldTrackEvents prop threading.
apps/web/core/components/project-states/state-item.tsx Removes dead shouldTrackEvents prop threading.
apps/web/core/components/project-states/state-item-title.tsx Removes dead tracking prop usage/imports.
apps/web/core/components/project-states/root.tsx Stops passing shouldTrackEvents down the tree.
apps/web/core/components/project-states/options/delete.tsx Removes dead optional tracking prop from delete option.
apps/web/core/components/project-states/group-list.tsx Removes dead shouldTrackEvents prop threading.
apps/web/core/components/project-states/group-item.tsx Removes data-ph-element usage and dead tracking prop threading.
apps/web/core/components/project-states/create-update/update.tsx Removes dead shouldTrackEvents prop from update flow.
apps/web/core/components/project-states/create-update/create.tsx Removes dead optional tracking prop from create flow.
apps/web/core/components/navigation/project-actions-menu.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/modules/modules-list-view.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/modules/links/list-item.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/labels/label-block/label-item-block.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/issues/issue-layouts/roots/project-view-layout-root.tsx Removes dead trackerElements prop passing to filters row.
apps/web/core/components/issues/issue-layouts/roots/project-layout-root.tsx Removes dead trackerElements prop passing to filters row.
apps/web/core/components/issues/issue-layouts/roots/module-layout-root.tsx Removes dead trackerElements prop passing to filters row.
apps/web/core/components/issues/issue-layouts/roots/cycle-layout-root.tsx Removes dead trackerElements prop passing to filters row.
apps/web/core/components/issues/issue-layouts/roots/all-issue-layout-root.tsx Removes dead trackerElements prop passing to filters row.
apps/web/core/components/issues/issue-layouts/empty-states/cycle.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/issues/header.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/global/product-updates/footer.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/estimates/estimate-list-item-buttons.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/auth-screens/header.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/api-token/token-list-item.tsx Removes data-ph-element usage and related constants import.
apps/web/core/components/account/auth-forms/password.tsx Removes data-ph-element usage and related constants import.
apps/web/app/root.tsx Removes Clarity session-recorder script injection.
apps/web/app/layout.tsx Removes Clarity session-recorder script injection.
apps/web/app/(all)/[workspaceSlug]/(settings)/settings/projects/page.tsx Removes data-ph-element usage and related constants import.
apps/web/app/(all)/[workspaceSlug]/(projects)/workspace-views/header.tsx Removes data-ph-element usage and related constants import.
apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(list)/header.tsx Removes data-ph-element usage and related constants import.
apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/views/(detail)/[viewId]/header.tsx Removes data-ph-element usage and related constants import.
apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(list)/header.tsx Removes data-ph-element usage and related constants import.
apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/modules/(detail)/header.tsx Removes data-ph-element usage and related constants import.
apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(list)/page.tsx Removes data-ph-element usage and related constants import.
apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(list)/header.tsx Removes data-ph-element usage and related constants import.
apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/header.tsx Removes data-ph-element usage and related constants import.
apps/web/app/(all)/[workspaceSlug]/(projects)/extended-project-sidebar.tsx Removes data-ph-element usage and related constants import.
apps/api/requirements/base.txt Drops the posthog Python dependency.
apps/api/plane/utils/analytics_events.py Deletes PostHog event name constants.
apps/api/plane/settings/common.py Removes POSTHOG_API_KEY / POSTHOG_HOST settings.
apps/api/plane/license/api/views/instance.py Stops returning posthog_* values from GET /api/instances/ config.
apps/api/plane/bgtasks/event_tracking_task.py Deletes the PostHog tracking Celery task implementation.
apps/api/plane/authentication/utils/workspace_project_join.py Removes PostHog tracking call-site when joining via accepted invites.
apps/api/plane/app/views/workspace/invite.py Removes PostHog tracking call-sites for invite/join flows.
apps/api/plane/app/views/workspace/base.py Removes PostHog tracking call-sites for workspace create/delete flows.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

vihar commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Reviewed this end to end. Looks good to go from my side.

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