From 43f0a905a0c6811d38cf7f8f6fb19615f005576a Mon Sep 17 00:00:00 2001 From: MechaCat02 Date: Mon, 21 Sep 2026 18:12:27 +0200 Subject: [PATCH] fix(re): the capture check was red on a clean tree `committed()` built the directory set from `range(4, len(parts))`. Index 3 is `docs/re/captures` itself, so every SUB-directory was registered and the root never was. Eight pages cite the directory as a whole -- PROTOCOL's evidence table, CONSOLIDATION, CONTAINERS-AND-AGENTS, decoder-loop, both HANDOFFs, BLOCKED, verify-screen-blend-divergence -- and each of those looked like a citation of a file that does not exist. `check-capture-citations` exited 1 on a correct checkout, which is the failure mode its own comments warn about: "a gate that is red on every clean checkout" teaches people to ignore it. The selftest could not see this. It takes `next(iter(dirs))`, and an arbitrary member of that set is always a sub-directory -- the one case that works. It now asserts the root explicitly, with and without its trailing slash. Both new cases were confirmed to FAIL against the unfixed function before the fix went in; a selftest case that passes either way is decoration. Measured: full check 203 citations, 212 captures, 0 dangling, 0 tracked assets, exit 0. Before: exit 1. Co-Authored-By: Claude Opus 5 --- tools/re/check-capture-citations | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/re/check-capture-citations b/tools/re/check-capture-citations index ffeb757b..46fc73fa 100755 --- a/tools/re/check-capture-citations +++ b/tools/re/check-capture-citations @@ -82,10 +82,16 @@ def committed() -> tuple[set[str], set[str]]: if fn == ".gitignore": continue files.add(os.path.join(dirpath, fn).replace(os.sep, "/")) + # 🔴 START AT 3, NOT 4 — 3 is `docs/re/captures` ITSELF. Starting at 4 built + # every sub-directory and never the root, so the eight pages that cite the + # directory as a whole ("evidence lives in `docs/re/captures/`") each looked + # like a citation of a file that does not exist, and the gate was red on a + # clean, correct tree. The selftest could not see it either: it took an + # arbitrary member of `dirs`, which is always a sub-directory. dirs = set() for f in files: parts = f.split("/") - for i in range(4, len(parts)): # docs/re/captures//... + for i in range(3, len(parts)): # docs/re/captures[//...] dirs.add("/".join(parts[:i]) + "/") return files, dirs @@ -182,6 +188,9 @@ def selftest() -> int: ("real file passed", real_file, True), ("directory reference passed", real_dir, True), ("directory without slash passed", real_dir.rstrip("/"), True), + # The root is the case the arbitrary `real_dir` above can never be. + ("captures root itself passed", ROOT, True), + ("captures root without slash passed", ROOT.rstrip("/"), True), ("sentence punctuation stripped", real_file + ".", True), ] # 🔴 THE SELFTEST USED TO PASS WHILE THE SCAN RETURNED NOTHING. It exercised