test(aggregate_directives): assert every v1.md has top-level # header

This commit is contained in:
ed
2026-07-03 09:46:33 -04:00
parent 4d2179c38f
commit 7d7f88f823
2 changed files with 37 additions and 2 deletions
+25 -1
View File
@@ -67,4 +67,28 @@ def test_no_meta_md_reads() -> None:
body = result.stdout
assert "Provenance" not in body
assert "## v1" not in body
assert "# ban_dict_any" not in body
assert "# ban_dict_any" not in body
DIRECTIVES_DIR = REPO_ROOT / "conductor" / "directives"
def _iter_v1_files() -> list[Path]:
return sorted(DIRECTIVES_DIR.glob("*/v1.md"))
def test_every_v1_has_top_level_heading() -> None:
v1_files = _iter_v1_files()
assert len(v1_files) >= 66, "expected at least 66 directive v1.md files; found " + str(len(v1_files))
missing: list[str] = []
for path in v1_files:
first_line = path.read_text(encoding="utf-8").splitlines()[0] if path.read_text(encoding="utf-8") else ""
if not first_line.startswith("# "):
missing.append(path.parent.name)
assert not missing, "v1.md files missing a top-level '# ' rule-statement heading: " + ", ".join(missing)
def test_v1_heading_is_not_meta_provenance_format() -> None:
for path in _iter_v1_files():
first_line = path.read_text(encoding="utf-8").splitlines()[0]
assert not first_line.strip().endswith("- v1"), path.parent.name + " uses the meta.md provenance heading format in v1.md body"