ledger: check-in census extraction (date x count table) + independent CHECK
This commit is contained in:
1 parent
26a313c3bf
commit
b0a2886707
4 files changed
+220
No files matched your search
@@ -0,0 +1,61 @@
|
||||
# Check-in census
|
||||
|
||||
Extract lane table: per-calendar-day count of `checkins/*.md` files (README.md excluded).
|
||||
|
||||
| date | checkin_files |
|
||||
|---|---|
|
||||
| 2026-09-24 | 2 |
|
||||
| 2026-09-25 | 1 |
|
||||
| 2026-09-26 | 2 |
|
||||
| 2026-09-27 | 1 |
|
||||
| 2026-09-28 | 2 |
|
||||
| 2026-09-30 | 1 |
|
||||
| 2026-10-01 | 6 |
|
||||
| 2026-10-02 | 1 |
|
||||
| 2026-10-03 | 3 |
|
||||
| 2026-10-04 | 2 |
|
||||
| 2026-10-05 | 3 |
|
||||
| 2026-10-06 | 9 |
|
||||
| 2026-10-07 | 6 |
|
||||
| 2026-10-08 | 2 |
|
||||
| 2026-10-09 | 2 |
|
||||
| 2026-10-10 | 3 |
|
||||
| 2026-10-11 | 3 |
|
||||
| 2026-10-12 | 3 |
|
||||
| 2026-10-13 | 4 |
|
||||
| 2026-10-14 | 3 |
|
||||
| 2026-10-15 | 4 |
|
||||
| 2026-10-16 | 3 |
|
||||
| 2026-10-17 | 3 |
|
||||
| 2026-10-18 | 3 |
|
||||
| 2026-10-19 | 3 |
|
||||
| 2026-10-20 | 3 |
|
||||
| 2026-10-21 | 3 |
|
||||
| 2026-10-22 | 2 |
|
||||
| 2026-10-23 | 3 |
|
||||
| 2026-10-24 | 2 |
|
||||
| 2026-10-25 | 3 |
|
||||
| 2026-10-26 | 2 |
|
||||
|
||||
**Total:** 93 files across 32 dates (README.md excluded).
|
||||
|
||||
## Per-wizard
|
||||
|
||||
| wizard | files |
|
||||
|---|---|
|
||||
| zephyrus | 50 |
|
||||
| mercury | 17 |
|
||||
| volt | 9 |
|
||||
| merlin | 8 |
|
||||
| cassian | 3 |
|
||||
| zephyrus-wizards | 3 |
|
||||
| cassian-q5-census | 1 |
|
||||
| cassian-q5-recount | 1 |
|
||||
| gemini | 1 |
|
||||
|
||||
## Provenance
|
||||
|
||||
- Source: `checkins/*.md` in the troupe repo.
|
||||
- Dates parsed: 32; files excluded (no leading date): 1 (README.md).
|
||||
- `wizard` = filename with leading `YYYY-MM-DD-` and trailing `-{digits}` stripped.
|
||||
- Check: `./CHECK` recomputes this table from `checkins/` and diffs against the TSV.
|
||||
@@ -0,0 +1,33 @@
|
||||
date,checkin_files
|
||||
2026-09-24,2
|
||||
2026-09-25,1
|
||||
2026-09-26,2
|
||||
2026-09-27,1
|
||||
2026-09-28,2
|
||||
2026-09-30,1
|
||||
2026-10-01,6
|
||||
2026-10-02,1
|
||||
2026-10-03,3
|
||||
2026-10-04,2
|
||||
2026-10-05,3
|
||||
2026-10-06,9
|
||||
2026-10-07,6
|
||||
2026-10-08,2
|
||||
2026-10-09,2
|
||||
2026-10-10,3
|
||||
2026-10-11,3
|
||||
2026-10-12,3
|
||||
2026-10-13,4
|
||||
2026-10-14,3
|
||||
2026-10-15,4
|
||||
2026-10-16,3
|
||||
2026-10-17,3
|
||||
2026-10-18,3
|
||||
2026-10-19,3
|
||||
2026-10-20,3
|
||||
2026-10-21,3
|
||||
2026-10-22,2
|
||||
2026-10-23,3
|
||||
2026-10-24,2
|
||||
2026-10-25,3
|
||||
2026-10-26,2
|
||||
|
+34
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# CHECK — verifier for the check-in census artifact (Extract lane: data extraction).
|
||||
#
|
||||
# Exit 0 iff: the committed TSV (wizard-work/ledger/2026-10-27-checkin-census.tsv)
|
||||
# is byte-identical to an independent recompute of the census straight from the
|
||||
# `checkins/*.md` source directory.
|
||||
#
|
||||
# The recompute uses only ls/grep/awk/sort/uniq (no Python, no shared extractor
|
||||
# logic), so a hand-edited or stale TSV cannot pass by accident.
|
||||
#
|
||||
# Repo root is derived from this file's directory, so the CHECK runs from any
|
||||
# working directory and does not depend on a specific clone path.
|
||||
|
||||
set -u
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1
|
||||
REPO_ROOT="$(cd ../.. && pwd)"
|
||||
SRC="$REPO_ROOT/checkins"
|
||||
OUT="$REPO_ROOT/wizard-work/ledger/2026-10-27-checkin-census.tsv"
|
||||
|
||||
test -s "$OUT" || { echo "FAIL: TSV missing or empty: $OUT" >&2; exit 1; }
|
||||
|
||||
# Independent recompute: header plus date prefix of each check-in file's basename.
|
||||
expected=$(echo "date,checkin_files"; ls "$SRC"/*.md 2>/dev/null \
|
||||
| grep -v 'README\.md$' \
|
||||
| awk -F/ '{n=split($0, a, "/"); name=a[n]; sub(/\.md$/, "", name); print substr(name, 1, 10)}' \
|
||||
| sort \
|
||||
| uniq -c \
|
||||
| awk '{print $2 "," $1}')
|
||||
|
||||
diff -u "$OUT" - <<<"$expected" >/dev/null \
|
||||
|| { echo "FAIL: census mismatch against independent recompute" >&2; exit 1; }
|
||||
|
||||
echo "PASS: census rows=$(tail -n +2 "$OUT" | grep -c .); recomputed from $SRC"
|
||||
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env python3
|
||||
"""extract_checkin_census_2026-10-27.py -- Extract the check-in census table.
|
||||
|
||||
Extract lane (data extraction + tables). Reads checkins/*.md in the troupe
|
||||
repo, groups files by their leading YYYY-MM-DD date, emits a date x count
|
||||
table plus a per-wizard tally.
|
||||
|
||||
Outputs -- written next to this script, under wizard-work/ledger/:
|
||||
* 2026-10-27-checkin-census.tsv date,checkin_files (one row per date)
|
||||
* 2026-10-27-checkin-census.md human summary + provenance
|
||||
Reads use paths relative to this file's directory (repo-root agnostic).
|
||||
"""
|
||||
import collections
|
||||
import os
|
||||
import re
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
REPO = os.path.dirname(os.path.dirname(HERE)) # troupe repo root
|
||||
SRC = os.path.join(REPO, "checkins")
|
||||
OUT_TSV = os.path.join(HERE, "2026-10-27-checkin-census.tsv")
|
||||
OUT_MD = os.path.join(HERE, "2026-10-27-checkin-census.md")
|
||||
|
||||
DATE_RE = re.compile(r"^(20\d{2}-\d{2}-\d{2})-")
|
||||
SUFFIX_RE = re.compile(r"-\d+$") # trailing -NNNN -> strip
|
||||
README_RE = re.compile(r"README\.md$")
|
||||
|
||||
|
||||
def main():
|
||||
counts = collections.Counter() # date -> files
|
||||
per_wizard = collections.Counter() # wizard -> files
|
||||
readme = []
|
||||
with os.scandir(SRC) as it:
|
||||
for entry in sorted(it, key=lambda e: e.name):
|
||||
if not entry.name.endswith(".md"):
|
||||
continue
|
||||
m = DATE_RE.match(entry.name)
|
||||
if not m:
|
||||
readme.append(entry.name)
|
||||
continue
|
||||
date = m.group(1)
|
||||
wizard = SUFFIX_RE.sub("", entry.name[len(m.group(1)) + 1:-3])
|
||||
counts[date] += 1
|
||||
per_wizard[wizard] += 1
|
||||
|
||||
rows = sorted(counts.items())
|
||||
|
||||
with open(OUT_TSV, "w", encoding="utf-8") as f:
|
||||
f.write("date,checkin_files\n")
|
||||
for date, n in rows:
|
||||
f.write(f"{date},{n}\n")
|
||||
|
||||
total = sum(counts.values())
|
||||
lines = [
|
||||
"# Check-in census",
|
||||
"",
|
||||
"Extract lane table: per-calendar-day count of `checkins/*.md` files "
|
||||
"(README.md excluded).",
|
||||
"",
|
||||
"| date | checkin_files |",
|
||||
"|---|---|",
|
||||
]
|
||||
lines += [f"| {date} | {n} |" for date, n in rows]
|
||||
lines += [
|
||||
"",
|
||||
f"**Total:** {total} files across {len(rows)} dates (README.md excluded).",
|
||||
"",
|
||||
"## Per-wizard",
|
||||
"",
|
||||
"| wizard | files |",
|
||||
"|---|---|",
|
||||
]
|
||||
lines += [f"| {w} | {n} |" for w, n in sorted(per_wizard.items(), key=lambda kv: (-kv[1], kv[0]))]
|
||||
lines += [
|
||||
"",
|
||||
"## Provenance",
|
||||
"",
|
||||
"- Source: `checkins/*.md` in the troupe repo.",
|
||||
f"- Dates parsed: {len(rows)}; files excluded (no leading date): "
|
||||
f"{len(readme)} ({', '.join(readme) if readme else 'none'}).",
|
||||
"- `wizard` = filename with leading `YYYY-MM-DD-` and trailing `-{digits}` stripped.",
|
||||
"- Check: `./CHECK` recomputes this table from `checkins/` and diffs against the TSV.",
|
||||
]
|
||||
with open(OUT_MD, "w", encoding="utf-8") as f:
|
||||
f.write("\n".join(lines) + "\n")
|
||||
|
||||
print(f"dates={len(rows)} files={total} excluded={len(readme)}")
|
||||
print(f"wrote {OUT_TSV}")
|
||||
print(f"wrote {OUT_MD}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user