:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore(hogql): pin the mode in the denied join schema test (#113581)
Raúl Negrón-Oteroc0ca3fa67ee9
diff --git a/.agents/skills/writing-tests/SKILL.md b/.agents/skills/writing-tests/SKILL.mdindex b552591c5902..2823c8051bb2 100644--- a/.agents/skills/writing-tests/SKILL.md+++ b/.agents/skills/writing-tests/SKILL.md@@ -202,6 +202,11 @@ Escalating to the next rung is the last resort, not the default.- **No real network / live external services.** Mock the boundary.- **No cross-test ordering.**Tests must pass in any order and in isolation; don't rely on state a previous test left behind.+- **A test must not inherit the CI matrix mode.**+ Backend CI runs one test under several modes, such as persons-on-events on and off, and a local run uses one of them.+ If the code under test branches on a mode, set the mode in the test, with one `@parameterized` case for each mode that matters.+- **A test you added that fails in CI blocks the merge, even when the job is green.**+ Trunk can quarantine a repeated failure, and a quarantined failure does not fail the job.- **No `@skip` / `xfail` / `.skip`** without a one-line reason and a linked issue.A permanently-skipped test is dead weight — delete it or fix it.- **Never commit `.only`** (`it.only` / `describe.only`).diff --git a/posthog/hogql/printer/test/test_hogql_access_control.py b/posthog/hogql/printer/test/test_hogql_access_control.pyindex acc4d4de013a..a355e908954d 100644--- a/posthog/hogql/printer/test/test_hogql_access_control.py+++ b/posthog/hogql/printer/test/test_hogql_access_control.py@@ -5,7 +5,7 @@ from unittest.mock import Mock, patchfrom parameterized import parameterized-from posthog.schema import HogQLQuery+from posthog.schema import HogQLQuery, HogQLQueryModifiers, PersonsOnEventsModefrom posthog.hogql import astfrom posthog.hogql.context import HogQLContext@@ -960,14 +960,19 @@ class TestWarehouseAccessControlEndToEnd(BaseTest):field_name="denied_join",)+ # events.person is a lazy join only in this mode. Every other mode serializes it as a+ # field traverser, which has no nested field list.+ modifiers = HogQLQueryModifiers(personsOnEventsMode=PersonsOnEventsMode.PERSON_ID_OVERRIDE_PROPERTIES_JOINED)+def serialized_fields() -> tuple[set[str], set[str]]:- database = Database.create_for(team=self.team, user=self.user)- context = HogQLContext(team_id=self.team.pk, team=self.team, database=database, user=self.user)+ database = Database.create_for(team=self.team, user=self.user, modifiers=modifiers)+ context = HogQLContext(+ team_id=self.team.pk, team=self.team, database=database, user=self.user, modifiers=modifiers+ )serialized = database.serialize(context, include_only={"persons", "events"}, include_hidden_posthog_tables=True)persons_fields = set(serialized["persons"].fields.keys())- # events.person is itself a lazy join, so its nested field list names the persons joins.person_join_fields = set(serialized["events"].fields["person"].fields or [])return persons_fields, person_join_fields