119 lines
4.6 KiB
Python
119 lines
4.6 KiB
Python
"""Tests for the 2026-07-03 scavenge sweep (batch 4/5: tracks + commands + styleguides + todos).
|
|
|
|
Lifted 18 new directives from the remaining unread markdown: conductor/tier2/agents/,
|
|
conductor/tier2/commands/, the dispatch_tier3_phase1.md directive file,
|
|
conductor/code_styleguides/type_aliases.md §2.5, the remaining nagent_review v3.1
|
|
docs (decisions.md, comparison_table.md, etc.), the intent_dsl_survey research
|
|
clusters not yet lifted, and the 3 conductor/todos/ files.
|
|
|
|
These tests pin the structural contract:
|
|
|
|
- every new directive has both a v1.md and a meta.md file
|
|
- every new directive's v1.md body starts with a '# ' imperative heading
|
|
- every new directive's meta.md has the ## v1 section + Source/Lifted lines
|
|
- every new directive is referenced in conductor/directives/presets/current_baseline.md
|
|
|
|
Additive to tests/test_scavenge_directives_lift.py and tests/test_scavenge_batch_1.py
|
|
(the existing scavenge-pass tests).
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parent.parent
|
|
DIRECTIVES_DIR = REPO_ROOT / "conductor" / "directives"
|
|
PRESET = REPO_ROOT / "conductor" / "directives" / "presets" / "current_baseline.md"
|
|
|
|
SCAVENGE_BATCH_4_DIRECTIVES: list[str] = [
|
|
"acknowledgment_in_first_commit",
|
|
"ban_appdata_paths",
|
|
"deterministic_signal_endpoint_pattern",
|
|
"end_of_track_report_required",
|
|
"failure_message_actionable_not_vague",
|
|
"fragile_test_in_batch_is_failing_test",
|
|
"master_branch_default",
|
|
"no_conductor_yaml_for_artifacts",
|
|
"per_aggregate_dataclass_promotion",
|
|
"per_conversation_scratch_dir",
|
|
"per_dimension_pick_dim_not_tool",
|
|
"per_phase_metric_regression_fix",
|
|
"submit_io_lazy_pool_recreation",
|
|
"throwaway_scripts_isolated_subdir",
|
|
"timeline_is_immutable",
|
|
"use_batched_test_runner",
|
|
"verbatim_lift_not_rewrite",
|
|
"warm_md_duplicates_not_in_place",
|
|
]
|
|
|
|
|
|
def _read(path: Path) -> str:
|
|
return path.read_text(encoding="utf-8")
|
|
|
|
|
|
def test_scavenge_batch_4_lift_count_matches_expected() -> None:
|
|
assert len(SCAVENGE_BATCH_4_DIRECTIVES) == 18, "scavenge batch 4 lifted 18 directives; list must stay in sync"
|
|
|
|
|
|
@pytest.mark.parametrize("directive_name", SCAVENGE_BATCH_4_DIRECTIVES)
|
|
def test_scavenge_batch_4_directive_has_v1_file(directive_name: str) -> None:
|
|
path = DIRECTIVES_DIR / directive_name / "v1.md"
|
|
assert path.is_file(), "missing v1.md for scavenge-batch-4 directive: " + directive_name
|
|
|
|
|
|
@pytest.mark.parametrize("directive_name", SCAVENGE_BATCH_4_DIRECTIVES)
|
|
def test_scavenge_batch_4_directive_has_meta_file(directive_name: str) -> None:
|
|
path = DIRECTIVES_DIR / directive_name / "meta.md"
|
|
assert path.is_file(), "missing meta.md for scavenge-batch-4 directive: " + directive_name
|
|
|
|
|
|
@pytest.mark.parametrize("directive_name", SCAVENGE_BATCH_4_DIRECTIVES)
|
|
def test_scavenge_batch_4_v1_starts_with_imperative_heading(directive_name: str) -> None:
|
|
path = DIRECTIVES_DIR / directive_name / "v1.md"
|
|
first_line = _read(path).splitlines()[0]
|
|
assert first_line.startswith("# "), (
|
|
directive_name + " v1.md first line is not a '# ' imperative heading: " + first_line
|
|
)
|
|
|
|
|
|
@pytest.mark.parametrize("directive_name", SCAVENGE_BATCH_4_DIRECTIVES)
|
|
def test_scavenge_batch_4_meta_has_required_sections(directive_name: str) -> None:
|
|
path = DIRECTIVES_DIR / directive_name / "meta.md"
|
|
body = _read(path)
|
|
assert "## v1" in body, directive_name + " meta.md missing '## v1' section"
|
|
assert "**Source:**" in body, directive_name + " meta.md missing **Source:** line"
|
|
assert "**Lifted:**" in body, directive_name + " meta.md missing **Lifted:** line"
|
|
|
|
|
|
def test_scavenge_batch_4_directives_listed_in_current_baseline_preset() -> None:
|
|
preset_body = _read(PRESET)
|
|
for name in SCAVENGE_BATCH_4_DIRECTIVES:
|
|
assert name in preset_body, (
|
|
"current_baseline.md does not reference scavenge-batch-4 directive: " + name
|
|
)
|
|
|
|
|
|
def test_total_directive_count_grew_after_scavenge_batch_4() -> None:
|
|
v1_files = sorted(DIRECTIVES_DIR.glob("*/v1.md"))
|
|
assert len(v1_files) >= 108, (
|
|
"expected >= 108 directives after scavenge batch 4 (90 baseline + 18 batch-4); found "
|
|
+ str(len(v1_files))
|
|
)
|
|
|
|
|
|
def test_baseline_preset_size_grew_after_scavenge_batch_4() -> None:
|
|
preset_body = _read(PRESET)
|
|
assert preset_body.count("\n- ") >= 108, (
|
|
"current_baseline.md should have >= 108 directive lines after scavenge batch 4"
|
|
)
|
|
|
|
|
|
@pytest.mark.parametrize("directive_name", SCAVENGE_BATCH_4_DIRECTIVES)
|
|
def test_scavenge_batch_4_v1_first_line_is_complete_sentence(directive_name: str) -> None:
|
|
path = DIRECTIVES_DIR / directive_name / "v1.md"
|
|
first_line = _read(path).splitlines()[0].lstrip("# ").strip()
|
|
assert len(first_line) > 20, (
|
|
directive_name + " v1.md first-line statement is too short to be a complete imperative: "
|
|
+ first_line
|
|
) |