fix(621): close a depth blind spot in the record-wing scan

Adversarial self-review: the archive side used `glob("*/*.md")` while records used
rglob. Both exempt the top-level stripped legacy files correctly, but the one-level
glob would ALSO skip anything nested deeper, letting a record at
archive/<area>/<sub>/x.md escape the check entirely.

A path silently escaping the scan is precisely the failure mode this guard exists to
close, so the exemption is now expressed as the actual condition — "directly in
archive/" — rather than a glob shape that happens to match today's layout.

Test added and mutation-verified: reverting to the one-level glob turns it red.
120 passed.

Refs #621
This commit is contained in:
2026-07-26 12:03:43 +02:00
parent 0f565b1f7e
commit b42df5f15f
2 changed files with 23 additions and 1 deletions
+7 -1
View File
@@ -432,7 +432,13 @@ def record_wing_files(records_dir: Path | None = None, archive_dir: Path | None
if records_dir.exists():
files += sorted(records_dir.rglob("*.md"))
if archive_dir.exists():
files += sorted(archive_dir.glob("*/*.md")) # area-nested only — see docstring
# rglob + "not directly in archive/", NOT glob("*/*.md"). Both exempt the top-level
# stripped legacy files, but a one-level glob would ALSO skip anything nested deeper —
# letting a record at `archive/<area>/<sub>/x.md` escape the check entirely. Silently
# skipping a path is the exact failure mode this function exists to close, so the
# exemption is expressed as the precise condition (depth-1 file) rather than a shape that
# happens to match today's layout.
files += sorted(p for p in archive_dir.rglob("*.md") if p.parent != archive_dir)
return [p for p in files if p.name not in dl._NON_DECISION_FILES]