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.
48 lines
2.5 KiB
Bash
Executable File
48 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# CHECK -- workqueue-census: the census re-derives from WORK-QUEUE.md AT ITS PIN.
|
|
#
|
|
# What was wrong (Q147, measured at 50cc5bb in a clean clone): this entry point
|
|
# asserted that the committed TSV re-derives from WORK-QUEUE.md as it stands on
|
|
# disk. The queue is the one document every lane appends to, so the check graded
|
|
# the calendar: rc 0 for one day, then `expected 96 headings, got 97`, rc 1
|
|
# forever. It also compared only the (q,title) pairs -- a mutated `status` and a
|
|
# mutated `done_implies` both printed PASS, rc 0 (measured at 95b6964).
|
|
#
|
|
# What it grades now, at the rev the manifest pins:
|
|
# 1 the pin resolves and WORK-QUEUE.md at it hashes to the manifest's blob
|
|
# 2 the committed TSV header is exact and every row is four cells
|
|
# 3 the TSV equals an independent re-derivation, all four columns, doc order
|
|
# 4 the markdown render equals the same derivation, row for row
|
|
# 5 the manifest's counts (rows, distinct q, reopened q, columns) are measured
|
|
# 6 extracted_at_utc parses as UTC and is not older than the pin's commit
|
|
# and prints `currency:` -- how far HEAD has moved past the pin -- as an
|
|
# advisory that never decides the verdict.
|
|
#
|
|
# rc 0 the artifact is true at its pin
|
|
# rc 1 a graded fault
|
|
# rc 2 it could not grade (no repo, no manifest, no rev, unresolvable rev,
|
|
# WORK-QUEUE.md absent at the pin, unreadable artifact)
|
|
set -u
|
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || { echo "CANNOT GRADE: no such directory"; exit 2; }
|
|
REPO="$(git -C "$HERE" rev-parse --show-toplevel 2>/dev/null)" || { echo "CANNOT GRADE: $HERE is not in a git repository"; exit 2; }
|
|
[ -n "$REPO" ] || { echo "CANNOT GRADE: no git toplevel for $HERE"; exit 2; }
|
|
|
|
TOOL="$HERE/verify_workqueue_census.py"
|
|
[ -f "$TOOL" ] || { echo "CANNOT GRADE: missing $TOOL"; exit 2; }
|
|
|
|
# The basename is spelled on the invocation line so the Q65 wiring census reads
|
|
# this entry point as an invocation and not as prose (same directory, so the
|
|
# bare-basename rule applies). Measured: `q63_verify_scan.py --repo .` classes
|
|
# this file `wired-invoke` at the landing rev.
|
|
python3 "$HERE/verify_workqueue_census.py" --selftest >/dev/null 2>&1 \
|
|
|| { echo "FAIL: selftest did not read green"; python3 "$HERE/verify_workqueue_census.py" --selftest | tail -5; exit 1; }
|
|
echo "PASS selftest (13 cells)"
|
|
|
|
python3 "$TOOL" --check --repo "$REPO"
|
|
rc=$?
|
|
case "$rc" in
|
|
0) echo "CHECK workqueue-census: PASS"; exit 0 ;;
|
|
1) echo "CHECK workqueue-census: FAIL"; exit 1 ;;
|
|
*) echo "CHECK workqueue-census: CANNOT GRADE (rc=$rc)"; exit 2 ;;
|
|
esac
|