Private
Public Access
0
0

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

This commit is contained in:
2026-07-03 09:46:33 -04:00
parent 4d2179c38f
commit 7d7f88f823
2 changed files with 37 additions and 2 deletions
@@ -66,6 +66,7 @@ t4_10 = { status = "completed", commit_sha = "454fac1b", description = "E.2 Harv
t4_11 = { status = "completed", commit_sha = "9d3222dd", description = "E.3 Write scripts/aggregate_directives.py + 5 pytest tests (stdlib-only; reads v1.md only, never meta.md; supports stdout and -o)" }
t4_12 = { status = "completed", commit_sha = "465433e0", description = "E.4 Update current_baseline preset with 15 new directives (total 66; alphabetical order preserved)" }
t4_13 = { status = "completed", commit_sha = "8ef66e02", description = "E.5 Update state.toml with task records e_1..e_4 and phase_4 entry; archive throwaway expansion helpers under scripts/tier2/artifacts/" }
t5_1 = { status = "completed", commit_sha = "PENDING", description = "Every v1.md starts with an explicit '# <rule-statement>' header (63 back-filled in 8 batches; 3 already-titled: chroma_cache_path, config_state_owner, workspace_paths). New pytest test asserts the header on all 66." }
[verification]
phase_1_complete = true
@@ -96,4 +97,14 @@ directives_after = 66
new_directives_count = 15
new_directive_sources = "docs/AGENTS.md (2), conductor/edit_workflow.md (6), docs/guide_testing.md (5), docs/guide_state_lifecycle.md (2)"
metadata_convention = "Per user directive 2026-07-02: v1.md holds pure body; meta.md holds provenance (why/source/lifted). Aggregator NEVER reads meta.md."
aggregation_script = "scripts/aggregate_directives.py (stdlib-only; 5 pytest tests in tests/test_aggregate_directives.py)"
aggregation_script = "scripts/aggregate_directives.py (stdlib-only; 5 pytest tests in tests/test_aggregate_directives.py)"
[titles_20260702]
# Per user directive 2026-07-02: every v1.md must open with an explicit '# <rule-statement>' heading.
# Complaint: "banned local imports doesn't explicitly state in its content that local imports is banned."
directives_total = 66
titles_back_filled = 63
already_titled = 3 # chroma_cache_path, config_state_owner, workspace_paths (top-level '# ' heading already present)
batches = 8 # 8 back-fill commits (~8 files each) + 1 test/state commit
test_added = "tests/test_aggregate_directives.py::test_every_v1_has_top_level_heading (+ test_v1_heading_is_not_meta_provenance_format)"
aggregation_pollution_preserved = true # scripts/aggregate_directives.py output has no meta.md leakage after header back-fill
+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"