#!/usr/bin/env bash # CHECK-q147 -- the workqueue census is graded at its pin, all four columns. # # Q147 (2026-11-01): `wizard-work/ledger/workqueue-census/CHECK` asserted that # the committed TSV re-derives from WORK-QUEUE.md as it stands on disk. Measured # at 50cc5bb in a clean clone: rc 1, `expected 96 headings, got 97` -- the check # graded the calendar, not the artifact. Measured at 95b6964: a mutated `status` # cell and a mutated `done_implies` cell both printed PASS (rc 0), because only # the (q,title) pairs were compared. The repair pins the census at 95b6964, # grades every column, and refuses to grade at all without a rev. # # leg 1 the verifier's 13-cell selftest # leg 2 the artifact at its pin: 17 legs, all four columns, rc 0 # leg 3 the tooling names no host path (a check that hardcodes /root/ grades # the author's worktree from any checkout -- Q69's class) # leg 4 the q143 baseline row still reads what this tree reads # # rc 0 all legs pass, rc 1 a leg faulted, rc 2 could not grade. set -u HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || { echo "CANNOT GRADE: no directory"; exit 2; } ROOT="$(git -C "$HERE" rev-parse --show-toplevel 2>/dev/null)" || { echo "CANNOT GRADE: not a git repository"; exit 2; } [ -n "$ROOT" ] || { echo "CANNOT GRADE: no git toplevel"; exit 2; } ART="$ROOT/wizard-work/ledger/workqueue-census" TOOL="$ART/verify_workqueue_census.py" [ -f "$TOOL" ] || { echo "CANNOT GRADE: missing $TOOL"; exit 2; } faults=0 pass() { echo "PASS $1"; } fail() { echo "FAIL $1"; faults=$((faults+1)); } # leg 1 -- the selftest if python3 "$TOOL" --selftest >/tmp/q147-selftest.$$ 2>&1; then pass "selftest $(tail -1 /tmp/q147-selftest.$$ | sed 's/selftest: //')" else fail "selftest"; tail -3 /tmp/q147-selftest.$$ fi rm -f /tmp/q147-selftest.$$ # leg 2 -- the artifact at its pin out="$(python3 "$TOOL" --check --repo "$ROOT" 2>&1)"; rc=$? case "$rc" in 0) pass "artifact $(echo "$out" | tail -1 | sed 's/VERDICT: //')" ;; 1) fail "artifact rc=1"; echo "$out" | grep '^FAIL' | head -3 ;; *) fail "artifact rc=$rc (could not grade)"; echo "$out" | tail -2 ;; esac # leg 3 -- no host path in the tooling it grades itself with if grep -n '/root/' "$TOOL" "$ART/CHECK" "$ART/extract_workqueue_census.py" >/tmp/q147-host.$$ 2>&1; then fail "host path in the tooling"; head -3 /tmp/q147-host.$$ else pass "tooling names no host path" fi rm -f /tmp/q147-host.$$ # leg 4 -- the baseline row agrees with what this tree reads BASE="$ROOT/wizard-work/volt/q143-check-sweep/check_entry_baseline.tsv" row="$(grep -P '^wizard-work/ledger/workqueue-census/CHECK\t' "$BASE" 2>/dev/null)" if [ -z "$row" ]; then fail "baseline row missing" elif [ "$(printf '%s' "$row" | cut -f2)" = "0" ]; then pass "baseline row rc=0" else fail "baseline row rc=$(printf '%s' "$row" | cut -f2)" fi echo "q147: $((4-faults)) of 4 leg(s) passed" [ "$faults" -eq 0 ] || exit 1 exit 0