Apply GH-DEC-2026-017: INTENT.md governs, layer.yaml is derived, no version
Remove standard_version from layer.yaml and the INTENT.md frontmatter (A12), mark layer.yaml derived: true / derived_from: INTENT.md (A11), and change the conformance checker and its tests in the same commit so the conforming declaration does not fail as malformed. The checker now requires the INTENT.md layer: key, rejects standard_version in either form, checks the layer against the closed four-token vocabulary (A9), and reports a layer/role disagreement between the two forms after an ASCII case-fold. Nothing is re-spelled: INTENT.md keeps Engine/PIP and layer.yaml keeps engine/pip. pep-stance.yaml and pip-claims.yaml keep their standard_version; neither is a layer declaration. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 63291@bnt-lap001 Assistant-Session: 8bd77868-ca68-4f49-bb1e-d539ecc0d703
This commit is contained in:
parent
d132db064f
commit
d846eba65c
4 changed files with 103 additions and 15 deletions
|
|
@ -24,7 +24,8 @@ def test_layer_yaml_declares_engine_pip():
|
|||
assert data["repository"] == "tenant-engine"
|
||||
assert data["layer"] == "engine"
|
||||
assert data["role"] == "pip"
|
||||
assert data["standard_version"] == "0.7"
|
||||
assert data["derived"] is True
|
||||
assert data["derived_from"] == "INTENT.md"
|
||||
assert data["tooling_contacts"] == []
|
||||
assert data["pep_stance"] == "pep-stance.yaml"
|
||||
assert data["pip_claims"] == "pip-claims.yaml"
|
||||
|
|
@ -35,11 +36,48 @@ def test_layer_yaml_declares_engine_pip():
|
|||
assert "state-hub-work-records" in ids
|
||||
|
||||
|
||||
def _intent() -> dict:
|
||||
return yaml.safe_load((ROOT / "INTENT.md").read_text().split("---", 2)[1])
|
||||
|
||||
|
||||
def _fold(value: object) -> str:
|
||||
return str(value).translate(str.maketrans("ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
"abcdefghijklmnopqrstuvwxyz"))
|
||||
|
||||
|
||||
def test_intent_frontmatter_agrees_with_layer_yaml():
|
||||
intent = yaml.safe_load((ROOT / "INTENT.md").read_text().split("---", 2)[1])
|
||||
"""A11/A9: the derived form agrees with the governing one after a case-fold.
|
||||
|
||||
A fold, not an equality: INTENT.md says Engine and layer.yaml says engine,
|
||||
and neither is re-spelled. A real divergence still fails.
|
||||
"""
|
||||
intent = _intent()
|
||||
decl = yaml.safe_load((ROOT / "layer.yaml").read_text())
|
||||
assert str(intent["layer"]).lower() == str(decl["layer"]).lower()
|
||||
assert str(intent["role"]).lower() == str(decl["role"]).lower()
|
||||
assert _fold(intent["layer"]) == _fold(decl["layer"])
|
||||
assert _fold(intent["role"]) == _fold(decl["role"])
|
||||
assert _fold(intent["layer"]) in {"taxonomy", "tooling", "engine", "staff"}
|
||||
|
||||
|
||||
def test_no_declaration_carries_a_standard_version():
|
||||
"""GH-DEC-2026-017 / A12: neither form carries a standard version."""
|
||||
assert "standard_version" not in yaml.safe_load((ROOT / "layer.yaml").read_text())
|
||||
assert "standard_version" not in _intent()
|
||||
|
||||
|
||||
def test_checker_rejects_a_divergence_that_survives_the_fold(tmp_path, monkeypatch):
|
||||
spec = importlib.util.spec_from_file_location("check_layer_conformance", SCRIPT)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
assert spec.loader is not None
|
||||
spec.loader.exec_module(module)
|
||||
fake = tmp_path / "INTENT.md"
|
||||
fake.write_text("---\nlayer: Staff\nrole: PIP\n---\n")
|
||||
monkeypatch.setattr(module, "INTENT", fake)
|
||||
try:
|
||||
module.intent_frontmatter()
|
||||
except SystemExit as exc:
|
||||
assert exc.code == 2
|
||||
else: # pragma: no cover
|
||||
raise AssertionError("a Staff INTENT.md must not pass as Engine")
|
||||
|
||||
|
||||
def test_checker_passes_on_the_real_tree():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue