Feature request(Cohorts): Edit history for cohorts
Feature request
Is your feature request related to a problem?
There currently isn't a way to track changes made to cohorts.
Additional context in Zendesk linked below.
Describe the solution you'd like
Add the ability to track and display edit history for cohorts.
Describe alternatives you've considered
Additional context
From : https://posthoghelp.zendesk.com/agent/tickets/26873 (moved to PostHog: https://us.posthog.com/project/2/support/tickets/28882)
Debug info
- [ ] PostHog Cloud, Debug information: [please copy/paste from https://us.posthog.com/settings/project-details#variables]
- [ ] PostHog Hobby self-hosted with `docker compose`, version/commit: [please provide]
- [ ] PostHog self-hosted with Kubernetes (deprecated, see [`Sunsetting Kubernetes support`](https://posthog.com/blog/sunsetting-helm-support-posthog)), version/commit: [please provide]
I think this one can be closed. #57702 shipped cohort edit history in May and listed this issue as closed by it, but the auto-close didn't fire.
What I checked on current master (587f4d0):
-
Saved cohorts have a History tab that renders the activity log for the cohort (
frontend/src/scenes/cohorts/CohortEdit.tsx:585). -
Every create or edit through the Cohorts UI, the
/cohortsAPI or the MCP cohort tools logs an entry for the cohort you acted on:- create, update (with a field diff), delete and restore, through
perform_createandperform_updateinposthog/api/cohort.py; - manual person additions and removals on static cohorts;
- the realtime toggle.
The MCP tools call the same endpoints. Turning realtime on also turns it on for included cohorts, but only the cohort you acted on gets an entry.
- create, update (with a field diff), delete and restore, through
-
Tests assert the entries for create, update, delete and restore, manual removal and the realtime toggle, and breaking any of those paths turns a test red (CI run). The manual addition entry isn't covered by a test.
-
The describer in
frontend/src/scenes/cohorts/activityDescriptions.tsxrenders all of those activities, and later commits only extended it.
One thing History doesn't cover yet: some Workflows paths (a workflow step adding a person, a Workflows people upload, or a provider contact import replacing members). Those go through the Workflows product rather than the Cohorts editor or the /cohorts API, so I don't think they need to keep this issue open, but I'm happy to open a separate one if you'd like them in History.
PostHog self-driving picked up this issue. Status: Research is done.
Somebody may already be working on it, so ask before you start a fix.
Report (team access only): https://us.posthog.com/project/2/inbox/reports/01a20cd8-10a4-7781-ab41-55f7322d1a94?link_source=github_comment