: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: remove hogql-access-control flag (#64312)
Alex Liderb80745964400
diff --git a/ee/hogai/tools/execute_sql/test/test_mcp_tool.py b/ee/hogai/tools/execute_sql/test/test_mcp_tool.pyindex 4cf641a7cb47..86643711ecc6 100644--- a/ee/hogai/tools/execute_sql/test/test_mcp_tool.py+++ b/ee/hogai/tools/execute_sql/test/test_mcp_tool.py@@ -1,5 +1,5 @@from posthog.test.base import ClickhouseTestMixin, NonAtomicBaseTest, _create_event-from unittest.mock import AsyncMock, Mock, patch+from unittest.mock import AsyncMock, patchfrom asgiref.sync import sync_to_async@@ -56,7 +56,6 @@ class TestExecuteSQLMCPTool(ClickhouseTestMixin, NonAtomicBaseTest):validated = self.tool.args_schema.model_validate({"query": "SELECT 1"})self.assertEqual(validated.query, "SELECT 1")- @patch("posthoganalytics.feature_enabled", new=Mock(return_value=True))async def test_select_from_system_insights(self):await sync_to_async(Insight.objects.create)(team=self.team,diff --git a/ee/hogai/tools/execute_sql/test/test_tool.py b/ee/hogai/tools/execute_sql/test/test_tool.pyindex ac1ef2967510..b3735ad31c28 100644--- a/ee/hogai/tools/execute_sql/test/test_tool.py+++ b/ee/hogai/tools/execute_sql/test/test_tool.py@@ -1,5 +1,5 @@from posthog.test.base import ClickhouseTestMixin, NonAtomicBaseTest, _create_event, flush_persons_and_events-from unittest.mock import AsyncMock, Mock, patch+from unittest.mock import AsyncMock, patchfrom asgiref.sync import sync_to_asyncfrom langchain_core.runnables import RunnableConfig@@ -199,7 +199,6 @@ class TestExecuteSQLTool(ClickhouseTestMixin, NonAtomicBaseTest):self.assertEqual(payload["query"], "SELECT count() FROM events WHERE {filters}")self.assertEqual(payload["filters"], {})- @patch("posthoganalytics.feature_enabled", new=Mock(return_value=True))async def test_select_from_system_insights(self):await sync_to_async(Insight.objects.create)(team=self.team,diff --git a/posthog/hogql/database/database.py b/posthog/hogql/database/database.pyindex a35c90444120..589458555a7d 100644--- a/posthog/hogql/database/database.py+++ b/posthog/hogql/database/database.py@@ -197,7 +197,6 @@ class HogQLDatabaseSources:connection_id: str | Nonemodifiers: "HogQLQueryModifiers"is_managed_viewset_enabled: bool- is_hogql_access_control_enabled: booldirect_connection_metadata: dict[str, Any] | None# Access-control decision, computed from a warmed UserAccessControl so build does no AC queries.user_access_control: Optional["UserAccessControl"]@@ -993,7 +992,7 @@ class Database(BaseModel):team_id,team=team,user=user,- preloaded_user_access_control=user_access_control,+ user_access_control=user_access_control,modifiers=modifiers,timings=timings,connection_id=connection_id,@@ -1006,7 +1005,7 @@ class Database(BaseModel):*,team: Optional["Team"] = None,user: Optional["User | SyntheticUser"] = None,- preloaded_user_access_control: Optional["UserAccessControl"] = None,+ user_access_control: Optional["UserAccessControl"] = None,modifiers: "HogQLQueryModifiers | None" = None,timings: HogQLTimings | None = None,connection_id: str | None = None,@@ -1076,24 +1075,11 @@ class Database(BaseModel):direct_connection_metadata = direct_source.connection_metadatawith timings.measure("filter_system_tables_for_user", emit_span=True):- is_hogql_access_control_enabled = posthoganalytics.feature_enabled(- "hogql-access-control",- str(team.uuid),- groups={"organization": str(team.organization_id), "project": str(team.id)},- group_properties={- "organization": {"id": str(team.organization_id)},- "project": {"id": str(team.id)},- },- send_feature_flag_events=False,+ # Pass the caller's user_access_control through: when already preloaded it's reused, so the+ # bulk access-control fetch happens once per run instead of once per database build.+ user_access_control, denied_system_table_names = _compute_system_table_access_decision(+ team, user, user_access_control)- user_access_control: Optional[UserAccessControl] = None- denied_system_table_names: set[str] = set()- if is_hogql_access_control_enabled:- # Reuse the caller's preloaded user_access_control when given,- # so the bulk access-control fetch happens once per run- user_access_control, denied_system_table_names = _compute_system_table_access_decision(- team, user, preloaded_user_access_control- )with timings.measure("modifiers", emit_span=True):modifiers = create_default_modifiers_for_team(team, modifiers)@@ -1219,7 +1205,6 @@ class Database(BaseModel):connection_id=connection_id,modifiers=modifiers,is_managed_viewset_enabled=is_managed_viewset_enabled,- is_hogql_access_control_enabled=is_hogql_access_control_enabled,direct_connection_metadata=direct_connection_metadata,user_access_control=user_access_control,denied_system_table_names=denied_system_table_names,diff --git a/posthog/hogql/database/schema/test/test_system_tables.py b/posthog/hogql/database/schema/test/test_system_tables.pyindex 072ba5e877d0..937fedc40860 100644--- a/posthog/hogql/database/schema/test/test_system_tables.py+++ b/posthog/hogql/database/schema/test/test_system_tables.py@@ -68,7 +68,7 @@ class TestSystemTablesTeamScoping(BaseTest):@parameterized.expand(ALL_SYSTEM_TABLE_NAMES)def test_system_table_has_team_id_filter(self, table_name):- db = Database.create_for(team=self.team)+ db = Database.create_for(team=self.team, user=self.user)context = HogQLContext(team_id=self.team.pk,enable_select_queries=True,@@ -652,7 +652,7 @@ class TestSystemTablesTeamIsolation(NonAtomicBaseTest):obj_team1 = factory(self.team, "team1")obj_team2 = factory(self.other_team, "team2")- response = execute_hogql_query(f"SELECT id FROM system.{table_name}", team=self.team)+ response = execute_hogql_query(f"SELECT id FROM system.{table_name}", team=self.team, user=self.user)ids = {str(row[0]) for row in response.results}assert str(obj_team1.pk) in ids@@ -664,7 +664,7 @@ class TestSystemTablesSandboxEnvironmentPrivacy(BaseTest):mirroring the REST API's per-creator visibility filter and internal-use exclusion."""def test_generated_sql_includes_private_predicate(self):- db = Database.create_for(team=self.team)+ db = Database.create_for(team=self.team, user=self.user)context = HogQLContext(team_id=self.team.pk, enable_select_queries=True, database=db)query, _ = prepare_and_print_ast(parse_select("SELECT id FROM system.sandbox_environments"), context, dialect="clickhouse"@@ -686,7 +686,7 @@ class TestSystemTablesSandboxEnvironmentPrivacyIsolation(NonAtomicBaseTest):public_env = SandboxEnvironment.objects.create(team=self.team, name="public_env", private=False)private_env = SandboxEnvironment.objects.create(team=self.team, name="private_env", private=True)- response = execute_hogql_query("SELECT id FROM system.sandbox_environments", team=self.team)+ response = execute_hogql_query("SELECT id FROM system.sandbox_environments", team=self.team, user=self.user)ids = {str(row[0]) for row in response.results}assert str(public_env.pk) in ids@@ -702,7 +702,7 @@ class TestSystemTablesSandboxEnvironmentPrivacyIsolation(NonAtomicBaseTest):team=self.team, name="internal_env", private=False, internal=True)- response = execute_hogql_query("SELECT id FROM system.sandbox_environments", team=self.team)+ response = execute_hogql_query("SELECT id FROM system.sandbox_environments", team=self.team, user=self.user)ids = {str(row[0]) for row in response.results}assert str(regular_env.pk) in ids@@ -714,7 +714,7 @@ class TestSystemTablesTaskInternalExclusion(BaseTest):mirroring the REST API's default filter."""def test_generated_sql_includes_internal_predicate(self):- db = Database.create_for(team=self.team)+ db = Database.create_for(team=self.team, user=self.user)context = HogQLContext(team_id=self.team.pk, enable_select_queries=True, database=db)query, _ = prepare_and_print_ast(parse_select("SELECT id FROM system.tasks"), context, dialect="clickhouse")assert "system__tasks.internal" in query@@ -744,7 +744,7 @@ class TestSystemTablesTaskInternalExclusionIsolation(NonAtomicBaseTest):internal=True,)- response = execute_hogql_query("SELECT id FROM system.tasks", team=self.team)+ response = execute_hogql_query("SELECT id FROM system.tasks", team=self.team, user=self.user)ids = {str(row[0]) for row in response.results}assert str(regular_task.pk) in ids@@ -773,6 +773,7 @@ class TestSystemAccountsLazyJoins(NonAtomicBaseTest):response = execute_hogql_query("SELECT id, accounts.tags.names FROM system.accounts AS accounts ORDER BY name",team=self.team,+ user=self.user,)rows_by_id = {str(row[0]): row[1] for row in response.results}@@ -786,6 +787,7 @@ class TestSystemAccountsLazyJoins(NonAtomicBaseTest):response = execute_hogql_query("SELECT id, accounts.tags.names FROM system.accounts AS accounts",team=self.team,+ user=self.user,)assert response.results == []@@ -799,6 +801,7 @@ class TestSystemAccountsLazyJoins(NonAtomicBaseTest):response = execute_hogql_query("SELECT id, accounts.notebooks.count FROM system.accounts AS accounts ORDER BY name",team=self.team,+ user=self.user,)rows_by_id = {str(row[0]): row[1] for row in response.results}diff --git a/posthog/hogql/database/test/test_database.py b/posthog/hogql/database/test/test_database.pyindex d6b2e6d9fc74..833f887f6cfa 100644--- a/posthog/hogql/database/test/test_database.py+++ b/posthog/hogql/database/test/test_database.py@@ -182,7 +182,7 @@ class TestDatabase(BaseTest, QueryMatchingTest):@pytest.mark.usefixtures("unittest_snapshot")def test_serialize_database_no_person_on_events(self):with override_settings(PERSON_ON_EVENTS_V2_OVERRIDE=False):- database = Database.create_for(team=self.team)+ database = Database.create_for(team=self.team, user=self.user)serialized_database = database.serialize(HogQLContext(team_id=self.team.pk, database=database))assert (@@ -195,7 +195,7 @@ class TestDatabase(BaseTest, QueryMatchingTest):@pytest.mark.usefixtures("unittest_snapshot")def test_serialize_database_with_person_on_events_enabled(self):with override_settings(PERSON_ON_EVENTS_OVERRIDE=True):- database = Database.create_for(team=self.team)+ database = Database.create_for(team=self.team, user=self.user)serialized_database = database.serialize(HogQLContext(team_id=self.team.pk, database=database))assert (@@ -944,7 +944,7 @@ class TestDatabase(BaseTest, QueryMatchingTest):field_name="my_join_field",)- db = Database.create_for(team=self.team)+ db = Database.create_for(team=self.team, user=self.user)context = HogQLContext(team_id=self.team.pk, database=db)serialized = db.serialize(context, include_only={"system.accounts"})@@ -2993,10 +2993,9 @@ class TestDatabase(BaseTest, QueryMatchingTest):captured["result"] = resultreturn result- with (- patch("posthoganalytics.feature_enabled", return_value=True),- patch("posthog.hogql.database.database._compute_system_table_access_decision", side_effect=spy) as decision,- ):+ with patch(+ "posthog.hogql.database.database._compute_system_table_access_decision", side_effect=spy+ ) as decision:Database.create_for(team=self.team, user=synthetic_user)decision.assert_called_once()@@ -3016,10 +3015,9 @@ class TestDatabase(BaseTest, QueryMatchingTest):captured["result"] = resultreturn result- with (- patch("posthoganalytics.feature_enabled", return_value=True),- patch("posthog.hogql.database.database._compute_system_table_access_decision", side_effect=spy) as decision,- ):+ with patch(+ "posthog.hogql.database.database._compute_system_table_access_decision", side_effect=spy+ ) as decision:Database.create_for(team=self.team, user=self.user)decision.assert_called_once()diff --git a/posthog/hogql/printer/test/test_hogql_access_control.py b/posthog/hogql/printer/test/test_hogql_access_control.pyindex 1f9a3432a496..e9ad98cf26ac 100644--- a/posthog/hogql/printer/test/test_hogql_access_control.py+++ b/posthog/hogql/printer/test/test_hogql_access_control.py@@ -1,5 +1,4 @@from posthog.test.base import BaseTest-from unittest.mock import Mock, patchfrom posthog.hogql.context import HogQLContextfrom posthog.hogql.database.database import Database@@ -12,7 +11,6 @@ from posthog.models import OrganizationMembershipclass TestAccessControlSystemTables(BaseTest):"""Test resource-level access control for system tables."""- @patch("posthoganalytics.feature_enabled", new=Mock(return_value=True))def test_org_admin_gets_all_system_tables(self):"""Org admins should have access to all system tables."""membership = OrganizationMembership.objects.get(user=self.user, organization=self.organization)@@ -27,7 +25,6 @@ class TestAccessControlSystemTables(BaseTest):for table_name in fresh_system.children:assert table_name in system_node.children, f"{table_name} missing for admin"- @patch("posthoganalytics.feature_enabled", new=Mock(return_value=True))def test_regular_user_with_full_access_gets_all_tables(self):"""Regular users with default full access should see all tables."""# Default setup - user has no restrictions@@ -41,7 +38,6 @@ class TestAccessControlSystemTables(BaseTest):system_node = database.tables.children.get("system")assert system_node is not None- @patch("posthoganalytics.feature_enabled", new=Mock(return_value=True))def test_database_without_user_denies_scoped_tables(self):"""Without user context, scoped tables should be removed and denied (fail-closed)."""database = Database.create_for(team=self.team, user=None)@@ -81,7 +77,6 @@ class TestAccessControlSystemTables(BaseTest):assert "teams" in system_node.children-@patch("posthoganalytics.feature_enabled", new=Mock(return_value=True))class TestDeniedTableError(BaseTest):"""Test that denied tables show a helpful error message."""@@ -146,7 +141,6 @@ class TestAccessControlIntegration(BaseTest):assert prepared is not Nonereturn print_prepared_ast(prepared, context=context, dialect="clickhouse")- @patch("posthoganalytics.feature_enabled", new=Mock(return_value=True))def test_admin_can_query_system_dashboards(self):"""Admin users should be able to query system.dashboards without restrictions."""membership = OrganizationMembership.objects.get(user=self.user, organization=self.organization)@@ -166,7 +160,6 @@ class TestAccessControlIntegration(BaseTest):assert "id" in sqlassert "name" in sql- @patch("posthoganalytics.feature_enabled", new=Mock(return_value=True))def test_query_without_user_fails_on_scoped_table(self):"""Querying a scoped system table without user should fail with access error."""from posthog.hogql.errors import QueryError@@ -182,19 +175,6 @@ class TestAccessControlIntegration(BaseTest):self._compile_select("SELECT id, name FROM system.dashboards", context)assert "don't have access" in str(cm.exception)- @patch("posthoganalytics.feature_enabled", new=Mock(return_value=False))- def test_database_without_user_keeps_all_tables_when_flag_off(self):- """When the feature flag is off, no tables are denied even without user."""- database = Database.create_for(team=self.team, user=None)- assert len(database._denied_tables) == 0- # Verify against a fresh SystemTables instance to avoid shared-state issues- fresh_system = SystemTables()- system_node = database.tables.children.get("system")- assert system_node is not None- for table_name in fresh_system.children:- assert table_name in system_node.children, f"{table_name} missing from system tables when flag is off"-- @patch("posthoganalytics.feature_enabled", new=Mock(return_value=True))def test_query_without_user_works_for_unscoped_tables(self):"""Unscoped system tables should still be queryable without user context."""context = HogQLContext(diff --git a/posthog/hogql_queries/test/test_query_runner.py b/posthog/hogql_queries/test/test_query_runner.pyindex 4f636bb55ba5..493fe3cc92e9 100644--- a/posthog/hogql_queries/test/test_query_runner.py+++ b/posthog/hogql_queries/test/test_query_runner.py@@ -1244,16 +1244,8 @@ class TestQueryRunnerAccessControlFingerprint(BaseTest):# Object/resource AC only applies to non-admins.self.organization_membership.level = OrganizationMembership.Level.MEMBERself.organization_membership.save()- # create_for only preloads database.user_access_control under this flag, which the ctx- # runner's fingerprint reads; enable it so partitioning is exercised on the ctx path.- self._ff_patcher = mock.patch(- "posthog.hogql.database.database.posthoganalytics.feature_enabled",- side_effect=lambda flag, *args, **kwargs: flag == "hogql-access-control",- )- self._ff_patcher.start()def tearDown(self):- self._ff_patcher.stop()super().tearDown()cache.clear()@@ -1515,7 +1507,6 @@ class TestQueryRunnerAccessControlFingerprint(BaseTest):self._ac(resource="notebook", access_level="none")with (- mock.patch("posthog.hogql.database.database.posthoganalytics.feature_enabled", return_value=True),restriction_cache_scope(),CaptureQueriesContext(connection) as ctx,):@@ -1547,10 +1538,7 @@ class TestQueryRunnerAccessControlFingerprint(BaseTest):# Warm the snapshot - the single bulk fetch the fingerprint already paid for._ = user_access_control.blocked_resources- with (- mock.patch("posthog.hogql.database.database.posthoganalytics.feature_enabled", return_value=True),- CaptureQueriesContext(connection) as ctx,- ):+ with CaptureQueriesContext(connection) as ctx:database = Database.create_for(team=self.team, user=self.user, user_access_control=user_access_control)# Same object reused, table still denied, and no second ee_accesscontrol fetch.diff --git a/products/customer_analytics/backend/hogql_queries/test/test_accounts_query_runner.py b/products/customer_analytics/backend/hogql_queries/test/test_accounts_query_runner.pyindex a974349d6aab..737e60b1b2bc 100644--- a/products/customer_analytics/backend/hogql_queries/test/test_accounts_query_runner.py+++ b/products/customer_analytics/backend/hogql_queries/test/test_accounts_query_runner.py@@ -28,7 +28,9 @@ except ImportError:@override_settings(IN_UNIT_TESTING=True)class TestAccountsQueryRunner(ClickhouseTestMixin, NonAtomicBaseTest):def _run_query(self, user: User | None = None, **query_kwargs) -> tuple[AccountsQueryRunner, AccountsQueryResponse]:- runner = AccountsQueryRunner(query=AccountsQuery(**query_kwargs), team=self.team, user=user)+ runner = AccountsQueryRunner(+ query=AccountsQuery(**query_kwargs), team=self.team, user=user if user is not None else self.user+ )return runner, runner.calculate()def _ids(self, user: User | None = None, **query_kwargs) -> list[str]:@@ -217,10 +219,11 @@ class TestAccountsQueryRunner(ClickhouseTestMixin, NonAtomicBaseTest):# resolves to the same accounts no matter which user opens it.target = create_account(team_id=self.team.id, name="Target", _properties={"csm": {"id": 7, "email": "[email protected]"}})create_account(team_id=self.team.id, name="Other", _properties={"csm": {"id": 8, "email": "[email protected]"}})+ other_user = self._create_user("[email protected]")as_user = self._ids(user=self.user, assignedToUserIds=[7])- anonymous = self._ids(user=None, assignedToUserIds=[7])+ as_other_user = self._ids(user=other_user, assignedToUserIds=[7])self.assertEqual(as_user, [str(target.id)])- self.assertEqual(as_user, anonymous)+ self.assertEqual(as_user, as_other_user)def test_assigned_to_user_unknown_id_matches_nothing(self):create_account(team_id=self.team.id, name="Has CSM", _properties={"csm": {"id": 7, "email": "[email protected]"}})@@ -297,6 +300,7 @@ class TestAccountsQueryRunner(ClickhouseTestMixin, NonAtomicBaseTest):orderBy=["notebook_count", "name"],),team=self.team,+ user=self.user,)response = runner.calculate()id_idx = runner.columns.index("id")@@ -320,6 +324,7 @@ class TestAccountsQueryRunner(ClickhouseTestMixin, NonAtomicBaseTest):orderBy=["notebook_count DESC", "name"],),team=self.team,+ user=self.user,)response = runner.calculate()id_idx = runner.columns.index("id")@@ -353,6 +358,7 @@ class TestAccountsQueryRunner(ClickhouseTestMixin, NonAtomicBaseTest):orderBy=[f"tupleElement({role_key}, 2)"],),team=self.team,+ user=self.user,)response = runner.calculate()id_idx = runner.columns.index("id")@@ -381,6 +387,7 @@ class TestAccountsQueryRunner(ClickhouseTestMixin, NonAtomicBaseTest):orderBy=[f"tupleElement({role_key}, 2) DESC"],),team=self.team,+ user=self.user,)response = runner.calculate()id_idx = runner.columns.index("id")@@ -431,7 +438,7 @@ class TestAccountsQueryRunner(ClickhouseTestMixin, NonAtomicBaseTest):def test_custom_select_uses_only_requested_columns(self):create_account(team_id=self.team.id, name="A")- runner = AccountsQueryRunner(query=AccountsQuery(select=["id", "name"]), team=self.team)+ runner = AccountsQueryRunner(query=AccountsQuery(select=["id", "name"]), team=self.team, user=self.user)response = runner.calculate()self.assertEqual(runner.columns, ["id", "name"])self.assertEqual(len(response.results[0]), 2)@@ -536,6 +543,7 @@ class TestAccountsQueryRunner(ClickhouseTestMixin, NonAtomicBaseTest):orderBy=["notebook_count DESC"],),team=self.team,+ user=self.user,)self.assertEqual(runner._deferred_columns, [])self.assertIn("notebook_count", runner._main_column_names)diff --git a/products/data_warehouse/backend/test/__snapshots__/test_hogql_fixer_ai.ambr b/products/data_warehouse/backend/test/__snapshots__/test_hogql_fixer_ai.ambrindex f52f411cb6a9..b0e6b8f56972 100644--- a/products/data_warehouse/backend/test/__snapshots__/test_hogql_fixer_ai.ambr+++ b/products/data_warehouse/backend/test/__snapshots__/test_hogql_fixer_ai.ambr@@ -110,7 +110,7 @@This is a list of all the available tables in the database:```- ['events', 'groups', 'persons', 'sessions', 'logs', 'query_log', 'system.accounts', 'system.activity_logs', 'system.actions', 'system.alerts', 'system.annotations', 'system.batch_export_backfills', 'system.batch_exports', 'system.business_knowledge_chunks', 'system.business_knowledge_documents', 'system.business_knowledge_sources', 'system.cohort_calculation_history', 'system.cohorts', 'system.dashboards', 'system.dashboard_tiles', 'system.data_modeling_jobs', 'system.data_modeling_views', 'system.data_modeling_endpoint_versions', 'system.data_modeling_endpoints', 'system.data_warehouse_sources', 'system.data_warehouse_tables', 'system.error_tracking_assignment_rules', 'system.error_tracking_issue_assignments', 'system.error_tracking_issue_fingerprints', 'system.error_tracking_issues', 'system.error_tracking_releases', 'system.error_tracking_symbol_sets', 'system.error_tracking_suppression_rules', 'system.early_access_features', 'system.experiments', 'system.exports', 'system.feature_flags', 'system.groups', 'system.group_type_mappings', 'system.hog_flows', 'system.hog_functions', 'system.ingestion_warnings', 'system.integrations', 'system.integration_repository_cache', 'system.insight_variables', 'system.logs_alerts', 'system.logs_views', 'system.insights', 'system.notebooks', 'system.sandbox_environments', 'system.review_queue_items', 'system.review_queues', 'system.score_definitions', 'system.session_recording_playlists', 'system.session_recordings', 'system.source_schemas', 'system.source_sync_jobs', 'system.support_tickets', 'system.surveys', 'system.task_runs', 'system.tags', 'system.tasks', 'system.teams', 'system.trace_review_scores', 'system.trace_reviews', 'system.usage_metrics']+ ['events', 'groups', 'persons', 'sessions', 'logs', 'query_log', 'system.cohort_calculation_history', 'system.cohorts', 'system.data_modeling_jobs', 'system.data_modeling_views', 'system.data_warehouse_tables', 'system.exports', 'system.groups', 'system.group_type_mappings', 'system.ingestion_warnings', 'system.insight_variables', 'system.tags', 'system.teams']````person` or `event` metadata unspecified above (emails, names, etc.) is stored in `properties` fields, accessed like: `properties.foo.bar`.diff --git a/products/endpoints/backend/tests/test_endpoint_psak_auth.py b/products/endpoints/backend/tests/test_endpoint_psak_auth.pyindex 769ef94f40a3..f6f862d29442 100644--- a/products/endpoints/backend/tests/test_endpoint_psak_auth.py+++ b/products/endpoints/backend/tests/test_endpoint_psak_auth.py@@ -20,10 +20,6 @@ SAMPLE_QUERY = {"kind": "HogQLQuery", "query": "SELECT 1"}_UNSET = object()-def _ff_returns_true_for_hogql_access_control(flag_key, *args, **kwargs):- return True if flag_key == "hogql-access-control" else False--def _make_psak(team, label="psak", scopes=_UNSET):# Token must match _SECRET_API_KEY_RE = r"^phs_[a-zA-Z0-9]+$", so only alphanumerics after phs_.suffix = "".join(c for c in label if c.isalnum())@@ -181,10 +177,7 @@ class TestEndpointViewSetPSAKAuth(ClickhouseTestMixin, APIBaseTest):self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED, response.content)- def test_psak_can_run_endpoint_with_hogql_access_control_on(self):- # Without the FF mock, the test path skips the access-control branch- # in posthog/hogql/database/database.py and never exercises the- # synthetic-user code path.+ def test_psak_run_uses_synthetic_user_access_control(self):token, _ = _make_psak(self.team, label="run-with-rbac")captured: dict = {}@@ -194,10 +187,7 @@ class TestEndpointViewSetPSAKAuth(ClickhouseTestMixin, APIBaseTest):captured.setdefault("results", []).append(result)return result- with (- patch("posthoganalytics.feature_enabled", side_effect=_ff_returns_true_for_hogql_access_control),- patch("posthog.hogql.database.database._compute_system_table_access_decision", side_effect=spy),- ):+ with patch("posthog.hogql.database.database._compute_system_table_access_decision", side_effect=spy):response = self.client.post(f"/api/projects/{self.team.id}/endpoints/my_endpoint/run/",data={},