tools (volt): checkin_check -- 'files' and 'days' were one column; zephyrus is 44 files across 23 days, and the gap table said 23 files
This commit is contained in:
1 parent
edaef631e5
commit
c213a5d9a2
1 file changed
+15
-6
+15
-6
@@ -66,7 +66,7 @@ USAGE:
|
|||||||
python3 checkin_check.py --repo /root/troupe-standup
|
python3 checkin_check.py --repo /root/troupe-standup
|
||||||
python3 checkin_check.py --repo . --gaps --json /tmp/checkins.json
|
python3 checkin_check.py --repo . --gaps --json /tmp/checkins.json
|
||||||
python3 checkin_check.py --dir /tmp/fake/checkins --roster volt,zephyrus --today 2026-10-18
|
python3 checkin_check.py --dir /tmp/fake/checkins --roster volt,zephyrus --today 2026-10-18
|
||||||
python3 checkin_check.py --selftest # 26 cells, names, dates, roster, refusals
|
python3 checkin_check.py --selftest # 27 cells, names, dates, roster, refusals
|
||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
@@ -277,7 +277,13 @@ def gaps(rows, today: date, cap: int = 60):
|
|||||||
longest, run_end = run, cur
|
longest, run_end = run, cur
|
||||||
cur += timedelta(days=1)
|
cur += timedelta(days=1)
|
||||||
since = (today - last).days
|
since = (today - last).days
|
||||||
out.append({"handle": h, "files": len(by_handle[h]),
|
# `days` and `files` are different numbers: zephyrus has 44 files across
|
||||||
|
# 23 days, and a table that called the second one "files" would be the
|
||||||
|
# exact defect this archive keeps grading other people for.
|
||||||
|
nfiles = sum(1 for r in rows
|
||||||
|
if r["handle"] == h
|
||||||
|
and not ("BAD_DATE" in r["class"] or "FUTURE" in r["class"]))
|
||||||
|
out.append({"handle": h, "files": nfiles, "days": len(by_handle[h]),
|
||||||
"first": days[0], "last": days[-1],
|
"first": days[0], "last": days[-1],
|
||||||
"days_in_span": (last - first).days + 1,
|
"days_in_span": (last - first).days + 1,
|
||||||
"missing": missing[:cap], "missing_count": len(missing),
|
"missing": missing[:cap], "missing_count": len(missing),
|
||||||
@@ -396,11 +402,11 @@ def print_report(rep, show_gaps: bool, fail: bool):
|
|||||||
f"files lack a Did/Blocked/Next/Ask heading")
|
f"files lack a Did/Blocked/Next/Ask heading")
|
||||||
print(f" -- A1: the four-heading rule postdates the archive; grade it where it applies")
|
print(f" -- A1: the four-heading rule postdates the archive; grade it where it applies")
|
||||||
if show_gaps:
|
if show_gaps:
|
||||||
print(f"\n{'handle':<12} {'files':>5} {'first':>10} {'last':>10} "
|
print(f"\n{'handle':<12} {'files':>5} {'days':>5} {'first':>10} {'last':>10} "
|
||||||
f"{'span':>4} {'miss':>4} {'gap':>4} {'idle':>4}")
|
f"{'span':>4} {'miss':>4} {'gap':>4} {'idle':>4}")
|
||||||
for g in rep["gaps"]:
|
for g in rep["gaps"]:
|
||||||
print(f"{g['handle']:<12} {g['files']:>5} {g['first']:>10} {g['last']:>10} "
|
print(f"{g['handle']:<12} {g['files']:>5} {g['days']:>5} {g['first']:>10} "
|
||||||
f"{g['days_in_span']:>4} {g['missing_count']:>4} "
|
f"{g['last']:>10} {g['days_in_span']:>4} {g['missing_count']:>4} "
|
||||||
f"{g['longest_gap']:>4} {g['days_since_last']:>4}")
|
f"{g['longest_gap']:>4} {g['days_since_last']:>4}")
|
||||||
print(" -- A2: a missing day is not a repo fault; it is a decision an operator owes")
|
print(" -- A2: a missing day is not a repo fault; it is a decision an operator owes")
|
||||||
|
|
||||||
@@ -521,6 +527,9 @@ def selftest():
|
|||||||
cell("c19 the gap axis counts missing days inside a handle's span",
|
cell("c19 the gap axis counts missing days inside a handle's span",
|
||||||
g["volt"]["missing_count"] == 1 and g["volt"]["longest_gap"] == 1,
|
g["volt"]["missing_count"] == 1 and g["volt"]["longest_gap"] == 1,
|
||||||
str(g.get("volt")))
|
str(g.get("volt")))
|
||||||
|
cell("c27 'files' and 'days' are two columns, not one",
|
||||||
|
g["zephyrus"]["files"] == 2 and g["zephyrus"]["days"] == 1,
|
||||||
|
str(g.get("zephyrus")))
|
||||||
|
|
||||||
rc_fail = print_report(rep, True, True)
|
rc_fail = print_report(rep, True, True)
|
||||||
cell("c20 --fail exits 1 when a fault exists", rc_fail == 1, str(rc_fail))
|
cell("c20 --fail exits 1 when a fault exists", rc_fail == 1, str(rc_fail))
|
||||||
@@ -549,7 +558,7 @@ def selftest():
|
|||||||
cell("c26 a malformed --since refuses at rc 2, never 1",
|
cell("c26 a malformed --since refuses at rc 2, never 1",
|
||||||
main(["--dir", ck, "--roster", "volt", "--since", "16-10-2026"]) == 2)
|
main(["--dir", ck, "--roster", "volt", "--since", "16-10-2026"]) == 2)
|
||||||
|
|
||||||
print(f"selftest: 26 cells, {26 - len(bad)} passed, {len(bad)} failed")
|
print(f"selftest: 27 cells, {27 - len(bad)} passed, {len(bad)} failed")
|
||||||
return 1 if bad else 0
|
return 1 if bad else 0
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user