: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
feat(llm-gateway): project team revocation into a dedicated cache blob (#59513)
Brandonc2c4423caba3
diff --git a/posthog/api/test/__snapshots__/test_annotation.ambr b/posthog/api/test/__snapshots__/test_annotation.ambrindex c02f30aaa9b4..8f8fd085790c 100644--- a/posthog/api/test/__snapshots__/test_annotation.ambr+++ b/posthog/api/test/__snapshots__/test_annotation.ambr@@ -134,6 +134,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -624,6 +625,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -756,6 +758,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",diff --git a/posthog/api/test/__snapshots__/test_element.ambr b/posthog/api/test/__snapshots__/test_element.ambrindex bc6d6025f50c..1fd569d5719e 100644--- a/posthog/api/test/__snapshots__/test_element.ambr+++ b/posthog/api/test/__snapshots__/test_element.ambr@@ -134,6 +134,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",diff --git a/posthog/api/test/__snapshots__/test_preflight.ambr b/posthog/api/test/__snapshots__/test_preflight.ambrindex 0b88281c6698..8bbeeca02859 100644--- a/posthog/api/test/__snapshots__/test_preflight.ambr+++ b/posthog/api/test/__snapshots__/test_preflight.ambr@@ -134,6 +134,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",diff --git a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambrindex 644eadc87872..2ec6c29930e0 100644--- a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr+++ b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr@@ -147,6 +147,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -273,6 +274,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -406,6 +408,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -551,6 +554,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -655,6 +659,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -752,6 +757,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -972,6 +978,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1351,6 +1358,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1865,6 +1873,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -2319,6 +2328,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -2553,6 +2563,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -3313,6 +3324,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -3446,6 +3458,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -3591,6 +3604,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -3695,6 +3709,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -3880,6 +3895,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -4012,6 +4028,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -4166,6 +4183,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -4529,6 +4547,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -5182,6 +5201,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -5394,6 +5414,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -5530,6 +5551,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -5634,6 +5656,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -5819,6 +5842,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -5973,6 +5997,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -6308,6 +6333,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -6692,6 +6718,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -6830,6 +6857,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -6963,6 +6991,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -7108,6 +7137,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -7212,6 +7242,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -7416,6 +7447,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -7570,6 +7602,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -7890,6 +7923,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -8282,6 +8316,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -8408,6 +8443,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -8541,6 +8577,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -8686,6 +8723,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -8806,6 +8844,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -8991,6 +9030,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -9145,6 +9185,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -9342,6 +9383,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -9806,6 +9848,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -10282,6 +10325,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -10682,6 +10726,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -10913,6 +10958,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -11121,6 +11167,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -11730,6 +11777,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -12119,6 +12167,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -12375,6 +12424,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -12817,6 +12867,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -13266,6 +13317,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -13392,6 +13444,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -13525,6 +13578,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -13718,6 +13772,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -13822,6 +13877,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -14007,6 +14063,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -14120,6 +14177,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -14224,6 +14282,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -14422,6 +14481,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -14576,6 +14636,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -14897,6 +14958,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -15286,6 +15348,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -15412,6 +15475,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -15545,6 +15609,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -15844,6 +15909,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -16177,6 +16243,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -16385,6 +16452,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -16779,6 +16847,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -17180,6 +17249,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -17436,6 +17506,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -17746,6 +17817,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -17964,6 +18036,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -18353,6 +18426,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -18609,6 +18683,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -19051,6 +19126,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",diff --git a/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr b/posthog/api/test/notebooks/__snapshots__/test_notebook.ambrindex 42869ca7ee43..331fc54b672a 100644--- a/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr+++ b/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr@@ -175,6 +175,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -479,6 +480,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -713,6 +715,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -817,6 +820,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1204,6 +1208,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",diff --git a/posthog/apps.py b/posthog/apps.pyindex 62d2b10082cd..839bb880f761 100644--- a/posthog/apps.py+++ b/posthog/apps.py@@ -27,6 +27,9 @@ class PostHogConfig(AppConfig):def ready(self):import posthog.storage.team_access_cache_signal_handlers # noqa: F401+ from posthog.storage.team_llm_gateway_policy_signal_handlers import connect_signal_handlers++ connect_signal_handlers()self._setup_lazy_admin()self._prewarm_timezone_offsets_cache()diff --git a/posthog/migrations/1190_team_llm_gateway_metadata.py b/posthog/migrations/1190_team_llm_gateway_metadata.pynew file mode 100644index 000000000000..14d41fee8bcd--- /dev/null+++ b/posthog/migrations/1190_team_llm_gateway_metadata.py@@ -0,0 +1,18 @@+from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("posthog", "1189_file_system_shortcut_order_index"),+ ]++ operations = [+ # Nullable with no DB-level default so the migration is metadata-only on+ # PG 11+ (no table rewrite, no row backfill, instant on posthog_team).+ # Null means "not revoked".+ migrations.AddField(+ model_name="team",+ name="llm_gateway_revoked_at",+ field=models.DateTimeField(null=True, blank=True),+ ),+ ]diff --git a/posthog/migrations/max_migration.txt b/posthog/migrations/max_migration.txtindex 2631b1248ae0..4ddc9670a5b8 100644--- a/posthog/migrations/max_migration.txt+++ b/posthog/migrations/max_migration.txt@@ -1 +1 @@-1189_file_system_shortcut_order_index+1190_team_llm_gateway_metadatadiff --git a/posthog/models/team/team.py b/posthog/models/team/team.pyindex 2de3d3eb8056..9f6990feb88f 100644--- a/posthog/models/team/team.py+++ b/posthog/models/team/team.py@@ -439,6 +439,13 @@ class Team(UUIDTClassicModel):# Logslogs_settings = field_access_control(models.JSONField(null=True, blank=True), "project", "admin")+ # LLM gateway — per-team kill switch read by the llm-gateway Go service via a+ # purpose-built HyperCache blob (cache/team_tokens/<token>/team_metadata/+ # llm_gateway_policy.json). Non-null revokes the team's gateway access; null+ # means active. A non-revoked team with balance gets the full supported model+ # surface (the catalog is gateway-owned). Set by internal tooling/admin only.+ llm_gateway_revoked_at = models.DateTimeField(null=True, blank=True)+# Heatmapsheatmaps_opt_in = field_access_control(models.BooleanField(null=True, blank=True), "project", "admin")diff --git a/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr b/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambrindex 3b28021e8c86..20ead3a76c13 100644--- a/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr+++ b/posthog/session_recordings/test/__snapshots__/test_session_recording_playlist.ambr@@ -121,6 +121,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -430,6 +431,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -770,6 +772,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1429,6 +1432,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1784,6 +1788,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -2022,6 +2027,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -2443,58 +2449,6 @@LIMIT 21'''# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.60- '''- SELECT 1 AS "a"- FROM "access_control_propertyaccesscontrol"- WHERE ("access_control_propertyaccesscontrol"."team_id" = 99999- AND NOT ("access_control_propertyaccesscontrol"."property_definition_id" IS NULL))- LIMIT 1- '''-# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.61- '''- SELECT COUNT(*)- FROM- (SELECT DISTINCT "ee_single_session_summary"."session_id" AS "session_id"- FROM "ee_single_session_summary"- WHERE "ee_single_session_summary"."team_id" = 99999) subquery- '''-# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.62- '''- SELECT COUNT(*)- FROM- (SELECT DISTINCT "ee_single_session_summary"."session_id" AS "session_id"- FROM "ee_single_session_summary"- WHERE "ee_single_session_summary"."team_id" = 99999) subquery- '''-# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.63- '''- SELECT COUNT(*) AS "__count"- FROM "posthog_sessionrecordingplaylistitem"- WHERE ("posthog_sessionrecordingplaylistitem"."playlist_id" = 99999- AND NOT ("posthog_sessionrecordingplaylistitem"."deleted"- AND "posthog_sessionrecordingplaylistitem"."deleted" IS NOT NULL))- '''-# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.64- '''- SELECT "posthog_sessionrecordingplaylistitem"."session_id"- FROM "posthog_sessionrecordingplaylistitem"- WHERE "posthog_sessionrecordingplaylistitem"."playlist_id" = 99999- '''-# ----# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.65- '''- SELECT COUNT(*) AS "__count"- FROM "posthog_sessionrecordingplaylistitem"- WHERE ("posthog_sessionrecordingplaylistitem"."playlist_id" = 99999- AND NOT ("posthog_sessionrecordingplaylistitem"."deleted"- AND "posthog_sessionrecordingplaylistitem"."deleted" IS NOT NULL))- '''-# ---# name: TestSessionRecordingPlaylist.test_filters_playlist_by_type.7'''SELECT "ee_accesscontrol"."id",diff --git a/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr b/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambrindex a034c37c4e5b..ed46df2ee480 100644--- a/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr+++ b/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr@@ -248,21 +248,6 @@"ee_single_session_summary"."created_at" DESC'''# ----# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.17- '''- SELECT DISTINCT ON ("ee_single_session_summary"."session_id") "ee_single_session_summary"."session_id" AS "session_id",- ("ee_single_session_summary"."summary" -> 'session_outcome') AS "summary__session_outcome",- "ee_single_session_summary"."extra_summary_context" AS "extra_summary_context"- FROM "ee_single_session_summary"- WHERE ("ee_single_session_summary"."session_id" IN ('new_session',- 'middle_session',- 'old_session')- AND "ee_single_session_summary"."team_id" = 99999- AND "ee_single_session_summary"."extra_summary_context" IS NULL)- ORDER BY 1 ASC,- "ee_single_session_summary"."created_at" DESC- '''-# ---# name: TestSessionRecordings.test_get_session_recordings_returns_newest_first.2'''SELECT "posthog_team"."id",@@ -312,6 +297,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -945,20 +931,6 @@"ee_single_session_summary"."created_at" DESC'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.17- '''- SELECT DISTINCT ON ("ee_single_session_summary"."session_id") "ee_single_session_summary"."session_id" AS "session_id",- ("ee_single_session_summary"."summary" -> 'session_outcome') AS "summary__session_outcome",- "ee_single_session_summary"."extra_summary_context" AS "extra_summary_context"- FROM "ee_single_session_summary"- WHERE ("ee_single_session_summary"."session_id" IN ('session2',- 'session1')- AND "ee_single_session_summary"."team_id" = 99999- AND "ee_single_session_summary"."extra_summary_context" IS NULL)- ORDER BY 1 ASC,- "ee_single_session_summary"."created_at" DESC- '''-# ---# name: TestSessionRecordings.test_get_session_recordings_scenarios_0_basic_listing.2'''SELECT "posthog_team"."id",@@ -1008,6 +980,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1637,19 +1610,6 @@"ee_single_session_summary"."created_at" DESC'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.17- '''- SELECT DISTINCT ON ("ee_single_session_summary"."session_id") "ee_single_session_summary"."session_id" AS "session_id",- ("ee_single_session_summary"."summary" -> 'session_outcome') AS "summary__session_outcome",- "ee_single_session_summary"."extra_summary_context" AS "extra_summary_context"- FROM "ee_single_session_summary"- WHERE ("ee_single_session_summary"."session_id" IN ('session_with_duration')- AND "ee_single_session_summary"."team_id" = 99999- AND "ee_single_session_summary"."extra_summary_context" IS NULL)- ORDER BY 1 ASC,- "ee_single_session_summary"."created_at" DESC- '''-# ---# name: TestSessionRecordings.test_get_session_recordings_scenarios_1_multiple_snapshots.2'''SELECT "posthog_team"."id",@@ -1699,6 +1659,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -2328,19 +2289,6 @@"ee_single_session_summary"."created_at" DESC'''# ----# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.17- '''- SELECT DISTINCT ON ("ee_single_session_summary"."session_id") "ee_single_session_summary"."session_id" AS "session_id",- ("ee_single_session_summary"."summary" -> 'session_outcome') AS "summary__session_outcome",- "ee_single_session_summary"."extra_summary_context" AS "extra_summary_context"- FROM "ee_single_session_summary"- WHERE ("ee_single_session_summary"."session_id" IN ('session_many_ids')- AND "ee_single_session_summary"."team_id" = 99999- AND "ee_single_session_summary"."extra_summary_context" IS NULL)- ORDER BY 1 ASC,- "ee_single_session_summary"."created_at" DESC- '''-# ---# name: TestSessionRecordings.test_get_session_recordings_scenarios_2_many_distinct_ids.2'''SELECT "posthog_team"."id",@@ -2390,6 +2338,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -3023,20 +2972,6 @@"ee_single_session_summary"."created_at" DESC'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.17- '''- SELECT DISTINCT ON ("ee_single_session_summary"."session_id") "ee_single_session_summary"."session_id" AS "session_id",- ("ee_single_session_summary"."summary" -> 'session_outcome') AS "summary__session_outcome",- "ee_single_session_summary"."extra_summary_context" AS "extra_summary_context"- FROM "ee_single_session_summary"- WHERE ("ee_single_session_summary"."session_id" IN ('at_base_time_plus_20',- 'at_base_time')- AND "ee_single_session_summary"."team_id" = 99999- AND "ee_single_session_summary"."extra_summary_context" IS NULL)- ORDER BY 1 ASC,- "ee_single_session_summary"."created_at" DESC- '''-# ---# name: TestSessionRecordings.test_get_session_recordings_sorted_0_descending_original_.2'''SELECT "posthog_team"."id",@@ -3086,6 +3021,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -3719,20 +3655,6 @@"ee_single_session_summary"."created_at" DESC'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.17- '''- SELECT DISTINCT ON ("ee_single_session_summary"."session_id") "ee_single_session_summary"."session_id" AS "session_id",- ("ee_single_session_summary"."summary" -> 'session_outcome') AS "summary__session_outcome",- "ee_single_session_summary"."extra_summary_context" AS "extra_summary_context"- FROM "ee_single_session_summary"- WHERE ("ee_single_session_summary"."session_id" IN ('at_base_time_plus_20',- 'at_base_time')- AND "ee_single_session_summary"."team_id" = 99999- AND "ee_single_session_summary"."extra_summary_context" IS NULL)- ORDER BY 1 ASC,- "ee_single_session_summary"."created_at" DESC- '''-# ---# name: TestSessionRecordings.test_get_session_recordings_sorted_1_descending.2'''SELECT "posthog_team"."id",@@ -3782,6 +3704,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -4415,20 +4338,6 @@"ee_single_session_summary"."created_at" DESC'''# ----# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.17- '''- SELECT DISTINCT ON ("ee_single_session_summary"."session_id") "ee_single_session_summary"."session_id" AS "session_id",- ("ee_single_session_summary"."summary" -> 'session_outcome') AS "summary__session_outcome",- "ee_single_session_summary"."extra_summary_context" AS "extra_summary_context"- FROM "ee_single_session_summary"- WHERE ("ee_single_session_summary"."session_id" IN ('at_base_time',- 'at_base_time_plus_20')- AND "ee_single_session_summary"."team_id" = 99999- AND "ee_single_session_summary"."extra_summary_context" IS NULL)- ORDER BY 1 ASC,- "ee_single_session_summary"."created_at" DESC- '''-# ---# name: TestSessionRecordings.test_get_session_recordings_sorted_2_ascending.2'''SELECT "posthog_team"."id",@@ -4478,6 +4387,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -5325,6 +5235,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -6059,6 +5970,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -6707,6 +6619,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -6925,6 +6838,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -7672,6 +7586,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -8332,294 +8247,6 @@"ee_single_session_summary"."created_at" DESC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.172- '''- SELECT "posthog_datawarehousesavedquery"."created_by_id",- "posthog_datawarehousesavedquery"."created_at",- "posthog_datawarehousesavedquery"."updated_at",- "posthog_datawarehousesavedquery"."deleted",- "posthog_datawarehousesavedquery"."deleted_at",- "posthog_datawarehousesavedquery"."id",- "posthog_datawarehousesavedquery"."name",- "posthog_datawarehousesavedquery"."team_id",- "posthog_datawarehousesavedquery"."latest_error",- "posthog_datawarehousesavedquery"."columns",- "posthog_datawarehousesavedquery"."external_tables",- "posthog_datawarehousesavedquery"."query",- "posthog_datawarehousesavedquery"."status",- "posthog_datawarehousesavedquery"."last_run_at",- "posthog_datawarehousesavedquery"."sync_frequency_interval",- "posthog_datawarehousesavedquery"."table_id",- "posthog_datawarehousesavedquery"."is_materialized",- "posthog_datawarehousesavedquery"."deleted_name",- "posthog_datawarehousesavedquery"."managed_viewset_id",- "posthog_datawarehousesavedquery"."folder_id",- "posthog_datawarehousesavedquery"."origin",- "posthog_datawarehousesavedquery"."is_test",- "posthog_datawarehousesavedquery"."expires_at",- "posthog_datawarehousetable"."created_by_id",- "posthog_datawarehousetable"."created_at",- "posthog_datawarehousetable"."updated_at",- "posthog_datawarehousetable"."deleted",- "posthog_datawarehousetable"."deleted_at",- "posthog_datawarehousetable"."id",- "posthog_datawarehousetable"."name",- "posthog_datawarehousetable"."format",- "posthog_datawarehousetable"."team_id",- "posthog_datawarehousetable"."url_pattern",- "posthog_datawarehousetable"."queryable_folder",- "posthog_datawarehousetable"."credential_id",- "posthog_datawarehousetable"."external_data_source_id",- "posthog_datawarehousetable"."columns",- "posthog_datawarehousetable"."options",- "posthog_datawarehousetable"."row_count",- "posthog_datawarehousetable"."size_in_s3_mib",- "posthog_datawarehousecredential"."created_by_id",- "posthog_datawarehousecredential"."created_at",- "posthog_datawarehousecredential"."id",- "posthog_datawarehousecredential"."access_key",- "posthog_datawarehousecredential"."access_secret",- "posthog_datawarehousecredential"."team_id",- "posthog_datawarehousemanagedviewset"."created_by_id",- "posthog_datawarehousemanagedviewset"."created_at",- "posthog_datawarehousemanagedviewset"."updated_at",- "posthog_datawarehousemanagedviewset"."id",- "posthog_datawarehousemanagedviewset"."team_id",- "posthog_datawarehousemanagedviewset"."kind"- FROM "posthog_datawarehousesavedquery"- LEFT OUTER JOIN "posthog_datawarehousemanagedviewset" ON ("posthog_datawarehousesavedquery"."managed_viewset_id" = "posthog_datawarehousemanagedviewset"."id")- LEFT OUTER JOIN "posthog_datawarehousetable" ON ("posthog_datawarehousesavedquery"."table_id" = "posthog_datawarehousetable"."id")- LEFT OUTER JOIN "posthog_datawarehousecredential" ON ("posthog_datawarehousetable"."credential_id" = "posthog_datawarehousecredential"."id")- WHERE ("posthog_datawarehousesavedquery"."team_id" = 99999- AND NOT ("posthog_datawarehousesavedquery"."deleted"- AND "posthog_datawarehousesavedquery"."deleted" IS NOT NULL)- AND "posthog_datawarehousesavedquery"."managed_viewset_id" IS NULL)- ORDER BY "posthog_datawarehousesavedquery"."name" ASC- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.173- '''- SELECT "posthog_datawarehousesavedquery"."created_by_id",- "posthog_datawarehousesavedquery"."created_at",- "posthog_datawarehousesavedquery"."updated_at",- "posthog_datawarehousesavedquery"."deleted",- "posthog_datawarehousesavedquery"."deleted_at",- "posthog_datawarehousesavedquery"."id",- "posthog_datawarehousesavedquery"."name",- "posthog_datawarehousesavedquery"."team_id",- "posthog_datawarehousesavedquery"."latest_error",- "posthog_datawarehousesavedquery"."columns",- "posthog_datawarehousesavedquery"."external_tables",- "posthog_datawarehousesavedquery"."query",- "posthog_datawarehousesavedquery"."status",- "posthog_datawarehousesavedquery"."last_run_at",- "posthog_datawarehousesavedquery"."sync_frequency_interval",- "posthog_datawarehousesavedquery"."table_id",- "posthog_datawarehousesavedquery"."is_materialized",- "posthog_datawarehousesavedquery"."deleted_name",- "posthog_datawarehousesavedquery"."managed_viewset_id",- "posthog_datawarehousesavedquery"."folder_id",- "posthog_datawarehousesavedquery"."origin",- "posthog_datawarehousesavedquery"."is_test",- "posthog_datawarehousesavedquery"."expires_at",- "posthog_datawarehousetable"."created_by_id",- "posthog_datawarehousetable"."created_at",- "posthog_datawarehousetable"."updated_at",- "posthog_datawarehousetable"."deleted",- "posthog_datawarehousetable"."deleted_at",- "posthog_datawarehousetable"."id",- "posthog_datawarehousetable"."name",- "posthog_datawarehousetable"."format",- "posthog_datawarehousetable"."team_id",- "posthog_datawarehousetable"."url_pattern",- "posthog_datawarehousetable"."queryable_folder",- "posthog_datawarehousetable"."credential_id",- "posthog_datawarehousetable"."external_data_source_id",- "posthog_datawarehousetable"."columns",- "posthog_datawarehousetable"."options",- "posthog_datawarehousetable"."row_count",- "posthog_datawarehousetable"."size_in_s3_mib",- "posthog_datawarehousecredential"."created_by_id",- "posthog_datawarehousecredential"."created_at",- "posthog_datawarehousecredential"."id",- "posthog_datawarehousecredential"."access_key",- "posthog_datawarehousecredential"."access_secret",- "posthog_datawarehousecredential"."team_id"- FROM "posthog_datawarehousesavedquery"- LEFT OUTER JOIN "posthog_datawarehousetable" ON ("posthog_datawarehousesavedquery"."table_id" = "posthog_datawarehousetable"."id")- LEFT OUTER JOIN "posthog_datawarehousecredential" ON ("posthog_datawarehousetable"."credential_id" = "posthog_datawarehousecredential"."id")- WHERE ("posthog_datawarehousesavedquery"."team_id" = 99999- AND "posthog_datawarehousesavedquery"."origin" = 'endpoint'- AND NOT ("posthog_datawarehousesavedquery"."deleted"- AND "posthog_datawarehousesavedquery"."deleted" IS NOT NULL))- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.174- '''- SELECT "posthog_externaldatasource"."created_by_id",- "posthog_externaldatasource"."created_at",- "posthog_externaldatasource"."updated_at",- "posthog_externaldatasource"."deleted",- "posthog_externaldatasource"."deleted_at",- "posthog_externaldatasource"."id",- "posthog_externaldatasource"."source_id",- "posthog_externaldatasource"."connection_id",- "posthog_externaldatasource"."destination_id",- "posthog_externaldatasource"."team_id",- "posthog_externaldatasource"."sync_frequency",- "posthog_externaldatasource"."status",- "posthog_externaldatasource"."source_type",- "posthog_externaldatasource"."job_inputs",- "posthog_externaldatasource"."connection_metadata",- "posthog_externaldatasource"."are_tables_created",- "posthog_externaldatasource"."prefix",- "posthog_externaldatasource"."description",- "posthog_externaldatasource"."created_via",- "posthog_externaldatasource"."access_method",- "posthog_externaldatasource"."revenue_analytics_enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id",- "posthog_externaldatasourcerevenueanalyticsconfig"."enabled",- "posthog_externaldatasourcerevenueanalyticsconfig"."include_invoiceless_charges"- FROM "posthog_externaldatasource"- LEFT OUTER JOIN "posthog_externaldatasourcerevenueanalyticsconfig" ON ("posthog_externaldatasource"."id" = "posthog_externaldatasourcerevenueanalyticsconfig"."external_data_source_id")- WHERE ("posthog_externaldatasource"."source_type" IN ('Stripe')- AND "posthog_externaldatasource"."team_id" = 99999- AND NOT ("posthog_externaldatasource"."deleted"- AND "posthog_externaldatasource"."deleted" IS NOT NULL))- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.175- '''- SELECT "posthog_datawarehousetable"."created_by_id",- "posthog_datawarehousetable"."created_at",- "posthog_datawarehousetable"."updated_at",- "posthog_datawarehousetable"."deleted",- "posthog_datawarehousetable"."deleted_at",- "posthog_datawarehousetable"."id",- "posthog_datawarehousetable"."name",- "posthog_datawarehousetable"."format",- "posthog_datawarehousetable"."team_id",- "posthog_datawarehousetable"."url_pattern",- "posthog_datawarehousetable"."queryable_folder",- "posthog_datawarehousetable"."credential_id",- "posthog_datawarehousetable"."external_data_source_id",- "posthog_datawarehousetable"."columns",- "posthog_datawarehousetable"."options",- "posthog_datawarehousetable"."row_count",- "posthog_datawarehousetable"."size_in_s3_mib",- "posthog_datawarehousecredential"."created_by_id",- "posthog_datawarehousecredential"."created_at",- "posthog_datawarehousecredential"."id",- "posthog_datawarehousecredential"."access_key",- "posthog_datawarehousecredential"."access_secret",- "posthog_datawarehousecredential"."team_id",- "posthog_externaldatasource"."created_by_id",- "posthog_externaldatasource"."created_at",- "posthog_externaldatasource"."updated_at",- "posthog_externaldatasource"."deleted",- "posthog_externaldatasource"."deleted_at",- "posthog_externaldatasource"."id",- "posthog_externaldatasource"."source_id",- "posthog_externaldatasource"."connection_id",- "posthog_externaldatasource"."destination_id",- "posthog_externaldatasource"."team_id",- "posthog_externaldatasource"."sync_frequency",- "posthog_externaldatasource"."status",- "posthog_externaldatasource"."source_type",- "posthog_externaldatasource"."job_inputs",- "posthog_externaldatasource"."connection_metadata",- "posthog_externaldatasource"."are_tables_created",- "posthog_externaldatasource"."prefix",- "posthog_externaldatasource"."description",- "posthog_externaldatasource"."created_via",- "posthog_externaldatasource"."access_method",- "posthog_externaldatasource"."revenue_analytics_enabled"- FROM "posthog_datawarehousetable"- LEFT OUTER JOIN "posthog_externaldatasource" ON ("posthog_datawarehousetable"."external_data_source_id" = "posthog_externaldatasource"."id")- LEFT OUTER JOIN "posthog_datawarehousecredential" ON ("posthog_datawarehousetable"."credential_id" = "posthog_datawarehousecredential"."id")- WHERE ("posthog_datawarehousetable"."team_id" = 99999- AND NOT ("posthog_datawarehousetable"."deleted"- AND "posthog_datawarehousetable"."deleted" IS NOT NULL)- AND NOT ("posthog_externaldatasource"."access_method" = 'direct'- AND "posthog_externaldatasource"."access_method" IS NOT NULL))- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.176- '''- SELECT "posthog_datawarehousejoin"."created_by_id",- "posthog_datawarehousejoin"."created_at",- "posthog_datawarehousejoin"."deleted",- "posthog_datawarehousejoin"."deleted_at",- "posthog_datawarehousejoin"."id",- "posthog_datawarehousejoin"."team_id",- "posthog_datawarehousejoin"."source_table_name",- "posthog_datawarehousejoin"."source_table_key",- "posthog_datawarehousejoin"."joining_table_name",- "posthog_datawarehousejoin"."joining_table_key",- "posthog_datawarehousejoin"."field_name",- "posthog_datawarehousejoin"."configuration"- FROM "posthog_datawarehousejoin"- WHERE ("posthog_datawarehousejoin"."team_id" = 99999- AND NOT ("posthog_datawarehousejoin"."deleted"- AND "posthog_datawarehousejoin"."deleted" IS NOT NULL))- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.177- '''- SELECT 1 AS "a"- FROM "access_control_propertyaccesscontrol"- WHERE ("access_control_propertyaccesscontrol"."team_id" = 99999- AND NOT ("access_control_propertyaccesscontrol"."property_definition_id" IS NULL))- LIMIT 1- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.178- '''- SELECT 1 AS "a"- FROM "access_control_propertyaccesscontrol"- WHERE ("access_control_propertyaccesscontrol"."team_id" = 99999- AND NOT ("access_control_propertyaccesscontrol"."property_definition_id" IS NULL))- LIMIT 1- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.179- '''- SELECT "posthog_sessionrecording"."id",- "posthog_sessionrecording"."session_id",- "posthog_sessionrecording"."team_id",- "posthog_sessionrecording"."created_at",- "posthog_sessionrecording"."deleted",- "posthog_sessionrecording"."object_storage_path",- "posthog_sessionrecording"."full_recording_v2_path",- "posthog_sessionrecording"."distinct_id",- "posthog_sessionrecording"."duration",- "posthog_sessionrecording"."active_seconds",- "posthog_sessionrecording"."inactive_seconds",- "posthog_sessionrecording"."start_time",- "posthog_sessionrecording"."end_time",- "posthog_sessionrecording"."click_count",- "posthog_sessionrecording"."keypress_count",- "posthog_sessionrecording"."mouse_activity_count",- "posthog_sessionrecording"."console_log_count",- "posthog_sessionrecording"."console_warn_count",- "posthog_sessionrecording"."console_error_count",- "posthog_sessionrecording"."start_url",- "posthog_sessionrecording"."storage_version",- "posthog_sessionrecording"."retention_period_days"- FROM "posthog_sessionrecording"- WHERE ("posthog_sessionrecording"."session_id" IN ('1',- '10',- '2',- '3',- '4',- '5',- '6',- '7',- '8',- '9')- AND "posthog_sessionrecording"."team_id" = 99999)- '''-# ---# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.18'''SELECT "posthog_datawarehousesavedquery"."created_by_id",@@ -8685,66 +8312,6 @@ORDER BY "posthog_datawarehousesavedquery"."name" ASC'''# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.180- '''- SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id"- FROM "posthog_sessionrecordingviewed"- WHERE ("posthog_sessionrecordingviewed"."team_id" = 99999- AND "posthog_sessionrecordingviewed"."user_id" = 99999- AND "posthog_sessionrecordingviewed"."session_id" IN ('9',- '8',- '7',- '6',- '5',- '4',- '3',- '2',- '10',- '1'))- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.181- '''- SELECT "posthog_sessionrecordingviewed"."session_id" AS "session_id",- "posthog_user"."email" AS "user__email"- FROM "posthog_sessionrecordingviewed"- INNER JOIN "posthog_user" ON ("posthog_sessionrecordingviewed"."user_id" = "posthog_user"."id")- WHERE ("posthog_sessionrecordingviewed"."session_id" IN ('9',- '8',- '7',- '6',- '5',- '4',- '3',- '2',- '10',- '1')- AND "posthog_sessionrecordingviewed"."team_id" = 99999- AND NOT ("posthog_sessionrecordingviewed"."user_id" = 99999))- '''-# ----# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.182- '''- SELECT DISTINCT ON ("ee_single_session_summary"."session_id") "ee_single_session_summary"."session_id" AS "session_id",- ("ee_single_session_summary"."summary" -> 'session_outcome') AS "summary__session_outcome",- "ee_single_session_summary"."extra_summary_context" AS "extra_summary_context"- FROM "ee_single_session_summary"- WHERE ("ee_single_session_summary"."session_id" IN ('9',- '8',- '7',- '6',- '5',- '4',- '3',- '2',- '10',- '1')- AND "ee_single_session_summary"."team_id" = 99999- AND "ee_single_session_summary"."extra_summary_context" IS NULL)- ORDER BY 1 ASC,- "ee_single_session_summary"."created_at" DESC- '''-# ---# name: TestSessionRecordings.test_listing_recordings_is_not_nplus1_for_persons.19'''SELECT "posthog_datawarehousesavedquery"."created_by_id",@@ -8851,6 +8418,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -9300,6 +8868,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -10015,6 +9584,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -10801,6 +10371,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -11535,6 +11106,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -12306,6 +11878,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",diff --git a/posthog/storage/team_llm_gateway_policy_cache.py b/posthog/storage/team_llm_gateway_policy_cache.pynew file mode 100644index 000000000000..8225a3e8271a--- /dev/null+++ b/posthog/storage/team_llm_gateway_policy_cache.py@@ -0,0 +1,134 @@+"""+LLM gateway policy HyperCache — purpose-built cache projection for the Go+llm-gateway service.++Shape:+ Key: cache/team_tokens/<api_token>/team_metadata/llm_gateway_policy.json+ Body:+ {+ "id": 123,+ "api_token": "phc_...",+ "llm_gateway_revoked_at": "2026-05-20T12:34:56+00:00" | null+ }++The blob is written to its own cache key (sibling to full_metadata.json) so the+flags-pipeline consumers of team_metadata are not affected by additions here.+The gateway resolves token -> team and denies on a non-null revoked_at; a+non-revoked team gets the full gateway-owned model surface. Null revoked_at+means active, so no backfill is required when the column is first added.+"""++import os+from typing import Any++from django.conf import settings+from django.db import OperationalError++import structlog++from posthog.caching.flags_redis_cache import FLAGS_DEDICATED_CACHE_ALIAS+from posthog.models.team.team import Team+from posthog.storage.cache_expiry_manager import refresh_expiring_caches as refresh_generic+from posthog.storage.hypercache import HyperCache, HyperCacheStoreMissing, KeyType+from posthog.storage.hypercache_manager import (+ HyperCacheManagementConfig,+ get_cache_stats as _generic_cache_stats,+)++logger = structlog.get_logger(__name__)+++LLM_GATEWAY_POLICY_CACHE_TTL = int(os.environ.get("LLM_GATEWAY_POLICY_CACHE_TTL", str(60 * 60 * 24 * 7)))+LLM_GATEWAY_POLICY_CACHE_MISS_TTL = int(os.environ.get("LLM_GATEWAY_POLICY_CACHE_MISS_TTL", str(60 * 60 * 24)))++LLM_GATEWAY_POLICY_CACHE_EXPIRY_SORTED_SET = "llm_gateway_policy_cache_expiry"++LLM_GATEWAY_POLICY_FIELDS = [+ "id",+ "api_token",+ "llm_gateway_revoked_at",+]+++def _serialize_team_to_llm_gateway_policy(team: Team) -> dict[str, Any]:+ """Project a Team into the JSON shape the Go llm-gateway consumes."""+ return {+ "id": team.id,+ "api_token": team.api_token,+ "llm_gateway_revoked_at": (team.llm_gateway_revoked_at.isoformat() if team.llm_gateway_revoked_at else None),+ }+++def _batch_load_llm_gateway_policy(teams: list[Team]) -> dict[int, dict[str, Any]]:+ return {team.id: _serialize_team_to_llm_gateway_policy(team) for team in teams}+++def _load_llm_gateway_policy(team_key: KeyType) -> dict[str, Any] | HyperCacheStoreMissing:+ # Narrow except clause: catching Exception would turn any bug (TypeError,+ # AttributeError, etc.) into a 24h negative-cache entry that 401s every+ # gateway request for the team. Only Team.DoesNotExist (genuine miss) and+ # OperationalError (expected transient DB failure) soft-fail. Anything+ # else propagates so the cache can retry on the next request.+ try:+ team = HyperCache.team_from_key(team_key)+ return _serialize_team_to_llm_gateway_policy(team)+ except Team.DoesNotExist:+ logger.debug("Team not found for llm-gateway policy lookup")+ return HyperCacheStoreMissing()+ except OperationalError as e:+ logger.exception(+ "Database error loading llm-gateway policy",+ error_type=type(e).__name__,+ team_key_type=type(team_key).__name__,+ )+ return HyperCacheStoreMissing()+++team_llm_gateway_policy_hypercache = HyperCache(+ namespace="team_metadata",+ value="llm_gateway_policy.json",+ token_based=True,+ load_fn=_load_llm_gateway_policy,+ batch_load_fn=_batch_load_llm_gateway_policy,+ cache_ttl=LLM_GATEWAY_POLICY_CACHE_TTL,+ cache_miss_ttl=LLM_GATEWAY_POLICY_CACHE_MISS_TTL,+ cache_alias=FLAGS_DEDICATED_CACHE_ALIAS if FLAGS_DEDICATED_CACHE_ALIAS in settings.CACHES else None,+ expiry_sorted_set_key=LLM_GATEWAY_POLICY_CACHE_EXPIRY_SORTED_SET,+)+++def get_team_llm_gateway_policy(team: Team | str | int) -> dict[str, Any] | None:+ return team_llm_gateway_policy_hypercache.get_from_cache(team)+++def update_team_llm_gateway_policy_cache(team: Team | str | int, ttl: int | None = None) -> bool:+ success = team_llm_gateway_policy_hypercache.update_cache(team, ttl=ttl)+ if not success:+ team_id = team.id if isinstance(team, Team) else "unknown"+ logger.warning("Failed to update llm-gateway policy cache", team_id=team_id)+ return success+++def clear_team_llm_gateway_policy_cache(team: Team | str | int, kinds: list[str] | None = None) -> None:+ team_llm_gateway_policy_hypercache.clear_cache(team, kinds=kinds)+++LLM_GATEWAY_POLICY_HYPERCACHE_MANAGEMENT_CONFIG = HyperCacheManagementConfig(+ hypercache=team_llm_gateway_policy_hypercache,+ update_fn=update_team_llm_gateway_policy_cache,+ cache_name="llm_gateway_policy",+)+++def refresh_expiring_caches(ttl_threshold_hours: int = 24, limit: int = 5000) -> tuple[int, int]:+ """+ Refresh policy caches whose TTL falls below the threshold. Mirrors the+ team_metadata refresh pipeline so the cache stays warm under a growing+ team pool instead of relying on lazy DB lookups when entries expire.+ """+ return refresh_generic(LLM_GATEWAY_POLICY_HYPERCACHE_MANAGEMENT_CONFIG, ttl_threshold_hours, limit)+++def get_cache_stats() -> dict[str, Any]:+ """Coverage/TTL stats for the policy cache; also pushes Prometheus gauges."""+ return _generic_cache_stats(LLM_GATEWAY_POLICY_HYPERCACHE_MANAGEMENT_CONFIG)diff --git a/posthog/storage/team_llm_gateway_policy_signal_handlers.py b/posthog/storage/team_llm_gateway_policy_signal_handlers.pynew file mode 100644index 000000000000..6d9aaf234458--- /dev/null+++ b/posthog/storage/team_llm_gateway_policy_signal_handlers.py@@ -0,0 +1,153 @@+"""+Signal handlers that keep the llm-gateway policy cache in sync with Team state.++Wired from PostHogConfig.ready() via connect_signal_handlers() so the receivers+register in every Django process that can mutate a Team (web, asgi, workers),+not only the ones that happen to import the Celery task module. The llm-gateway+policy blob is keyed by api_token, so a revocation or token rotation that does+not invalidate the cache leaves a stale entry usable for the full cache TTL.++Cache mutations must go through Team.save()/.delete(); Team.objects.update() and+bulk_update() bypass Django signals and would leak the old cache entry.+"""++from typing import Any++from django.conf import settings+from django.db import OperationalError, transaction+from django.db.models.signals import post_init, post_save, pre_delete, pre_save++import structlog++from posthog.models.team import Team+from posthog.storage.hypercache_manager import HYPERCACHE_SIGNAL_UPDATE_COUNTER+from posthog.storage.team_llm_gateway_policy_cache import clear_team_llm_gateway_policy_cache+from posthog.tasks.team_llm_gateway_policy import update_team_llm_gateway_policy_cache_task++logger = structlog.get_logger(__name__)++# Snapshots of the values a Team was loaded with, so post_save can detect a+# rotation (api_token) or a revocation flip (llm_gateway_revoked_at) without an+# extra DB read.+_LOADED_API_TOKEN_ATTR = "_llm_gateway_loaded_api_token"+_LOADED_REVOKED_AT_ATTR = "_llm_gateway_loaded_revoked_at"+_NO_SNAPSHOT = object()+++def _snapshot_loaded_state(sender: type[Team], instance: Team, **kwargs: Any) -> None:+ """+ Record the instance's current api_token and llm_gateway_revoked_at on+ post_init so the post_save handler can spot a rotation or revocation flip+ without a DB read. Skip a field when it is deferred (e.g. a .only() fetch)+ so we never trigger a lazy load.+ """+ deferred = instance.get_deferred_fields()+ if "api_token" not in deferred:+ instance.__dict__[_LOADED_API_TOKEN_ATTR] = instance.api_token+ if "llm_gateway_revoked_at" not in deferred:+ instance.__dict__[_LOADED_REVOKED_AT_ATTR] = instance.llm_gateway_revoked_at+++def _capture_old_state_if_deferred(sender: type[Team], instance: Team, **kwargs: Any) -> None:+ """+ Fallback for instances loaded with api_token or llm_gateway_revoked_at+ deferred: capture the old values from the DB before the UPDATE runs.+ No-op (zero query) for the common full-load path, where post_init already+ snapshotted. Without this, a deferred-load rotation or revocation would+ leave the previous cache entry live for the full 7-day TTL.+ """+ if not instance.pk or instance._state.adding:+ return+ need_api = _LOADED_API_TOKEN_ATTR not in instance.__dict__+ need_rev = _LOADED_REVOKED_AT_ATTR not in instance.__dict__+ if not need_api and not need_rev:+ return+ update_fields = kwargs.get("update_fields")+ if update_fields is not None and not ({"api_token", "llm_gateway_revoked_at"} & set(update_fields)):+ return+ fields: list[str] = []+ if need_api:+ fields.append("api_token")+ if need_rev:+ fields.append("llm_gateway_revoked_at")+ try:+ row = Team.objects.filter(pk=instance.pk).values(*fields).first()+ except OperationalError:+ # Mirror the loader: log so an operational hiccup mid-rotation is+ # visible instead of silently leaking the old cache for the full TTL.+ logger.exception(+ "Database error capturing old Team state for llm-gateway cache invalidation",+ team_id=instance.pk,+ )+ return+ if row is None:+ return+ if need_api and row.get("api_token") is not None:+ instance.__dict__[_LOADED_API_TOKEN_ATTR] = row["api_token"]+ if need_rev:+ instance.__dict__[_LOADED_REVOKED_AT_ATTR] = row.get("llm_gateway_revoked_at")+++def _update_cache_on_save(sender: type[Team], instance: Team, created: bool, **kwargs: Any) -> None:+ if not settings.FLAGS_REDIS_URL:+ return++ old_api_token: str | None = instance.__dict__.get(_LOADED_API_TOKEN_ATTR)+ rotated = bool(old_api_token and old_api_token != instance.api_token)++ # Use a sentinel so "no snapshot" (deferred + no fallback) is distinguishable+ # from "snapshot of None" (loaded as null). Read via __dict__ rather than the+ # descriptor so a deferred-load save that does not touch this field does not+ # trigger a lazy load just to feed the comparison. We only act on an observed+ # change where both sides have a real value.+ old_revoked_at = instance.__dict__.get(_LOADED_REVOKED_AT_ATTR, _NO_SNAPSHOT)+ new_revoked_at = instance.__dict__.get("llm_gateway_revoked_at", _NO_SNAPSHOT)+ revoked_changed = (+ old_revoked_at is not _NO_SNAPSHOT and new_revoked_at is not _NO_SNAPSHOT and old_revoked_at != new_revoked_at+ )++ # Re-snapshot so chained changes compare against the just-saved values.+ instance.__dict__[_LOADED_API_TOKEN_ATTR] = instance.api_token+ if new_revoked_at is not _NO_SNAPSHOT:+ instance.__dict__[_LOADED_REVOKED_AT_ATTR] = new_revoked_at++ def enqueue_task() -> None:+ try:+ update_team_llm_gateway_policy_cache_task.delay(instance.id)+ kinds = ["redis"] if settings.TEST else None+ if rotated and old_api_token is not None:+ # Same on-commit flow as the refresh so the old cache entry+ # disappears the moment the rotated token becomes live.+ clear_team_llm_gateway_policy_cache(old_api_token, kinds=kinds)+ if revoked_changed:+ # Invalidate the current token's entry synchronously so the next+ # gateway request reads the fresh revocation state from the DB.+ # The async refresh task can lag, leaving the stale active+ # policy usable for the full cache TTL.+ clear_team_llm_gateway_policy_cache(instance, kinds=kinds)+ except Exception as e:+ HYPERCACHE_SIGNAL_UPDATE_COUNTER.labels(+ namespace="team_llm_gateway_policy", operation="enqueue", result="failure"+ ).inc()+ logger.exception(+ "Failed to enqueue llm-gateway policy cache update",+ team_id=instance.id,+ error=str(e),+ )++ transaction.on_commit(enqueue_task)+++def _clear_cache_on_delete(sender: type[Team], instance: Team, **kwargs: Any) -> None:+ if not settings.FLAGS_REDIS_URL:+ return++ kinds = ["redis"] if settings.TEST else None+ clear_team_llm_gateway_policy_cache(instance, kinds=kinds)+++def connect_signal_handlers() -> None:+ post_init.connect(_snapshot_loaded_state, sender=Team)+ pre_save.connect(_capture_old_state_if_deferred, sender=Team)+ post_save.connect(_update_cache_on_save, sender=Team)+ pre_delete.connect(_clear_cache_on_delete, sender=Team)diff --git a/posthog/storage/test/test_team_llm_gateway_policy_cache.py b/posthog/storage/test/test_team_llm_gateway_policy_cache.pynew file mode 100644index 000000000000..3ab18b5c7269--- /dev/null+++ b/posthog/storage/test/test_team_llm_gateway_policy_cache.py@@ -0,0 +1,254 @@+"""+Tests for the llm-gateway policy HyperCache.++Covers the projection shape the Go llm-gateway consumes, the null-default+behavior (no backfill required), and the signal-driven cache update path.+"""++import json+from datetime import UTC, datetime+from typing import Any++from posthog.test.base import BaseTest+from unittest.mock import patch++from posthog.models.team.team import Team+from posthog.storage.team_llm_gateway_policy_cache import (+ LLM_GATEWAY_POLICY_FIELDS,+ _serialize_team_to_llm_gateway_policy,+ clear_team_llm_gateway_policy_cache,+ get_team_llm_gateway_policy,+ update_team_llm_gateway_policy_cache,+)+from posthog.tasks.team_llm_gateway_policy import update_team_llm_gateway_policy_cache_task+++class TestLLMGatewayPolicyProjection(BaseTest):+ """The projection is the contract with the Go service — pin its shape."""++ def test_projection_has_expected_fields(self):+ # The field list must match what the serializer actually emits, so a+ # field added to one but not the other fails here.+ self.assertEqual(+ set(LLM_GATEWAY_POLICY_FIELDS),+ set(_serialize_team_to_llm_gateway_policy(self.team).keys()),+ )+ self.assertEqual(+ set(LLM_GATEWAY_POLICY_FIELDS),+ {"id", "api_token", "llm_gateway_revoked_at"},+ )++ def test_populated_team_round_trips_through_json(self):+ revoked_at = datetime(2026, 5, 20, 12, 34, 56, tzinfo=UTC)++ self.team.llm_gateway_revoked_at = revoked_at+ self.team.save()++ policy = _serialize_team_to_llm_gateway_policy(self.team)++ self.assertEqual(policy["id"], self.team.id)+ self.assertEqual(policy["api_token"], self.team.api_token)+ # Datetime must be ISO8601 so the Go service can parse it from JSON.+ self.assertEqual(policy["llm_gateway_revoked_at"], revoked_at.isoformat())++ rehydrated = json.loads(json.dumps(policy))+ self.assertEqual(rehydrated, policy)++ def test_unset_team_serializes_to_null_revoked_at(self):+ """+ A team that has never been revoked projects a null revoked_at, not a+ default, so the schema migration needs no backfill. The gateway treats+ null as active.+ """+ policy = _serialize_team_to_llm_gateway_policy(self.team)++ self.assertEqual(policy["id"], self.team.id)+ self.assertEqual(policy["api_token"], self.team.api_token)+ self.assertIsNone(policy["llm_gateway_revoked_at"])+++class TestLLMGatewayPolicyCacheOps(BaseTest):+ """Test the read/write/clear surface around the HyperCache."""++ @patch("posthog.storage.team_llm_gateway_policy_cache.team_llm_gateway_policy_hypercache")+ def test_get_and_update(self, mock_hypercache):+ mock_payload: dict[str, Any] = {+ "id": self.team.id,+ "api_token": self.team.api_token,+ "llm_gateway_revoked_at": None,+ }+ mock_hypercache.get_from_cache.return_value = mock_payload+ mock_hypercache.update_cache.return_value = True++ self.assertTrue(update_team_llm_gateway_policy_cache(self.team))++ policy = get_team_llm_gateway_policy(self.team)+ self.assertEqual(policy, mock_payload)++ @patch("posthog.storage.team_llm_gateway_policy_cache.team_llm_gateway_policy_hypercache")+ def test_clear(self, mock_hypercache):+ clear_team_llm_gateway_policy_cache(self.team, kinds=["redis"])+ mock_hypercache.clear_cache.assert_called_once_with(self.team, kinds=["redis"])+++class TestLLMGatewayPolicyTasks(BaseTest):+ @patch("posthog.tasks.team_llm_gateway_policy.update_team_llm_gateway_policy_cache")+ def test_update_task(self, mock_update):+ mock_update.return_value = True+ update_team_llm_gateway_policy_cache_task(self.team.id)+ self.assertEqual(mock_update.call_count, 1)+ self.assertEqual(mock_update.call_args[0][0].id, self.team.id)++ def test_update_task_missing_team_is_noop(self):+ update_team_llm_gateway_policy_cache_task(999999)+++class TestLLMGatewayPolicySignals(BaseTest):+ """Verify the cache is invalidated independently of the team_metadata cache."""++ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.transaction")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.settings")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.update_team_llm_gateway_policy_cache_task.delay")+ def test_team_save_enqueues_update(self, mock_delay, mock_settings, mock_transaction):+ mock_settings.FLAGS_REDIS_URL = "redis://localhost"+ mock_transaction.on_commit.side_effect = lambda fn: fn()++ self.team.llm_gateway_revoked_at = datetime(2026, 5, 20, 12, 0, 0, tzinfo=UTC)+ self.team.save()++ mock_delay.assert_called_with(self.team.id)++ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.settings")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.update_team_llm_gateway_policy_cache_task.delay")+ def test_team_save_noop_without_flags_redis_url(self, mock_delay, mock_settings):+ mock_settings.FLAGS_REDIS_URL = None++ self.team.llm_gateway_revoked_at = datetime(2026, 5, 20, 12, 0, 0, tzinfo=UTC)+ self.team.save()++ mock_delay.assert_not_called()++ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.settings")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.clear_team_llm_gateway_policy_cache")+ def test_team_delete_clears_cache(self, mock_clear, mock_settings):+ mock_settings.FLAGS_REDIS_URL = "redis://localhost"+ mock_settings.TEST = True++ team = Team.objects.create(organization=self.organization, name="Doomed")+ team.delete()++ mock_clear.assert_called_once()++ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.transaction")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.settings")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.clear_team_llm_gateway_policy_cache")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.update_team_llm_gateway_policy_cache_task.delay")+ def test_api_token_rotation_clears_old_token_cache(self, mock_delay, mock_clear, mock_settings, mock_transaction):+ """+ Rotating api_token must invalidate the cache keyed by the OLD token.+ Otherwise a holder of the rotated token keeps hitting the gateway via+ the stale cached policy until the 7-day TTL expires.+ """+ mock_settings.FLAGS_REDIS_URL = "redis://localhost"+ mock_settings.TEST = True+ mock_transaction.on_commit.side_effect = lambda fn: fn()++ old_token = self.team.api_token+ self.team.api_token = "phc_rotated_token_value"+ self.team.save()++ mock_delay.assert_called_with(self.team.id)+ mock_clear.assert_called_once_with(old_token, kinds=["redis"])++ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.transaction")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.settings")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.clear_team_llm_gateway_policy_cache")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.update_team_llm_gateway_policy_cache_task.delay")+ def test_unrelated_save_does_not_clear_cache(self, mock_delay, mock_clear, mock_settings, mock_transaction):+ """A save that touches neither api_token nor llm_gateway_revoked_at must+ not invalidate the cache; the async task still refreshes the blob."""+ mock_settings.FLAGS_REDIS_URL = "redis://localhost"+ mock_settings.TEST = True+ mock_transaction.on_commit.side_effect = lambda fn: fn()++ self.team.name = "Renamed"+ self.team.save()++ mock_delay.assert_called_with(self.team.id)+ mock_clear.assert_not_called()++ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.transaction")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.settings")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.clear_team_llm_gateway_policy_cache")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.update_team_llm_gateway_policy_cache_task.delay")+ def test_setting_revoked_at_clears_current_token_cache_on_commit(+ self, mock_delay, mock_clear, mock_settings, mock_transaction+ ):+ """+ Setting llm_gateway_revoked_at must invalidate the current token's+ cache entry synchronously on commit. The async refresh task can lag,+ so without a synchronous clear, the stale active policy stays usable+ for the full cache TTL and a holder of the token keeps hitting the+ gateway as if the team were active.+ """+ mock_settings.FLAGS_REDIS_URL = "redis://localhost"+ mock_settings.TEST = True+ mock_transaction.on_commit.side_effect = lambda fn: fn()++ self.team.llm_gateway_revoked_at = datetime(2026, 5, 28, 12, 0, 0, tzinfo=UTC)+ self.team.save()++ mock_delay.assert_called_with(self.team.id)+ mock_clear.assert_called_once_with(self.team, kinds=["redis"])++ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.transaction")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.settings")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.clear_team_llm_gateway_policy_cache")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.update_team_llm_gateway_policy_cache_task.delay")+ def test_chained_token_rotation_clears_each_old_token(+ self, mock_delay, mock_clear, mock_settings, mock_transaction+ ):+ """+ Two rotations on the same kept-alive instance (A->B->C) must clear A then+ B. post_save re-snapshots the saved token so the second save compares+ against B, instead of clearing A twice and leaking B for the full cache TTL.+ """+ mock_settings.FLAGS_REDIS_URL = "redis://localhost"+ mock_settings.TEST = True+ mock_transaction.on_commit.side_effect = lambda fn: fn()++ token_a = self.team.api_token++ self.team.api_token = "phc_rotated_b"+ self.team.save()++ self.team.api_token = "phc_rotated_c"+ self.team.save()++ cleared = [call.args[0] for call in mock_clear.call_args_list]+ self.assertEqual(cleared, [token_a, "phc_rotated_b"])++ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.transaction")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.settings")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.clear_team_llm_gateway_policy_cache")+ @patch("posthog.storage.team_llm_gateway_policy_signal_handlers.update_team_llm_gateway_policy_cache_task.delay")+ def test_deferred_api_token_load_still_clears_old_token_on_rotation(+ self, mock_delay, mock_clear, mock_settings, mock_transaction+ ):+ """+ A Team fetched with api_token deferred (.only() / .defer()) and then+ rotated must still clear the old token's cache entry. post_init skips the+ snapshot to avoid a lazy load; the pre_save fallback captures the old+ value from the DB before the UPDATE runs.+ """+ mock_settings.FLAGS_REDIS_URL = "redis://localhost"+ mock_settings.TEST = True+ mock_transaction.on_commit.side_effect = lambda fn: fn()++ old_token = self.team.api_token+ partial = Team.objects.only("id", "name").get(pk=self.team.pk)+ partial.api_token = "phc_rotated_deferred"+ partial.save()++ mock_delay.assert_called_with(self.team.id)+ mock_clear.assert_called_once_with(old_token, kinds=["redis"])diff --git a/posthog/storage/test/test_team_metadata_cache.py b/posthog/storage/test/test_team_metadata_cache.pyindex 110543e950b2..9cb1668e52e8 100644--- a/posthog/storage/test/test_team_metadata_cache.py+++ b/posthog/storage/test/test_team_metadata_cache.py@@ -583,3 +583,12 @@ class TestSampleRateSerializationForRustCompatibility(BaseTest):self.team.full_clean()self.assertIn("session_recording_sample_rate", str(context.exception))+++# llm-gateway policy projection lives in its own cache (see+# test_team_llm_gateway_policy_cache.py); we explicitly assert the field is NOT+# in the shared team_metadata blob so the flags-pipeline consumers stay+# unaffected by llm-gateway changes.+class TestLLMGatewayFieldsNotInSharedProjection(BaseTest):+ def test_llm_gateway_fields_excluded_from_shared_metadata(self):+ self.assertNotIn("llm_gateway_revoked_at", TEAM_METADATA_FIELDS)diff --git a/posthog/tasks/scheduled.py b/posthog/tasks/scheduled.pyindex 2e1760b89f24..ceca99725e10 100644--- a/posthog/tasks/scheduled.py+++ b/posthog/tasks/scheduled.py@@ -65,6 +65,7 @@ from posthog.tasks.tasks import (update_survey_iteration,verify_persons_data_in_sync,)+from posthog.tasks.team_llm_gateway_policy import refresh_expiring_llm_gateway_policy_cache_entriesfrom posthog.tasks.team_metadata import cleanup_stale_expiry_tracking_task, refresh_expiring_team_metadata_cache_entriesfrom posthog.utils import get_crontab, get_instance_region@@ -199,6 +200,13 @@ def setup_periodic_tasks(sender: Celery, **kwargs: Any) -> None:name="team metadata expiry tracking cleanup",)+ # LLM gateway policy cache sync - hourly at :05 to stagger from team_metadata at :00+ sender.add_periodic_task(+ crontab(hour="*", minute="5"),+ refresh_expiring_llm_gateway_policy_cache_entries.s(),+ name="llm-gateway policy cache sync",+ )+# Stale QUEUED task run cleanup - hourlyadd_periodic_task_with_expiry(sender,diff --git a/posthog/tasks/team_llm_gateway_policy.py b/posthog/tasks/team_llm_gateway_policy.pynew file mode 100644index 000000000000..85cad5758d20--- /dev/null+++ b/posthog/tasks/team_llm_gateway_policy.py@@ -0,0 +1,82 @@+"""+Celery tasks for the llm-gateway policy cache.++Independent of the team_metadata cache pipeline so the two caches can fail+(or be rolled back) without affecting each other. The signal handlers that+drive these tasks on Team changes live in+posthog/storage/team_llm_gateway_policy_signal_handlers.py.+"""++import time++from django.conf import settings++import structlog+from celery import shared_task++from posthog.models.team import Team+from posthog.scoping_audit import skip_team_scope_audit+from posthog.storage.hypercache_manager import HYPERCACHE_SIGNAL_UPDATE_COUNTER+from posthog.storage.team_llm_gateway_policy_cache import (+ get_cache_stats,+ refresh_expiring_caches,+ update_team_llm_gateway_policy_cache,+)+from posthog.tasks.utils import CeleryQueue++logger = structlog.get_logger(__name__)+++@shared_task(ignore_result=True, queue=CeleryQueue.DEFAULT.value)+@skip_team_scope_audit+def update_team_llm_gateway_policy_cache_task(team_id: int) -> None:+ try:+ team = Team.objects.get(id=team_id)+ except Team.DoesNotExist:+ logger.debug("Team does not exist for llm-gateway policy cache update", team_id=team_id)+ HYPERCACHE_SIGNAL_UPDATE_COUNTER.labels(+ namespace="team_llm_gateway_policy", operation="update", result="failure"+ ).inc()+ return++ success = update_team_llm_gateway_policy_cache(team)+ HYPERCACHE_SIGNAL_UPDATE_COUNTER.labels(+ namespace="team_llm_gateway_policy",+ operation="update",+ result="success" if success else "failure",+ ).inc()+++@shared_task(ignore_result=True, queue=CeleryQueue.DEFAULT.value)+def refresh_expiring_llm_gateway_policy_cache_entries() -> None:+ """+ Hourly task that refreshes policy cache entries whose TTL falls below the+ threshold, so simultaneous expiry of the 7-day TTL across the team pool+ cannot cause a DB-lookup spike.+ """+ if not settings.FLAGS_REDIS_URL:+ logger.info("Flags Redis URL not set, skipping llm-gateway policy cache refresh")+ return++ start_time = time.time()+ try:+ successful, failed = refresh_expiring_caches(ttl_threshold_hours=24)+ # get_cache_stats also pushes coverage/TTL gauges to Prometheus, matching+ # the team_metadata refresh task so the policy cache is observable too.+ stats_after = get_cache_stats()+ logger.info(+ "Completed llm-gateway policy cache refresh",+ successful_refreshes=successful,+ failed_refreshes=failed,+ total_cached=stats_after.get("total_cached", 0),+ cache_coverage=stats_after.get("cache_coverage", "unknown"),+ ttl_distribution=stats_after.get("ttl_distribution", {}),+ duration_seconds=time.time() - start_time,+ )+ except Exception as e:+ logger.exception(+ "Failed to complete llm-gateway policy cache refresh",+ error=str(e),+ duration_seconds=time.time() - start_time,+ )+ raisediff --git a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambrindex 25487460d8a0..9af3cf89b08b 100644--- a/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr+++ b/posthog/tasks/test/__snapshots__/test_process_scheduled_changes.ambr@@ -406,6 +406,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -594,6 +595,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1111,6 +1113,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1429,6 +1432,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",diff --git a/posthog/tasks/test/__snapshots__/test_task_registration.ambr b/posthog/tasks/test/__snapshots__/test_task_registration.ambrindex 48287e9ac13b..c50b7dc24528 100644--- a/posthog/tasks/test/__snapshots__/test_task_registration.ambr+++ b/posthog/tasks/test/__snapshots__/test_task_registration.ambr@@ -128,6 +128,8 @@'posthog.tasks.tasks.verify_persons_data_in_sync','posthog.tasks.team_access_cache_tasks.invalidate_token_cache_task','posthog.tasks.team_access_cache_tasks.invalidate_user_tokens_task',+ 'posthog.tasks.team_llm_gateway_policy.refresh_expiring_llm_gateway_policy_cache_entries',+ 'posthog.tasks.team_llm_gateway_policy.update_team_llm_gateway_policy_cache_task','posthog.tasks.team_metadata.cleanup_stale_expiry_tracking_task','posthog.tasks.team_metadata.refresh_expiring_team_metadata_cache_entries','posthog.tasks.team_metadata.update_team_metadata_cache_task',diff --git a/products/actions/backend/api/test/__snapshots__/test_action.ambr b/products/actions/backend/api/test/__snapshots__/test_action.ambrindex 5fefd3c34fb6..39e370d7f776 100644--- a/products/actions/backend/api/test/__snapshots__/test_action.ambr+++ b/products/actions/backend/api/test/__snapshots__/test_action.ambr@@ -134,6 +134,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -616,6 +617,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -748,6 +750,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",diff --git a/products/early_access_features/backend/test/__snapshots__/test_early_access_feature.ambr b/products/early_access_features/backend/test/__snapshots__/test_early_access_feature.ambrindex 30f0692393c6..d1dc78dbebf4 100644--- a/products/early_access_features/backend/test/__snapshots__/test_early_access_feature.ambr+++ b/products/early_access_features/backend/test/__snapshots__/test_early_access_feature.ambr@@ -89,6 +89,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -531,6 +532,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -668,6 +670,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",diff --git a/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr b/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambrindex 7b4f81c799ca..0d115ce66e49 100644--- a/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr+++ b/products/feature_flags/backend/api/test/__snapshots__/test_feature_flag.ambr@@ -555,6 +555,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -879,6 +880,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1082,6 +1084,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1276,6 +1279,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1584,6 +1588,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1842,6 +1847,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -2099,6 +2105,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -2203,6 +2210,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -2407,6 +2415,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",diff --git a/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambr b/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambrindex 823de0ec8651..4e64084fae61 100644--- a/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambr+++ b/products/feature_flags/backend/api/test/__snapshots__/test_organization_feature_flag.ambr@@ -134,6 +134,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -322,6 +323,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -615,6 +617,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -780,6 +783,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -945,6 +949,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1041,6 +1046,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1448,6 +1454,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1581,6 +1588,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1685,6 +1693,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1802,6 +1811,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1921,6 +1931,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -2048,6 +2059,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -2283,6 +2295,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -2418,6 +2431,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -2551,6 +2565,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -2664,6 +2679,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -2895,6 +2911,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",diff --git a/products/product_analytics/backend/api/test/__snapshots__/test_insight.ambr b/products/product_analytics/backend/api/test/__snapshots__/test_insight.ambrindex e2f1e1c927bc..2f0644df5f23 100644--- a/products/product_analytics/backend/api/test/__snapshots__/test_insight.ambr+++ b/products/product_analytics/backend/api/test/__snapshots__/test_insight.ambr@@ -536,6 +536,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -669,6 +670,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -814,6 +816,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -918,6 +921,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1103,6 +1107,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1235,6 +1240,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1621,6 +1627,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -1941,6 +1948,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",@@ -2364,6 +2372,7 @@"posthog_team"."autocapture_exceptions_opt_in","posthog_team"."autocapture_exceptions_errors_to_ignore","posthog_team"."logs_settings",+ "posthog_team"."llm_gateway_revoked_at","posthog_team"."heatmaps_opt_in","posthog_team"."receive_org_level_activity_logs","posthog_team"."web_analytics_pre_aggregated_tables_enabled",