#!/usr/bin/env bash # CHECK-q150 -- the volt lane's verifier census, graded at the rev it was taken at. # # WHAT WAS WRONG # q63_verify_scan.py enumerated the verifier population with # r"/verify_.*\.py$" -- a SLASH was required -- while q65_runner.py matches # the BASENAME of every tracked path. Two instruments, two populations. A # verifier committed at the repo root (verify_wordcount.py, beam lane, # ef83d3d) was therefore in the runner's audit and invisible to the census, # so `--check` printed an UNCLASSED fault that no census row could clear: # the row cannot exist for a file the scan cannot see. Measured at fe23317, # this scan said "196 committed verify_*.py", rev_files said 197. # # WHAT THIS GRADES # 1. the scanner's cells, including the root-population cell added here; # 2. the population at the PIN: every committed verifier carries a census # row, no UNCLASSED, no NEW-UNWIRED; # 3. the runner ledger at the PIN: coverage, blob binding, verdict-vs-rc; # 4. the rc-probe ledger at the PIN: content-bound and class-consistent; # 5. no committed verifier prints a PASS it cannot fail; # 6. the root-population cell is NOT vacuous: the pre-fix regex reds it. # # WHY A PIN AND NOT HEAD # A census is a statement about a tree at a rev (Q147's rule, one lane over). # Other lanes land verifiers while a tick runs -- measured this tick: the # population went 195 -> 196 -> 197 inside ~15 minutes -- so a HEAD-graded # census re-reds by construction. The drift past the pin is printed as an # advisory and does not move the verdict. # # rc 0 every leg holds rc 1 a leg failed rc 2 could not grade set -u ROOT="$(git -C "$(dirname "$0")" rev-parse --show-toplevel 2>/dev/null)" || exit 2 [ -n "$ROOT" ] || exit 2 cd "$ROOT" || exit 2 HERE="wizard-work/volt/q150" PIN="$(cat "$HERE/PIN" 2>/dev/null)" || PIN="" [ -n "$PIN" ] || { echo "FAIL pin no $HERE/PIN"; exit 2; } git rev-parse --verify "$PIN^{commit}" >/dev/null 2>&1 || { echo "FAIL pin $PIN does not resolve"; exit 2; } legs=0; faults=0 leg() { # leg legs=$((legs + 1)) if [ "$2" -eq 0 ]; then printf 'PASS %-18s %s\n' "$1" "$3" else printf 'FAIL %-18s %s\n' "$1" "$3"; faults=$((faults + 1)); fi } out="$(python3 wizard-work/volt/q63_verify_scan.py --selftest 2>&1)"; rc=$? leg selftest "$rc" "$(printf '%s' "$out" | grep -m1 '^selftest:')" out="$(python3 wizard-work/volt/q63_verify_scan.py --repo . --rev "$PIN" 2>&1)"; rc=$? cov="$(printf '%s' "$out" | sed -n 's/^ census coverage *: //p' | head -1)" unc="$(printf '%s' "$out" | grep -c 'UNCLASSED ')" new="$(printf '%s' "$out" | grep -c 'NEW_UNWIRED ')" strip="$(printf '%s' "$out" | grep -c 'STRIPPED_ASSERT ')" a="${cov%% of *}"; b="${cov#* of }"; b="${b%% *}" if [ "$a" = "$b" ] && [ -n "$a" ] && [ "$unc" -eq 0 ] && [ "$new" -eq 0 ]; then crc=0 else crc=1; fi leg census-at-pin "$crc" "coverage ${cov:-unreadable}; UNCLASSED $unc; NEW-UNWIRED $new" out="$(python3 wizard-work/volt/q65_runner.py --repo . --rev "$PIN" --check \ --class gate-run,undeclared 2>&1)"; rc=$? leg runner-ledger "$rc" "$(printf '%s' "$out" | grep -m1 '^q65:')" out="$(python3 wizard-work/volt/q65_rc_probe.py --repo . --rev "$PIN" --check 2>&1)"; rc=$? leg rc-probe "$rc" "$(printf '%s' "$out" | grep -m1 'fault(s)')" out="$(python3 wizard-work/volt/q65_no_verdict.py --repo . --check 2>&1)"; rc=$? leg no-verdict "$rc" "$(printf '%s' "$out" | grep -m1 'fault(s)')" tmp="$(mktemp -d "${TMPDIR:-/tmp}/q150-mut-XXXX")" || exit 2 if python3 "$HERE/mutate_regex.py" wizard-work/volt/q63_verify_scan.py \ "$tmp/mut.py" >/dev/null 2>&1; then mout="$(python3 "$tmp/mut.py" --selftest 2>&1)"; mrc=$? if printf '%s' "$mout" | grep -q 'FAIL a repo-root verifier is in the population' \ && [ "$mrc" -ne 0 ]; then leg mutant 0 "pre-fix regex reds the root cell" else leg mutant 1 "mutant did not red the root cell (rc=$mrc)"; fi else leg mutant 2 "could not build the pre-fix mutant" fi rm -rf "$tmp" n_pin="$(git ls-tree -r --name-only "$PIN" | grep -cE '(^|/)verify_[^/]*\.py$')" n_head="$(git ls-tree -r --name-only HEAD | grep -cE '(^|/)verify_[^/]*\.py$')" echo "advisory: HEAD $(git rev-parse --short HEAD) is past the pin $PIN --" echo " verifiers at pin $n_pin, at HEAD $n_head (advisory only)" echo "residual: $strip verifier(s) whose only failure path is a bare assert" echo " (STRIPPED_ASSERT, pre-existing at entry): not this item's class" if [ "$faults" -eq 0 ]; then echo "q150: $legs leg(s), all passed"; exit 0; fi echo "q150: $legs leg(s), $faults fault(s)" exit 1