diff --git a/wizard-work/ledger/2026-10-27-checkin-census.md b/wizard-work/ledger/2026-10-27-checkin-census.md index 786f802..6808f93 100644 --- a/wizard-work/ledger/2026-10-27-checkin-census.md +++ b/wizard-work/ledger/2026-10-27-checkin-census.md @@ -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). - `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. -- 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. diff --git a/wizard-work/ledger/CHECK-2026-10-27-checkin-census b/wizard-work/ledger/CHECK-2026-10-27-checkin-census index c172504..4697f88 100755 --- a/wizard-work/ledger/CHECK-2026-10-27-checkin-census +++ b/wizard-work/ledger/CHECK-2026-10-27-checkin-census @@ -107,6 +107,60 @@ fi echo "PASS tsv: $(($(wc -l < "$TSV") - 1)) wizard row(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 printf 'VERDICT=PASS census-2026-10-27 rows=%s files=%s pin=%s\n' \ "$(($(wc -l < "$TSV") - 1))" \ diff --git a/wizard-work/ledger/extract_checkin_census_2026-10-27.py b/wizard-work/ledger/extract_checkin_census_2026-10-27.py index 1a4d5f7..064aa99 100644 --- a/wizard-work/ledger/extract_checkin_census_2026-10-27.py +++ b/wizard-work/ledger/extract_checkin_census_2026-10-27.py @@ -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 " "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.", ] return "\n".join(lines) + "\n"