fix(revenue-analytics): Groups materialized view joins#53119
Merged
arthurdedeus merged 5 commits intomasterfrom Apr 7, 2026
Merged
fix(revenue-analytics): Groups materialized view joins#53119arthurdedeus merged 5 commits intomasterfrom
arthurdedeus merged 5 commits intomasterfrom
Conversation
Contributor
Author
Contributor
Prompt To Fix All With AIThis is a comment left during a code review.
Path: posthog/hogql/database/schema/test/test_groups_revenue_analytics.py
Line: 466-469
Comment:
**Redundant `setUp` causes mock leak**
`RevenueAnalyticsManagedViewsetsTestMixin.setUp` already patches `posthoganalytics.feature_enabled` and assigns it to `self.mock_flag`. When `TestGroupsRevenueAnalyticsManagedViewsets.setUp` calls `super().setUp()` first, the mixin's patch is started and `self.mock_flag` is set. Then this method immediately overwrites `self.mock_flag` with a second patch and starts it too.
The result is two active patches for `posthoganalytics.feature_enabled`, but `tearDown` (inherited from the mixin) only calls `self.mock_flag.stop()` once — stopping only the second patch. The first patch leaks, potentially affecting subsequent tests.
The `setUp` override here is already handled by the mixin via `super().setUp()`, so it should be removed entirely. Compare with `TestPersonsRevenueAnalyticsManagedViewsets`, which correctly relies on the mixin's `setUp` without overriding it.
```suggestion
class TestGroupsRevenueAnalyticsManagedViewsets(
TestGroupsRevenueAnalyticsMixin, RevenueAnalyticsManagedViewsetsTestMixin
):
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix: Support materialized views in group..." | Re-trigger Greptile |
posthog/hogql/database/schema/test/test_groups_revenue_analytics.py
Outdated
Show resolved
Hide resolved
ae3bf47 to
a54fef3
Compare
rafaeelaudibert
approved these changes
Apr 2, 2026
georgemunyoro
approved these changes
Apr 7, 2026
Contributor
|
🎭 Playwright report · View test results →
These issues are not necessarily caused by your changes. |
MattBro
pushed a commit
that referenced
this pull request
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
Same as #52929, but for groups.
Part of #52270
Changes
Reuse test setup and util functions to fix the bug for groups.
How did you test this code?
Unit tests
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Publish to changelog?
no
Docs update
no