Apply GH-DEC-2026-017 to the layer declaration and its checker.
layer.yaml drops standard_version (A12) and is marked derived: true, derived_from: INTENT.md (A11); INTENT.md frontmatter already carries the governing layer: Engine and no standard_version. The checker changes in the same commit: standard_version is no longer required and its presence is now malformed, the derived marking is required, the layer is compared against the closed four-token vocabulary after an ASCII fold (A9), and a divergence between INTENT.md and layer.yaml that survives the fold is reported. Nothing is re-spelled: Engine and engine both stand. The tests assert the fold rather than equality. pep-stance.yaml is untouched. 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
d2ddadccd9
commit
2ac4a36bdd
3 changed files with 149 additions and 13 deletions
|
|
@ -32,7 +32,7 @@ class LayerDeclarationTests(unittest.TestCase):
|
|||
def test_declares_engine_pip_in_own_voice(self):
|
||||
data = load_mapping(LAYER)
|
||||
self.assertEqual(data["repository"], "user-engine")
|
||||
self.assertEqual(data["layer"], "engine")
|
||||
self.assertEqual(_fold(data["layer"]), "engine")
|
||||
self.assertEqual(data["role"], "pip")
|
||||
self.assertEqual(data["tooling_contacts"], [])
|
||||
self.assertEqual(data["pep_stance"], "pep-stance.yaml")
|
||||
|
|
@ -44,8 +44,50 @@ class LayerDeclarationTests(unittest.TestCase):
|
|||
front = text.split("---", 2)[1]
|
||||
intent = load_mapping_text(front)
|
||||
decl = load_mapping(LAYER)
|
||||
self.assertEqual(intent["layer"].lower(), decl["layer"])
|
||||
self.assertEqual(intent["role"].lower(), decl["role"])
|
||||
# Assert the fold, not equality: neither form is re-spelled, and a
|
||||
# real layer divergence still fails (GH-DEC-2026-017 §2).
|
||||
self.assertEqual(_fold(intent["layer"]), _fold(decl["layer"]))
|
||||
self.assertEqual(_fold(intent["role"]), _fold(decl["role"]))
|
||||
|
||||
def test_sidecar_is_marked_derived_from_intent(self):
|
||||
decl = load_mapping(LAYER)
|
||||
self.assertIs(decl["derived"], True)
|
||||
self.assertEqual(decl["derived_from"], "INTENT.md")
|
||||
|
||||
def test_declaration_carries_no_standard_version(self):
|
||||
decl = load_mapping(LAYER)
|
||||
front = load_mapping_text((ROOT / "INTENT.md").read_text().split("---", 2)[1])
|
||||
self.assertNotIn("standard_version", decl)
|
||||
self.assertNotIn("standard_version", front)
|
||||
|
||||
def test_vocabulary_is_four_tokens_compared_after_fold(self):
|
||||
module = _checker()
|
||||
self.assertEqual(
|
||||
module.LAYER_VOCABULARY, {"taxonomy", "tooling", "engine", "staff"}
|
||||
)
|
||||
for token in ("Taxonomy", "TOOLING", "engine", "Staff"):
|
||||
self.assertIn(module.fold(token), module.LAYER_VOCABULARY)
|
||||
self.assertNotIn(module.fold("surface"), module.LAYER_VOCABULARY)
|
||||
|
||||
def test_checker_rejects_standard_version_and_divergence(self):
|
||||
module = _checker()
|
||||
good = load_mapping(LAYER)
|
||||
cases = {
|
||||
"standard_version": dict(good, standard_version="0.7"),
|
||||
"not derived": dict(good, derived=False),
|
||||
"divergent layer": dict(good, layer="staff"),
|
||||
}
|
||||
for label, data in cases.items():
|
||||
with self.subTest(label), patch.object(
|
||||
module, "load_mapping", return_value=data
|
||||
), patch("sys.stderr"):
|
||||
with self.assertRaises(SystemExit) as caught:
|
||||
module.load_declaration()
|
||||
self.assertEqual(caught.exception.code, 2)
|
||||
with patch.object(
|
||||
module, "load_mapping", return_value=dict(good, layer="ENGINE")
|
||||
):
|
||||
self.assertEqual(module.load_declaration()["layer"], "ENGINE")
|
||||
|
||||
def test_own_store_is_declared(self):
|
||||
data = load_mapping(LAYER)
|
||||
|
|
@ -163,6 +205,17 @@ class PepStanceTests(unittest.TestCase):
|
|||
LocalAuthorizationCheckPort()
|
||||
|
||||
|
||||
def _fold(value):
|
||||
return "".join(chr(ord(c) + 32) if "A" <= c <= "Z" else c for c in str(value))
|
||||
|
||||
|
||||
def _checker():
|
||||
spec = importlib.util.spec_from_file_location("check_layer_conformance", SCRIPT)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
def _request():
|
||||
from user_engine.domain import Actor, AuthorizationRequest, PrincipalType
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue