fix(re): the capture-citation check was red on a clean tree #65
@@ -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/<dir>/...
|
||||
for i in range(3, len(parts)): # docs/re/captures[/<dir>/...]
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user