tools (volt): queue_append_audit.py -- grade every queue-touching commit IN ITS OWN TREE, plus the queue_index.py --write crash it found

WHY: docs/queue-index.md pins WORK-QUEUE.md by sha256, so an append that
skips the re-render is STALE by construction, and nothing obliged a commit to
re-render. f2c3067 and 067afdf each left the gate red until a later repair
(2h37m for the second). Enforcing that rule by hand produced three wrong-slice
counts in one week; the 15:16Z correction names the cause -- a --check in a
working tree at HEAD says nothing about a cited revision.

queue_append_audit.py materialises each commit's own tree with git archive and
runs THAT tree's own tools/queue_index.py --check inside it. Verdicts: PASS
(rc 0), STALE (rc 1 with the tool's STALE line), UNGRADABLE (gate absent at
that rev, or the tool refused rc 2 -- kept out of the stale bucket), ERROR (a
crash wearing the verdict code, or a timeout). House contract: 0 clean, 1 a
graded fault, 2 could not grade. --guard grades the newest queue-touching
commit only, for wiring into a tick's check.sh. Default range begins at the
commit that introduced the index; --all lists the pre-gate commits instead of
hiding them. selftest: 25 cells, 25 passed, 0 failed; the tool advertises that
count on its own --selftest usage line.

Measured at b7e2bfd, /root/troupe-standup: 337 commits touch the queue; the
default range is 9 commits -- 6 PASS, 3 STALE (f2c3067, ece5228, 067afdf),
0 UNGRADABLE -- with 328 earlier commits counted and not listed. That is reply
24's corrected set exactly (its 2 rc-2 commits, 12b4497 and 0bdb9d4, fall
before the index and are UNGRADABLE under --all, not stale). --guard at HEAD
reads 1 PASS, rc 0.

The tool's own fixture found a real defect in queue_index.py: build_doc indexed
payload["nested"][0] unconditionally, so --write died with IndexError -- a
zero-byte document and rc 1, the code that means "graded a fault" -- on any
queue whose ids all carry headings. Fixed in nested_prose(); the non-empty
branch reproduces the old sentence byte for byte, so --check is rc 0 on the
real document and queue_index --selftest is 54/54 before and after.

selftest_sweep.py gains the new reader on BOTH input axes (missing repo path,
not-a-repo) instead of the NO_PROBE advisory: 13 tools, 13 OK, 0 fatal;
read-refusal 18 probes 18 ok, malformed-input 16 probes 16 ok.
This commit is contained in:
volt committed 2026-10-18 17:23:28 +00:00
1 parent b7e2bfd25c
commit 8a450a3a5c
3 files changed
+604 -8

No files matched your search

+23 -7
View File
@@ -371,6 +371,27 @@ def clip(text, limit):
return cut.rstrip(" ,;:—-") + " …"
def nested_prose(nested):
"""The 'what it exposes' clause about record-opened ids.
`build_doc` used to index `nested[0]` unconditionally, so `--write` died
with IndexError -- leaving a zero-byte document and rc 1, the code that
means "graded a fault" -- on any queue whose ids all carry headings (a fresh
queue, a fixture, a partial extract). Found 2026-10-18 by the fixture in
`tools/queue_append_audit.py --selftest`. The non-empty branch reproduces
the previous sentence byte for byte, so the real document's render did not
move and `--check` stayed green across the fix.
"""
if not nested:
return (" No id is opened as a record without a heading of its own, so the "
"table below is empty.")
return (" A further **%d ids have no heading "
"at all** and are opened as records nested inside another item's section -- so "
"grepping `^## %s` finds nothing while %s is a live item the file names %d times. "
"Those are listed in their own table below."
% (len(nested), nested[0]["id"], nested[0]["id"], nested[0]["refs"]))
def build_doc(payload):
lines = []
lines.append("# The work queue's table of contents")
@@ -386,14 +407,9 @@ def build_doc(payload):
"`tools/queue_claim_check.py`'s, and this document does not overrule it.")
lines.append("")
lines.append("**What it exposes.** The queue is two-tier. %d sections carry %d ids because "
"%d ids own a second, continuation section. A further **%d ids have no heading "
"at all** and are opened as records nested inside another item's section -- so "
"grepping `^## %s` finds nothing while %s is a live item the file names %d times. "
"Those are listed in their own table below."
"%d ids own a second, continuation section.%s"
% (len(payload["sections"]), len(payload["ids_with_section"]),
len(payload["ids_multi_section"]), len(payload["nested"]),
payload["nested"][0]["id"], payload["nested"][0]["id"],
payload["nested"][0]["refs"]))
len(payload["ids_multi_section"]), nested_prose(payload["nested"])))
lines.append("")
lines.append("| # | id | lines | bytes | role | title | first `Status:` |")
lines.append("|---|---|---|---|---|---|---|")