#!/usr/bin/env python3 # check.sh -- one bare command whose exit code IS the verdict (0 = correct, nonzero = wrong). # # It asserts, from the artifact copy in this directory, the three things this lane claimed: # 1. the full differential battery agrees with sqlite3 AND catches all 8 seeded mutants # (it caught only 7/8 before the fix, with and-null-absorbs-false surviving); # 2. the NULL-tri-value families the mutant depends on actually FIRE (measured, not assumed); # 3. the regression guards hold. # # Run: bash /root/.hermes/wizard-outputs/null/minisql/check.sh # (also works: bash /root/troupe-standup/wizard-work/null/minisql/check.sh) set -u cd "$(dirname "$0")" rc=0 run() { name="$1"; shift if out=$("$@" 2>&1); then echo "ok $name" else rc=1 echo "FAIL $name (exit $?)" echo "$out" | tail -20 fi } # 1. battery + mutation control. 1400 mutant queries so every shape gets a 200-query slice. python3 diff_sqlite.py --queries 1400 --mutants --mutant-queries 1400 --quiet if [ $? -eq 0 ]; then echo "ok battery: 1400 queries agree with sqlite3, 8/8 mutants caught" else rc=1; echo "FAIL battery: mutant survived or mismatch"; fi # 2. the mutants must genuinely be caught -- not merely reported. python3 - <<'PY' || rc=1 import sys sys.path.insert(0, ".") import diff_sqlite as D res = D.run_mutants(1400, 20261022, quiet=True) survived = [n for n, _a, c in res if not c] print(" mutants caught: %d/%d" % (len(res) - len(survived), len(res))) if survived: print("FAIL mutants survived: " + ", ".join(survived)) sys.exit(1) PY # 3. NULL-tri-value families fire (the previously-assumed-and-false invariant). run "probes_null_logic" python3 probes_null_logic.py --queries 2100 --mutant-queries 1400 # 4. regression guards. run "guards" python3 test_diff_sqlite_guards.py # 5. the teeth check: a thin slice must be refused, and an undetected mutant must be caught. python3 - <<'PY' || rc=1 import sys sys.path.insert(0, ".") import diff_sqlite as D rep = {"queries": 28, "seed": 0, "shape_counts": dict.fromkeys(D.SHAPES, 4), "rows_compared": 30, "nonempty": 20, "ordered": 20, "mismatches": [], "errors": []} if not any("thin slice" in b for b in D.check_report(rep)): print("FAIL check_report accepted a thin slice") sys.exit(1) def mutant_and(a, b): ta, tb = D.minisql.tri(a), D.minisql.tri(b) if ta is None or tb is None: return None return 0 if (ta == 0 or tb == 0) else 1 orig = D.minisql._tri_and D.minisql._tri_and = mutant_and try: caught = len(D.run_battery(1400, 20261022, max_print=0, quiet=True)["mismatches"]) finally: D.minisql._tri_and = orig print(" and-null-absorbs-false caught with %d mismatches" % caught) if not caught: print("FAIL the mutant that survived before the fix is still not caught") sys.exit(1) PY if [ $rc -eq 0 ]; then echo; echo "VERDICT: correct"; else echo; echo "VERDICT: wrong"; fi exit $rc