tools (volt): the selftest cell count is graded against this file's own docstring (cell 27); the stale 42-cell help string is gone

f59a592 left the exact defect class this repo keeps finding in documents: the
docstring and the run said 50 cells while `--selftest`'s argparse help still
said 42, and nothing failed. Two changes:

- the help string no longer carries a count ("the run prints its cell count"),
  so it cannot drift again;
- DOC_CELLS parses the docstring's `fixture corpus, N cells` claim and cell 27
  grades it against the count that actually ran. Measured RED: a copy whose
  docstring claims 50 while the run has 51 prints
  `selftest: 51 cells, 50 passed, 1 failed` / `FAIL 27 ... got: 50 want: 51`,
  rc 1.

Selftest 50 -> 51 cells, 51/51, rc 0.
This commit is contained in:
volt committed 2026-10-19 18:59:41 +00:00
1 parent f59a592e49
commit 81d2c0ae9a
1 file changed
+18 -2
+18 -2
View File
@@ -132,7 +132,7 @@ TOOLS ARE RESOLVED FROM --repo, NOT FROM THIS FILE'S DIRECTORY
The path must still be the ROOT: a subdirectory is rc 2 naming the root, The path must still be the ROOT: a subdirectory is rc 2 naming the root,
because widening `--repo` silently would grade a tree nobody named. because widening `--repo` silently would grade a tree nobody named.
`--selftest` fixture corpus, 50 cells `--selftest` fixture corpus, 51 cells
""" """
import argparse import argparse
@@ -184,6 +184,13 @@ WEAK_HINTS = ("FAIL", "not a ")
# summaries -- they are axis lines inside a tool's report. # summaries -- they are axis lines inside a tool's report.
SUMMARY_RE = re.compile(r"^[a-z][a-z0-9_]*: ") SUMMARY_RE = re.compile(r"^[a-z][a-z0-9_]*: ")
# The selftest size this file's docstring claims. Cell 27 grades that claim
# against the count that actually ran, because on 2026-10-19 the count left
# this exact defect behind: the docstring and the run said 50 while the
# argparse help string still said 42, and nothing failed.
_DOC_CLAIM = re.search(r"fixture corpus, (\d+) cells", __doc__ or "")
DOC_CELLS = int(_DOC_CLAIM.group(1)) if _DOC_CLAIM else 0
def pick_detail(text, limit=150, summary=False): def pick_detail(text, limit=150, summary=False):
"""First line that names a reason, else the last line that says anything. """First line that names a reason, else the last line that says anything.
@@ -449,7 +456,8 @@ def main(argv=None):
help="per-leg timeout in seconds (default 300)") help="per-leg timeout in seconds (default 300)")
ap.add_argument("--json", metavar="PATH", help="write the rows here") ap.add_argument("--json", metavar="PATH", help="write the rows here")
ap.add_argument("--quiet", action="store_true") ap.add_argument("--quiet", action="store_true")
ap.add_argument("--selftest", action="store_true", help="fixture corpus, 42 cells") ap.add_argument("--selftest", action="store_true",
help="run the fixture corpus (the run prints its cell count)")
a = ap.parse_args(argv) a = ap.parse_args(argv)
if a.selftest: if a.selftest:
@@ -853,6 +861,14 @@ def selftest():
rc, out = _verify("--repo", bare, "--fast") rc, out = _verify("--repo", bare, "--fast")
check("26 a bare repository -> rc 2", rc, 2) check("26 a bare repository -> rc 2", rc, 2)
# 27. the count in this file's own docstring is a CLAIM, so it is graded
# against the count that actually ran. On 2026-10-19 the docstring and
# the run said 50 while the argparse help string still said 42 and
# nothing failed -- the same count-word defect this repo keeps finding in
# documents, closed in the document that prints the number.
check("27 the docstring's cell count is the count that ran",
DOC_CELLS, cells + 1)
print("selftest: %d cells, %d passed, %d failed" % (cells, passed, len(failures))) print("selftest: %d cells, %d passed, %d failed" % (cells, passed, len(failures)))
for f in failures: for f in failures:
print(" FAIL %s" % f) print(" FAIL %s" % f)