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): record hclexp -version in live schema dump (#69317)

Paweł Szczur41c77564d694
diff --git a/posthog/clickhouse/hcl/README.md b/posthog/clickhouse/hcl/README.md
index ffb136a58d26..2d9950d66cc4 100644
--- a/posthog/clickhouse/hcl/README.md
+++ b/posthog/clickhouse/hcl/README.md
@@ -50,7 +50,9 @@ The convergence gate closes it, in **two steps** that run inside the multinode m
1. **`dump-live.sh [outdir]`** — `hclexp introspect` each managed role's live node into
`<outdir>/<env>-<role>.hcl`, dropping unmanaged / transient objects via `exclude.hcl`. Needs the
- cluster (a `--network host` container, or `HCLEXP_BIN` locally).
+ cluster (a `--network host` container, or `HCLEXP_BIN` locally). Also writes
+ `<outdir>/hclexp-version.txt` (`hclexp -version`) recording the tool build that produced the dump —
+ informational provenance, not gated by `check-live.sh`.
2. **`check-live.sh <dumpdir>`** — for each role, `hclexp diff -format json` the committed
`golden/<env>-<role>.hcl` against the dump, drop the ignored operations (named_collections +
`exclude.hcl` globs), and require nothing left. Offline — only needs `hclexp`.
diff --git a/posthog/clickhouse/hcl/dump-live.sh b/posthog/clickhouse/hcl/dump-live.sh
index 09f1cb6245e3..452f2755576a 100755
--- a/posthog/clickhouse/hcl/dump-live.sh
+++ b/posthog/clickhouse/hcl/dump-live.sh
@@ -59,6 +59,13 @@ run_hclexp() {
docker run --rm --network host -v "$PWD:/work" -v "$tmp:$tmp" -w /work "$HCLEXP_IMAGE" "$@"
}
+# Record the hclexp build that produced this dump (informational provenance; not
+# gated by check-live). Best-effort: an image predating `-version` must not fail
+# the dump, so keep it off the rc path.
+run_hclexp -version > "$OUTDIR/hclexp-version.txt" 2>&1 \
+ || echo "WARN: hclexp -version unavailable (older image?) — see $OUTDIR/hclexp-version.txt" >&2
+chmod 0644 "$OUTDIR/hclexp-version.txt" 2>/dev/null || true
+
rc=0
for spec in "${ROLES[@]}"; do
read -r role dhost dport ddb <<<"$spec"