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