Skip to content

feat(desktop): name the cohorts a cohort's criteria reference - #95640

Merged
trunk-io[bot] merged 2 commits into
posthog/desktop-survey-who-sees-thisfrom
posthog/desktop-cohort-criteria-names
Sep 7, 2026
Merged

feat(desktop): name the cohorts a cohort's criteria reference#95640
trunk-io[bot] merged 2 commits into
posthog/desktop-survey-who-sees-thisfrom
posthog/desktop-cohort-criteria-names

Conversation

@puemos

@puemos puemos commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Problem

On the desktop app's cohort page, membership criteria that reference another cohort show its numeric id, for example "Is in cohort 42". A person cannot tell which cohort that is without opening PostHog.

Changes

  • Membership criteria now name the referenced cohort: "Is in cohort Power users".
  • The cohort page fetches each referenced cohort, capped at ten. A failed lookup keeps the id in place, so the criteria still render.
  • Mechanical: cohortCriteriaSection and shapeCohortPreview take a name map, and a new referencedCohortIds helper walks the criteria.

Before, the same criteria read "Is in cohort 42 and ..." and "Is not in cohort 57 and ...".

cohort-page

How did you test this code?

  • The existing negated-criteria test now uses cohort ids with a name map and one unresolved id. It catches a regression where a referenced cohort renders as its id, or an unresolved id renders as empty.
  • The screenshot above comes from a new Storybook story with invented fixture data.
  • Not run: the app against a live backend.

Automatic notifications

  • Publish to changelog?

Docs update

None.

🤖 Agent context

Built in a PostHog Desktop task as the top layer of a stack on #93987. Kept to name resolution; the cohort criteria were already prose. Skills invoked: stacking-prs, writing-tests, writing-pr-descriptions.


Created with PostHog Desktop

Membership criteria read "Is in cohort Power users" instead of "Is in cohort 42". The cohort page fetches the referenced cohorts, capped at ten, and a failed lookup leaves the id in place.

Generated-By: PostHog Desktop
Task-Id: ceed37c8-d844-4534-ae64-976efe7c87f0
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 29484df.

@github-actions github-actions Bot added the feature/desktop Feature Tag: Desktop label Sep 5, 2026
@github-actions

github-actions Bot commented Sep 5, 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.

Generated-By: PostHog Desktop
Task-Id: ceed37c8-d844-4534-ae64-976efe7c87f0
@puemos
puemos marked this pull request as ready for review September 6, 2026 06:16
@pr-assigner-resolver-posthog
pr-assigner-resolver-posthog Bot requested a review from a team September 6, 2026 06:18
@puemos

puemos commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

/trunk merge

@trunk-io

trunk-io Bot commented Sep 7, 2026

Copy link
Copy Markdown

😎 Stack merged successfully - details.

@trunk-io
trunk-io Bot merged commit 31b8040 into master Sep 7, 2026
299 checks passed
@trunk-io
trunk-io Bot deleted the posthog/desktop-cohort-criteria-names branch September 7, 2026 07:17
@deployment-status-posthog

deployment-status-posthog Bot commented Sep 7, 2026

Copy link
Copy Markdown

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-09-07 07:32 UTC Run
prod-us ✅ Deployed 2026-09-07 07:43 UTC Run
prod-eu ✅ Deployed 2026-09-07 07:47 UTC Run

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

Labels

feature/desktop Feature Tag: Desktop

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants