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