ledger: grade the census MD's table, total and appendix against the pin (Q88, 2/2)
The old CHECK read only the TSV, so the block a reader scrolls to was verified by nothing: `grep -c 'census.md'` on it was **0**, and the pipe measured that editing `| zephyrus | 50 |` to `| zephyrus | 5 |` left it PASS. Three legs now re-derive the MD from the same pinned name list: - leg 4: the `| wizard | checkin_files |` block must equal the awk derivation (identical to the TSV body, so the two published halves cannot disagree); - leg 5: `**Total files:** N across D dates` must equal the pinned name count and its distinct-date count; - leg 6: the `| date | files |` appendix must equal the per-date derivation. Probes (`q88-probe-md.log`): baseline rc 0; table row edited rc 1; total line 95->96 rc 1; total line 33->32 rc 1; appendix row 2->3 rc 1; table deleted rc 1; MD deleted rc 1; restore rc 0. The `q88-probe.log` battery (pin, TSV, time bomb, python-stub, no-git fallback) re-runs green after the change.
This commit is contained in:
1 parent
f22824ab48
commit
ad695acadc
3 files changed
+58
-3
No files matched your search
@@ -62,4 +62,4 @@ at the pin is 2026-10-27 (2 files).
|
|||||||
- Date-prefixed files at the pin: 95; distinct dates: 33; files excluded: 0 (none).
|
- Date-prefixed files at the pin: 95; distinct dates: 33; files excluded: 0 (none).
|
||||||
- `wizard` = filename with leading `YYYY-MM-DD-` and trailing `-{digits}` stripped.
|
- `wizard` = filename with leading `YYYY-MM-DD-` and trailing `-{digits}` stripped.
|
||||||
- Correction: the `e0ee5cb` revision of this artifact counted the live directory and published 96 files / 33 dates; no revision of `checkins/` holds that `sentinel` file, and the numbers here are recomputed from the pin.
|
- Correction: the `e0ee5cb` revision of this artifact counted the live directory and published 96 files / 33 dates; no revision of `checkins/` holds that `sentinel` file, and the numbers here are recomputed from the pin.
|
||||||
- Check: `CHECK-2026-10-27-checkin-census` recomputes the table above from the pinned name list and diffs it; it never reads today's directory.
|
- Check: `CHECK-2026-10-27-checkin-census` recomputes the table above, the total line and the per-date appendix from the pinned name list and diffs all three; it never reads today's directory.
|
||||||
@@ -107,6 +107,60 @@ fi
|
|||||||
echo "PASS tsv: $(($(wc -l < "$TSV") - 1)) wizard row(s)," \
|
echo "PASS tsv: $(($(wc -l < "$TSV") - 1)) wizard row(s)," \
|
||||||
"$(awk -F"$TAB" 'NR>1{s+=$2} END{print s+0}' "$TSV") file(s)"
|
"$(awk -F"$TAB" 'NR>1{s+=$2} END{print s+0}' "$TSV") file(s)"
|
||||||
|
|
||||||
|
# ------------------------------------------- leg 4: the MD's published table
|
||||||
|
# The MD is what a reader scrolls to, and until now nothing graded it: editing
|
||||||
|
# `| zephyrus | 51 |` to `| zephyrus | 5 |` left the old CHECK PASS.
|
||||||
|
[ -s "$MD" ] || fail "MD missing or empty: ${MD#"$REPO"/}"
|
||||||
|
awk -F'|' '
|
||||||
|
/^\| *wizard *\| *checkin_files *\| *$/ { inb = 1; next }
|
||||||
|
inb && /^\|[- |]*$/ { next }
|
||||||
|
inb && /^\|/ {
|
||||||
|
w = $2; n = $3
|
||||||
|
gsub(/[[:space:]]/, "", w); gsub(/[[:space:]]/, "", n)
|
||||||
|
printf "%s\t%s\n", w, n; next
|
||||||
|
}
|
||||||
|
inb { inb = 0 }
|
||||||
|
' "$MD" > "$tmp/md.body"
|
||||||
|
echo "PASS tables: MD per-wizard block is $(wc -l < "$tmp/md.body") row(s)"
|
||||||
|
if ! cmp -s "$tmp/tsv.body" "$tmp/md.body"; then
|
||||||
|
printf 'FAIL: MD per-wizard table != recompute from the pin\n' >&2
|
||||||
|
diff -u "$tmp/tsv.body" "$tmp/md.body" >&2 || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ------------------------------------------------- leg 5: the MD's total line
|
||||||
|
want_files="$(wc -l < "$tmp/names")"
|
||||||
|
want_dates="$(cut -c1-10 "$tmp/names" | sort -u | wc -l)"
|
||||||
|
read -r md_files md_dates < <(
|
||||||
|
sed -n 's/^\*\*Total files:\*\* \([0-9][0-9]*\) across \([0-9][0-9]*\) dates.*$/\1 \2/p' "$MD"
|
||||||
|
)
|
||||||
|
[ -n "${md_files:-}" ] || fail "MD carries no '**Total files:** N across D dates' line"
|
||||||
|
if [ "$md_files" != "$want_files" ] || [ "$md_dates" != "$want_dates" ]; then
|
||||||
|
fail "MD total line says ${md_files} files / ${md_dates} dates; the pin gives" \
|
||||||
|
"${want_files} / ${want_dates}"
|
||||||
|
fi
|
||||||
|
echo "PASS total: MD says ${md_files} file(s) across ${md_dates} date(s)"
|
||||||
|
|
||||||
|
# --------------------------------------------- leg 6: the MD's per-date appendix
|
||||||
|
awk -F'|' '
|
||||||
|
/^\| *date *\| *files *\| *$/ { inb = 1; next }
|
||||||
|
inb && /^\|[- |]*$/ { next }
|
||||||
|
inb && /^\|/ {
|
||||||
|
d = $2; n = $3
|
||||||
|
gsub(/[[:space:]]/, "", d); gsub(/[[:space:]]/, "", n)
|
||||||
|
printf "%s\t%s\n", d, n; next
|
||||||
|
}
|
||||||
|
inb { inb = 0 }
|
||||||
|
' "$MD" > "$tmp/md.dates"
|
||||||
|
cut -c1-10 "$tmp/names" | LC_ALL=C sort | uniq -c \
|
||||||
|
| awk '{printf "%s\t%d\n", $2, $1}' | LC_ALL=C sort > "$tmp/pin.dates"
|
||||||
|
if ! cmp -s "$tmp/pin.dates" "$tmp/md.dates"; then
|
||||||
|
printf 'FAIL: MD per-date appendix != recompute from the pin\n' >&2
|
||||||
|
diff -u "$tmp/pin.dates" "$tmp/md.dates" >&2 || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "PASS appendix: $(wc -l < "$tmp/md.dates") date row(s) agree with the pin"
|
||||||
|
|
||||||
# -------------------------------------------------------------------- verdict
|
# -------------------------------------------------------------------- verdict
|
||||||
printf 'VERDICT=PASS census-2026-10-27 rows=%s files=%s pin=%s\n' \
|
printf 'VERDICT=PASS census-2026-10-27 rows=%s files=%s pin=%s\n' \
|
||||||
"$(($(wc -l < "$TSV") - 1))" \
|
"$(($(wc -l < "$TSV") - 1))" \
|
||||||
|
|||||||
@@ -133,8 +133,9 @@ def render_md(per_date, per_wizard, excluded, commit, tree, dated):
|
|||||||
"- Correction: the `e0ee5cb` revision of this artifact counted the live "
|
"- Correction: the `e0ee5cb` revision of this artifact counted the live "
|
||||||
"directory and published 96 files / 33 dates; no revision of `checkins/` "
|
"directory and published 96 files / 33 dates; no revision of `checkins/` "
|
||||||
"holds that `sentinel` file, and the numbers here are recomputed from the pin.",
|
"holds that `sentinel` file, and the numbers here are recomputed from the pin.",
|
||||||
"- Check: `CHECK-2026-10-27-checkin-census` recomputes the table above "
|
"- Check: `CHECK-2026-10-27-checkin-census` recomputes the table above, "
|
||||||
"from the pinned name list and diffs it; it never reads today's directory.",
|
"the total line and the per-date appendix from the pinned name list and "
|
||||||
|
"diffs all three; it never reads today's directory.",
|
||||||
]
|
]
|
||||||
return "\n".join(lines) + "\n"
|
return "\n".join(lines) + "\n"
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user