Skip to content

: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.

chore(clickhouse): bump hclexp pin to sha-5eadb87 (#71918)

Paweł Szczur0ebd2a987d0b
diff --git a/posthog/clickhouse/hcl/bin/hclexp b/posthog/clickhouse/hcl/bin/hclexp
index b42d42a2d4d9..620d1a89a4b2 100755
--- a/posthog/clickhouse/hcl/bin/hclexp
+++ b/posthog/clickhouse/hcl/bin/hclexp
@@ -1,13 +1,18 @@
#!/usr/bin/env bash
# Wrapper for the `hclexp` declarative ClickHouse schema tool (../python-clickhouse-schema).
#
-# Resolution order:
-# 1. $HCLEXP_BIN — explicit path to a local hclexp binary
-# 2. `hclexp` on $PATH
-# 3. the pinned container image (CI default)
+# Resolution order, most explicit first:
+# 1. $HCLEXP_BIN — that binary (explicit: a local build, for fast iteration)
+# 2. $HCLEXP_IMAGE — that image (explicit: trying another pin)
+# 3. bin/image.txt — the pin. The default, and what CI runs.
#
-# CI uses the container image; locals can point HCLEXP_BIN at a built binary
-# (`go build -o hclexp ./cmd/hclexp` in the sibling repo) for faster iteration.
+# An `hclexp` on $PATH is deliberately NOT consulted. It used to win over both the
+# pin and an explicit $HCLEXP_IMAGE, which meant `HCLEXP_IMAGE=<new> bin/hclexp ...`
+# silently ran whatever stale binary happened to be installed. That is not a loud
+# failure — it is a wrong answer, and it cost real time: a released hclexp feature
+# looked missing because an ambient build shadowed the image being tested. Goldens
+# are canonicalization-sensitive, so "whatever is on PATH" is exactly what a pin
+# exists to prevent. Use $HCLEXP_BIN to say so on purpose.
set -euo pipefail
# Pinned to a concrete build (not :latest) for reproducibility, in bin/image.txt
@@ -19,10 +24,6 @@ if [[ -n "${HCLEXP_BIN:-}" ]]; then
exec "$HCLEXP_BIN" "$@"
fi
-if command -v hclexp >/dev/null 2>&1; then
- exec hclexp "$@"
-fi
-
# Mount the repo (relative layer/golden paths resolve under -w /work) and the temp
# dir (diff.sh/gen-sql.sh/the generator pass absolute committed-tree and scratch paths
# under $TMPDIR) so both resolve inside the container.
diff --git a/posthog/clickhouse/hcl/bin/image.txt b/posthog/clickhouse/hcl/bin/image.txt
index e18385364b24..316eb9f0d637 100644
--- a/posthog/clickhouse/hcl/bin/image.txt
+++ b/posthog/clickhouse/hcl/bin/image.txt
@@ -1 +1 @@
-ghcr.io/posthog/chschema:sha-de64883
+ghcr.io/posthog/chschema:sha-5eadb87
diff --git a/posthog/clickhouse/hcl/golden/local-multi/data.hcl b/posthog/clickhouse/hcl/golden/local-multi/data.hcl
index 5f17b63e196a..553a899a658b 100644
--- a/posthog/clickhouse/hcl/golden/local-multi/data.hcl
+++ b/posthog/clickhouse/hcl/golden/local-multi/data.hcl
@@ -1715,7 +1715,7 @@ database "posthog" {
type = "Bool"
}
index "is_deleted_idx" {
- expr = "(is_deleted)"
+ expr = "is_deleted"
type = "minmax"
granularity = 1
}
@@ -3256,7 +3256,7 @@ database "posthog" {
}
column "version" {
type = "UInt64"
- materialized = "(bitShiftLeft(toUInt64(NOT isNull(property_type)), 48) + toUInt64(toUnixTimestamp(last_seen_at)))"
+ materialized = "bitShiftLeft(toUInt64(NOT isNull(property_type)), 48) + toUInt64(toUnixTimestamp(last_seen_at))"
}
engine "replicated_replacing_merge_tree" {
zoo_path = "/clickhouse/tables/noshard/posthog.property_definitions"
@@ -5159,7 +5159,7 @@ database "posthog" {
granularity = 1
}
index "is_deleted_idx" {
- expr = "(is_deleted)"
+ expr = "is_deleted"
type = "minmax"
granularity = 1
}
@@ -5194,7 +5194,7 @@ database "posthog" {
granularity = 1
}
index "minmax_historical_migration" {
- expr = "(historical_migration)"
+ expr = "historical_migration"
type = "minmax"
granularity = 1
}
@@ -11317,8 +11317,8 @@ SQL
view "persons_batch_export" {
query = <<SQL
WITH
- new_persons AS (SELECT id, max(version) AS version, argMax(_timestamp, person.version) AS _timestamp2 FROM posthog.person WHERE (team_id = {team_id: Int64}) AND (id IN (SELECT id FROM posthog.person WHERE (team_id = {team_id: Int64}) AND (_timestamp >= {interval_start: DateTime64}) AND (_timestamp < {interval_end: DateTime64}))) GROUP BY id HAVING ((_timestamp2 >= {interval_start: DateTime64}) AND (_timestamp2 < {interval_end: DateTime64}))),
- new_distinct_ids AS (SELECT argMax(person_id, person_distinct_id2.version) AS person_id FROM posthog.person_distinct_id2 WHERE (team_id = {team_id: Int64}) AND (distinct_id IN (SELECT distinct_id FROM posthog.person_distinct_id2 WHERE (team_id = {team_id: Int64}) AND (_timestamp >= {interval_start: DateTime64}) AND (_timestamp < {interval_end: DateTime64}))) GROUP BY distinct_id HAVING ((argMax(_timestamp, person_distinct_id2.version) >= {interval_start: DateTime64}) AND (argMax(_timestamp, person_distinct_id2.version) < {interval_end: DateTime64}))),
+ new_persons AS (SELECT id, max(version) AS version, argMax(_timestamp, person.version) AS _timestamp2 FROM posthog.person WHERE (team_id = {team_id: Int64}) AND (id IN (SELECT id FROM posthog.person WHERE (team_id = {team_id: Int64}) AND (_timestamp >= {interval_start: DateTime64}) AND (_timestamp < {interval_end: DateTime64}))) GROUP BY id HAVING (_timestamp2 >= {interval_start: DateTime64}) AND (_timestamp2 < {interval_end: DateTime64})),
+ new_distinct_ids AS (SELECT argMax(person_id, person_distinct_id2.version) AS person_id FROM posthog.person_distinct_id2 WHERE (team_id = {team_id: Int64}) AND (distinct_id IN (SELECT distinct_id FROM posthog.person_distinct_id2 WHERE (team_id = {team_id: Int64}) AND (_timestamp >= {interval_start: DateTime64}) AND (_timestamp < {interval_end: DateTime64}))) GROUP BY distinct_id HAVING (argMax(_timestamp, person_distinct_id2.version) >= {interval_start: DateTime64}) AND (argMax(_timestamp, person_distinct_id2.version) < {interval_end: DateTime64})),
all_new_persons AS (SELECT id, version FROM new_persons UNION ALL SELECT id, max(version) FROM posthog.person WHERE (team_id = {team_id: Int64}) AND (id IN (new_distinct_ids)) GROUP BY id)
SELECT
p.team_id AS team_id,