Private
Public Access
0
0

test(aggregate): add integration tests for non-directive context in aggregate output

This commit is contained in:
2026-07-05 14:15:13 -04:00
parent 82468611ba
commit 7d90518627
+49 -1
View File
@@ -205,4 +205,52 @@ a
- beta: conductor/directives/beta/v1.md
""", encoding="utf-8")
with pytest.raises(ValueError, match="inheritance loop"):
resolve_inheritance(pdir / "a.md", root=tmp_path)
resolve_inheritance(pdir / "a.md", root=tmp_path)
class TestAggregateWithNonDirectiveContext:
"""Integration: aggregate_directives returns non-directive files in a separate section."""
def test_aggregate_includes_non_directive_section(self, tmp_path: Path):
directives_dir = tmp_path / "conductor" / "directives" / "alpha"
directives_dir.mkdir(parents=True)
(directives_dir / "v1.md").write_text("# Alpha rule\n\nDo the thing.\n", encoding="utf-8")
context_file = tmp_path / "AGENTS.md"
context_file.write_text("# Project Rules\n\nRule 1.\n", encoding="utf-8")
preset = tmp_path / "test_preset.md"
preset.write_text("""# Preset: test
## Directives to warm
- alpha: conductor/directives/alpha/v1.md
## Non-directive context
- project rules: AGENTS.md
""", encoding="utf-8")
rendered = aggregate_directives(str(preset), project_root=str(tmp_path))
assert "alpha" in rendered
assert "Alpha rule" in rendered
assert "NON-DIRECTIVE CONTEXT" in rendered
assert "Project Rules" in rendered
assert rendered.index("alpha") < rendered.index("NON-DIRECTIVE CONTEXT")
def test_aggregate_non_directive_section_after_directives(self, tmp_path: Path):
directives_dir = tmp_path / "conductor" / "directives" / "beta"
directives_dir.mkdir(parents=True)
(directives_dir / "v1.md").write_text("# Beta rule\n\nDo beta.\n", encoding="utf-8")
context_file = tmp_path / "conductor" / "product.md"
context_file.parent.mkdir(parents=True, exist_ok=True)
context_file.write_text("# Product\n\nVision.\n", encoding="utf-8")
preset = tmp_path / "test_preset.md"
preset.write_text("""# Preset: test
## Directives to warm
- beta: conductor/directives/beta/v1.md
## Non-directive context
- product: conductor/product.md
""", encoding="utf-8")
rendered = aggregate_directives(str(preset), project_root=str(tmp_path))
assert "Beta rule" in rendered
assert "Product" in rendered
assert rendered.index("Beta rule") < rendered.index("NON-DIRECTIVE CONTEXT")
assert "product" in rendered.lower() or "Product" in rendered