Skip to content

fix(personhog_client): person team mismatch metric overcounting#52450

Merged
nickbest-ph merged 1 commit intomasterfrom
nick/person-mismatch-drops
Mar 26, 2026
Merged

fix(personhog_client): person team mismatch metric overcounting#52450
nickbest-ph merged 1 commit intomasterfrom
nick/person-mismatch-drops

Conversation

@nickbest-ph
Copy link
Copy Markdown
Contributor

Problem

The person team mismatch metric being emitted by personhog client lookups was overcounting. It inadvertently counted any distinct id that no longer has a matching person as a person team mismatch.

Changes

  • first filter returned persons lists by team mismatch, store the list then filter that list on whether the person record exists/has an id
  • use the two arrays to calculate the true number of persons filtered due to a team mismatch

How did you test this code?

  • there are plenty of unit/integration tests making sure this didn't change any behaviour

@assign-reviewers-posthog assign-reviewers-posthog Bot requested a review from a team March 26, 2026 16:26
@nickbest-ph nickbest-ph removed the request for review from a team March 26, 2026 16:27
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 26, 2026

Important Files Changed

Filename Overview
posthog/models/person/util.py Three metric-counting sites updated to separate 'person not found' cases from true team-mismatch cases. Correct and consistent across all three locations.
posthog/queries/actor_base_query.py One additional metric-counting site updated with the same fix, keeping _fetch_people_via_personhog consistent with the util.py changes.

Reviews (1): Last reviewed commit: "fix(personhog_client): person team misma..." | Re-trigger Greptile

@github-actions
Copy link
Copy Markdown
Contributor

🎭 Playwright report · View test results →

⚠️ 2 flaky tests:

  • Redirect to appropriate place after login with complex URL (chromium)
  • Deleting a dashboard navigates to the dashboards list (chromium)

These issues are not necessarily caused by your changes.
Annoyed by this comment? Help fix flakies and failures and it'll disappear!

@nickbest-ph nickbest-ph merged commit fba0014 into master Mar 26, 2026
200 checks passed
@nickbest-ph nickbest-ph deleted the nick/person-mismatch-drops branch March 26, 2026 17:09
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.

2 participants