Skip to content

Commit e808676

Browse files
committed
gate: assert gate binary's commit hash matches HEAD
Companion to f3271f5 (cp-without-||-true). The cp fix prevents ONE class of stale-binary contamination (busy file → silent fallback). It does NOT prevent every class — a stale build that wasn't rebuilt after pull, a wrong working-tree state at build time, or a corrupted ${PYTHON} binary all still produce a ${PYTHON}_gate that doesn't correspond to HEAD. Fix: extract sys.version from the gate binary, grep for the short HEAD hash, abort if absent. 'GATE PASS commit X' now carries its own falsifier — without BINARY_MATCH in the transcript, the verdict is unreliable. Per theologian 2026-04-22 00:43:35Z architectural framing: the underlying issue was unfalsifiability of the PASS verdict. This step makes the verdict structurally falsifiable.
1 parent f3271f5 commit e808676

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

scripts/gate_phoenix.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,28 @@ rm -f "${PYTHON}_gate"
8484
cp "$PYTHON" "${PYTHON}_gate"
8585
PYTHON="${PYTHON}_gate"
8686

87+
# Step 1a: Binary identity verification (per theologian 2026-04-22 00:43:35Z).
88+
# Even with the cp-without-||-true fix, downstream failure modes can still
89+
# produce a binary that does not correspond to HEAD (stale build that wasn't
90+
# rebuilt after pull, wrong working-tree state at build time, etc.). Make
91+
# 'GATE PASS commit X' falsifiable: prove the gate binary actually reports
92+
# commit X in its --version output before any test runs.
93+
echo "" | tee -a "$RESULTS_FILE"
94+
echo "--- Step 1a: Gate Binary Identity ---" | tee -a "$RESULTS_FILE"
95+
GATE_BINARY_VERSION=$("$PYTHON" --version 2>&1)
96+
echo "$GATE_BINARY_VERSION" | tee -a "$RESULTS_FILE"
97+
# Long-form version output ($PYTHON -c 'import sys; print(sys.version)') carries
98+
# the commit hash; --version only carries '3.12.13'. Use sys.version.
99+
GATE_BINARY_LONG_VERSION=$("$PYTHON" -c 'import sys; print(sys.version)' 2>&1)
100+
echo "$GATE_BINARY_LONG_VERSION" | tee -a "$RESULTS_FILE"
101+
if echo "$GATE_BINARY_LONG_VERSION" | grep -q "$COMMIT_HASH"; then
102+
echo "BINARY_MATCH: gate binary reports $COMMIT_HASH" | tee -a "$RESULTS_FILE"
103+
else
104+
echo "BINARY_MISMATCH: gate binary does not contain HEAD hash $COMMIT_HASH" | tee -a "$RESULTS_FILE"
105+
echo "GATE FAIL — gate binary identity does not match HEAD" | tee -a "$RESULTS_FILE"
106+
exit 1
107+
fi
108+
87109
# Step 1b: _reg usage policy gate (no-FS DeoptBase factories banned in simplify_c.c)
88110
echo "" | tee -a "$RESULTS_FILE"
89111
echo "--- Step 1b: _reg Usage Policy ---" | tee -a "$RESULTS_FILE"

0 commit comments

Comments
 (0)