From d2b13ec412705eb0d2475b1d463ce50eb779c236 Mon Sep 17 00:00:00 2001 From: zzstoatzz Date: Sat, 3 Oct 2026 10:28:09 -0700 Subject: [PATCH] admit: run with the zig version build.zig.zon declares the gate host's default zig is 0.16, which other projects built there still need, so the first gate run on the 0.17 tree died inside the lifecycle oracle on a 0.17 build script. `admit run` now puts STREAM_ZIG_DIR, or ~/.local/opt/zig--linux-, ahead of PATH and refuses to start when `zig version` does not match minimum_zig_version. `verify` and `publish` are untouched; they run where no compiler exists. Co-Authored-By: Claude Opus 5.5 (1M context) --- scripts/admit | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scripts/admit b/scripts/admit index d06c0b7..cb0a5b0 100755 --- a/scripts/admit +++ b/scripts/admit @@ -23,6 +23,7 @@ set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")/.." ROOT="$PWD" + RECEIPTS="${STREAM_RECEIPTS_DIR:-$ROOT/receipts}" IMAGE_REPO="${STREAM_IMAGE_REPO:-atcr.io/zat.dev/stream}" # Registry auth is the caller's problem: `publish` needs a docker login for @@ -36,6 +37,25 @@ note() { printf '\033[1m==> %s\033[0m\n' "$*" >&2; } # Receipts are outputs, not source. A run writes its own receipt into the repo, # so counting it as drift would make every completed run look dirty. +# The gate host's default zig also serves projects on other compiler versions, +# so a run picks the compiler this tree declares instead of whatever `zig` +# resolves to: STREAM_ZIG_DIR, else the conventional per-version install. +# A mismatch stops here rather than failing somewhere inside the first suite. +# Only `run` compiles on the host; `verify` runs where no compiler exists. +select_zig() { + local want have zig_dir + want=$(sed -n 's/.*\.minimum_zig_version = "\([^"]*\)".*/\1/p' build.zig.zon) + for zig_dir in "${STREAM_ZIG_DIR:-}" "$HOME/.local/opt/zig-$(uname -m)-linux-$want"; do + if [[ -n "$zig_dir" && -x "$zig_dir/zig" ]]; then + export PATH="$zig_dir:$PATH" + break + fi + done + have=$(zig version 2>/dev/null || echo none) + [[ "$have" == "$want" ]] || die "build.zig.zon requires zig $want but \`zig\` is $have;" \ + "install it under ~/.local/opt/zig-$(uname -m)-linux-$want or set STREAM_ZIG_DIR" +} + tree_drift() { git status --porcelain -- ':!receipts'; } require_clean_tree() { @@ -231,6 +251,7 @@ cmd_build() { } cmd_run() { + select_zig require_clean_tree local sha sha_full stamp receipt log_dir suites_json revisions image_id tag sha=$(git rev-parse --short HEAD) -- 2.51.2