From 7d7f88f8237f6dfae9c363d06e2f33f08caf0e0d Mon Sep 17 00:00:00 2001 From: Ed_ Date: Fri, 3 Jul 2026 09:46:33 -0400 Subject: [PATCH] test(aggregate_directives): assert every v1.md has top-level # header --- .../state.toml | 13 +++++++++- tests/test_aggregate_directives.py | 26 ++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/conductor/tracks/directive_hotswap_harness_20260627/state.toml b/conductor/tracks/directive_hotswap_harness_20260627/state.toml index ff64de69..9f71f640 100644 --- a/conductor/tracks/directive_hotswap_harness_20260627/state.toml +++ b/conductor/tracks/directive_hotswap_harness_20260627/state.toml @@ -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 '# ' 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)" \ No newline at end of file +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 '# ' 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 \ No newline at end of file diff --git a/tests/test_aggregate_directives.py b/tests/test_aggregate_directives.py index 8aed9665..429e2bf2 100644 --- a/tests/test_aggregate_directives.py +++ b/tests/test_aggregate_directives.py @@ -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 \ No newline at end of file + 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" \ No newline at end of file