Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web-analytics): Fix using a cohort internal test filter in web overview #29308

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

robbie-c
Copy link
Member

Problem

See https://posthoghelp.zendesk.com/agent/tickets/22891

If you have a cohort as an internal test filter, the web overview query errors, because the inner query defines person_id, but the cohort filter also tries to use person_id to mean events.person_id.

Changes

Rename the person_id to session_person_id to avoid the collision

Does this work well for both Cloud and self-hosted?

Yes

How did you test this code?

Added a previously-failing test, which passes with this fix.

@robbie-c robbie-c changed the title Fix using a cohort internal test filter in web overview fix(web-analytics): Fix using a cohort internal test filter in web overview Feb 27, 2025
@robbie-c robbie-c marked this pull request as ready for review February 27, 2025 17:21
@robbie-c robbie-c enabled auto-merge (squash) February 27, 2025 17:21
@robbie-c robbie-c force-pushed the fix/web-overview-cohort-internal-test-users branch from e52095f to 046d5a9 Compare February 27, 2025 17:22
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR fixes a naming collision in web overview queries when using cohort-based test account filters, renaming person_id to session_person_id to prevent conflicts.

  • Fixed collision between inner query's person_id and cohort filter's events.person_id by renaming to session_person_id in web_overview.py
  • Added new test case test_filter_cohort that verifies cohort-based test account filtering works correctly
  • The bug was causing web overview queries to fail when cohorts were used as internal test filters
  • The fix ensures proper distinction between session person IDs and event person IDs in query construction
  • Solution maintains compatibility with existing functionality while resolving the specific naming conflict

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

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.

1 participant