From f67bbe954f1cd5f2765ccebd540970674ac2d036 Mon Sep 17 00:00:00 2001 From: pi-prs Date: Sun, 15 Nov 2026 06:53:04 -0400 Subject: [PATCH] hw-gate: an absent input is a SKIP row, not a FAIL row (engine#2501) The gate already classified these correctly at the EXIT CODE -- infra=1 makes any run with a missing input exit 2 -- but the ROW said FAIL, and the row is what a human reads. So every PR showed a FAIL row on main's own pin for a model that was deliberately removed from the runner, and nobody could fix it from inside a PR. result kld FAIL 0 "text missing: $TEXT" -> SKIP 0 "text missing (input absent): ..." result "model $name" FAIL 0 "model missing: $model" -> SKIP 0 "model missing (input absent): ..." infra=1 stays on both. SKIP alone would let a run with no models at all read as a clean pass with nothing to do, and infra=1 -> exit 2 is what keeps "I ran nothing" distinguishable from "all passed". That is #375's 267-skipped-cases-with-rc-0 from the other direction: a skip must not succeed either. The third FAIL site next to these is deliberately NOT touched: `result "kld $name" FAIL ...` reports a verify MISMATCH, which is the gate working. A sed over all three would retire the row that catches real drift, so tests/hw_gate_test.py asserts it stays FAIL. script_invariants() gains three assertions, text-scanned like the engine#682 lock placement beside them: - both absent-input rows exist, are SKIP, and keep infra=1 (a renamed row fails rather than passes) - the KLD mismatch row is still FAIL Mutation-checked both ways: reverting `model missing` to FAIL gives FAIL: "model missing must be SKIP, not FAIL: an absent input is not a result (engine#2501) and flipping the KLD row to SKIP gives FAIL: the KLD mismatch row must stay FAIL: a verify mismatch is a result, not an absent input With both correct: hw_gate_test: PASS. --- scripts/hw-gate.sh | 4 ++-- tests/hw_gate_test.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/scripts/hw-gate.sh b/scripts/hw-gate.sh index 51c46f447..de6894237 100755 --- a/scripts/hw-gate.sh +++ b/scripts/hw-gate.sh @@ -631,11 +631,11 @@ fi # ---- kat + needle + KLD: one step per model ----------------------------------------------- if has kat || has needle || has kld; then - [ -f "$TEXT" ] || { has kld && { result kld FAIL 0 "text missing: $TEXT"; infra=1; }; } + [ -f "$TEXT" ] || { has kld && { result kld SKIP 0 "text missing (input absent): $TEXT"; infra=1; }; } while IFS='|' read -r name file repeat donee srvargs; do want_model "$name" || continue model=$MODELS/$file base=$STORE/kld/$name.kld - if [ ! -f "$model" ]; then result "model $name" FAIL 0 "model missing: $model"; infra=1; continue; fi + if [ ! -f "$model" ]; then result "model $name" SKIP 0 "model missing (input absent): $model"; infra=1; continue; fi dokat=0; has kat && dokat=1 needle=0; [ "$donee" = 1 ] && has needle && needle=1 dokld=0; has kld && [ -f "$TEXT" ] && [ -z "$srvargs" ] && dokld=1 diff --git a/tests/hw_gate_test.py b/tests/hw_gate_test.py index 4609ad87b..acf63d7e7 100644 --- a/tests/hw_gate_test.py +++ b/tests/hw_gate_test.py @@ -103,6 +103,22 @@ def script_invariants(): npu = src.find("if has npu;") if npu < 0 or "flock" not in src[npu:]: bad.append("the NPU phase must still hold ~/npu.lock: an NPU dispatch must not overlap another") + # engine#2501: an absent INPUT is a SKIP row, not a FAIL row. The exit code already said so + # (infra=1 -> exit 2), but the row is what a human reads, and it said FAIL on something nobody can + # fix -- so every PR went red on main's own pin. A `sed` over all three FAILs would also flip the + # KLD row, and that one is a RESULT: asserted below to stay FAIL. + for absent in ('"model missing', '"text missing'): + i = src.find(absent) + if i < 0: # renamed or removed: fail rather than pass over nothing + bad.append(f"no {absent} row found: the absent-input rows must exist and be SKIP") + continue + line = src[src.rfind(chr(10), 0, i) + 1:src.find(chr(10), i)] + if " SKIP " not in line: + bad.append(f"{absent} must be SKIP, not FAIL: an absent input is not a result (engine#2501)") + if "infra=1" not in line: # SKIP alone would let "ran nothing" look like "all passed" + bad.append(f"{absent} must keep infra=1, so a run with no inputs still exits 2") + if src.find('result "kld $name" FAIL') < 0: + bad.append("the KLD mismatch row must stay FAIL: a verify mismatch is a result, not an absent input") return bad