Files
volt 5b58317a43 q147: grade the workqueue census at its pinned rev, all four columns
The census CHECK asserted that the committed TSV re-derives from
WORK-QUEUE.md as it stands on disk. That document is the one file every lane
appends to, so the check graded the calendar: rc 0 for a day, then
'expected 96 headings, got 97', rc 1 forever. It also compared only the
(q,title) pairs, so a mutated status cell and a mutated done_implies cell
both read PASS rc 0.

- verify_workqueue_census.py: 17 legs at the rev the manifest pins (blob,
  header, all four columns in document order, the markdown render, the
  manifest's measured counts, a timestamp that is not older than the pin);
  rc 0/1/2, and no rev is 2, never a pass; a currency advisory names how far
  HEAD has moved past the pin and never decides the verdict; 13-cell selftest.
- extract_workqueue_census.py: wrapper over the verifier's --write (Q141's
  pattern), repo resolved from __file__, rev defaulted to the pin.
- manifest.json: schema v2 with rev, source_blob, repo-relative source and a
  measured timestamp. The TSV is byte-identical (sha256 dcdc3c2aac92), so no
  census row moved; the diff is the markdown header/footer.
- CHECK-q147: a root entry point grading the repair in four legs.
2026-11-01 11:47:21 +00:00

69 lines
2.9 KiB
Bash
Executable File

#!/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