fix(revenue-analytics): Use correct field name in persons join#53594
fix(revenue-analytics): Use correct field name in persons join#53594arthurdedeus merged 3 commits intomasterfrom
Conversation
| joining_table_name="persons", | ||
| joining_table_key="pdi.distinct_id", | ||
| field_name="person", | ||
| field_name="persons", |
There was a problem hiding this comment.
this is the fix
There was a problem hiding this comment.
this file will only make sense when the whole stack is merged, as the distinct id resolution is coming in the next PR
|
🎭 Playwright report · View test results →
These issues are not necessarily caused by your changes. |
Prompt To Fix All With AIThis is a comment left during a code review.
Path: posthog/hogql/database/schema/test/base.py
Line: 77
Comment:
**Removed explanatory comment not made obsolete by the change**
Per the project coding conventions: *"when refactoring or moving code, preserve existing comments unless they are explicitly made obsolete by the change."* The rename of `source` → `self.source` does not invalidate this comment — it still explains *why* the `ExternalDataSchema` objects are created here (required by `RevenueAnalyticsBaseView` to discover the right tables). Please restore it:
```suggestion
# Besides the default creations above, also create the external data schema
# because this is required by the `RevenueAnalyticsBaseView` to find the right tables
_invoices_schema = ExternalDataSchema.objects.create(
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(revenue-analytics): Use correct fiel..." | Re-trigger Greptile |
| credential=credential, | ||
| ) | ||
|
|
||
| _invoices_schema = ExternalDataSchema.objects.create( |
There was a problem hiding this comment.
Removed explanatory comment not made obsolete by the change
Per the project coding conventions: "when refactoring or moving code, preserve existing comments unless they are explicitly made obsolete by the change." The rename of source → self.source does not invalidate this comment — it still explains why the ExternalDataSchema objects are created here (required by RevenueAnalyticsBaseView to discover the right tables). Please restore it:
| _invoices_schema = ExternalDataSchema.objects.create( | |
| # Besides the default creations above, also create the external data schema | |
| # because this is required by the `RevenueAnalyticsBaseView` to find the right tables | |
| _invoices_schema = ExternalDataSchema.objects.create( |
Prompt To Fix With AI
This is a comment left during a code review.
Path: posthog/hogql/database/schema/test/base.py
Line: 77
Comment:
**Removed explanatory comment not made obsolete by the change**
Per the project coding conventions: *"when refactoring or moving code, preserve existing comments unless they are explicitly made obsolete by the change."* The rename of `source` → `self.source` does not invalidate this comment — it still explains *why* the `ExternalDataSchema` objects are created here (required by `RevenueAnalyticsBaseView` to discover the right tables). Please restore it:
```suggestion
# Besides the default creations above, also create the external data schema
# because this is required by the `RevenueAnalyticsBaseView` to find the right tables
_invoices_schema = ExternalDataSchema.objects.create(
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
fc3a1c3 to
ee07485
Compare
Changed field_name from 'person' to 'persons' in the revenue view join created by database_operations. Added an integration test that queries through the join to verify HogQL can resolve the persons field — would have caught this bug. Enriched test CSV data with posthog_person_distinct_id on specific customers, subscriptions, and charges to support resolution testing.
ee07485 to
c457be8
Compare
Generated-By: PostHog Code Task-Id: fd85cf73-4dda-49fc-8659-b8d912148191

Problem
The revenue view join used
field_name="person"instead of"persons", silently breaking the person-to-revenue link. Existingtests passed because they asserted the wrong value or bypassed
database_operationsentirely.Part of #52270
Changes
field_nameto"persons"insource_templates.pyand the corresponding test assertionpersons.propertiesthrough the customer revenue view after callingdatabase_operations()— fails with "Unable to resolve field" if the name is wrongposthog_person_distinct_idon specific customers, subscriptions, and charges to support personresolution testing
How did you test this code?
New integration test for persons join resolution and existing test suite passes.
Publish to changelog?
No
Docs update
No
LLM context
Co-authored with Claude Code (Opus 4.6).