From a59a236f46a793a7ed284c3dcfd69a4b94eac710 Mon Sep 17 00:00:00 2001 From: Pawel Szczur Date: Wed, 1 Jul 2026 17:37:26 +0200 Subject: [PATCH] chore(clickhouse): sanity-check ai_events convergence gate (expected to fail CI) Deliberate negative test: ALTER sharded_ai_events to add a column on NodeRole.AI_EVENTS, with NO matching HCL golden change. The multinode smoke's convergence gate should introspect the ai_events node, see the extra column against golden/local-ai_events.hcl, and fail check-live. Not for merge. --- .../migrations/0285_ai_events_gate_drift_check.py | 11 +++++++++++ posthog/clickhouse/migrations/max_migration.txt | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 posthog/clickhouse/migrations/0285_ai_events_gate_drift_check.py diff --git a/posthog/clickhouse/migrations/0285_ai_events_gate_drift_check.py b/posthog/clickhouse/migrations/0285_ai_events_gate_drift_check.py new file mode 100644 index 000000000000..5dfd8d97ffd5 --- /dev/null +++ b/posthog/clickhouse/migrations/0285_ai_events_gate_drift_check.py @@ -0,0 +1,11 @@ +from posthog.clickhouse.client.connection import NodeRole +from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions + +operations = [ + run_sql_with_exceptions( + "ALTER TABLE sharded_ai_events ADD COLUMN IF NOT EXISTS gate_drift_sanity_check UInt8 DEFAULT 0", + node_roles=[NodeRole.AI_EVENTS], + sharded=False, + is_alter_on_replicated_table=True, + ), +] diff --git a/posthog/clickhouse/migrations/max_migration.txt b/posthog/clickhouse/migrations/max_migration.txt index a756096508b9..6e251dc73e33 100644 --- a/posthog/clickhouse/migrations/max_migration.txt +++ b/posthog/clickhouse/migrations/max_migration.txt @@ -1 +1 @@ -0284_message_assets +0285_ai_events_gate_drift_check \ No newline at end of file