Apply GH-DEC-2026-017 to the layer declaration and its checker.
All checks were successful
CI Smoke / host-smoke (push) Successful in 1s
CI Smoke / container-smoke (push) Successful in 2s
Account journey acceptance / journeys (push) Successful in 8s

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:
tegwick 2026-09-21 07:35:16 +02:00
parent d2ddadccd9
commit 2ac4a36bdd
3 changed files with 149 additions and 13 deletions

View file

@ -3,6 +3,7 @@
Read-only. user-engine is Engine/PIP and holds no catalogued Tooling client.
PostgreSQL is the modeled-concept store, declared under own_store.
INTENT.md frontmatter governs the layer; layer.yaml is its derived form.
The failure this exists to catch is a convenience: an OpenBao, Vault, LDAP,
or cluster client arriving as one import. That is an undeclared violation.
@ -19,9 +20,10 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
SRC = ROOT / "src" / "user_engine"
DECL = ROOT / "layer.yaml"
INTENT = ROOT / "INTENT.md"
sys.path.insert(0, str(ROOT / "src"))
from user_engine.layer_yaml import load_mapping # noqa: E402
from user_engine.layer_yaml import load_mapping, load_mapping_text # noqa: E402
TOOLING_IMPORTS = {
"hvac": "OpenBao / Vault client",
@ -43,6 +45,40 @@ OWN_STORE_IMPORTS = {
}
# §3's vocabulary is closed at four tokens and compared after an ASCII
# case-fold (GH-DEC-2026-017 §2, §3, amendment A9). Nothing is re-spelled.
LAYER_VOCABULARY = {"taxonomy", "tooling", "engine", "staff"}
def fold(value: object) -> str:
"""ASCII case-fold only: non-ASCII letters are left untouched."""
return "".join(
chr(ord(c) + 32) if "A" <= c <= "Z" else c for c in str(value).strip()
)
def load_intent_layer() -> str:
"""Return the governing `layer:` value from INTENT.md frontmatter (§11)."""
try:
text = INTENT.read_text()
except OSError as exc:
print(f"FAIL: cannot read {INTENT.name}: {exc}", file=sys.stderr)
raise SystemExit(2) from exc
parts = text.split("---", 2)
if not text.startswith("---") or len(parts) < 3:
print(f"FAIL: {INTENT.name} has no frontmatter (§11)", file=sys.stderr)
raise SystemExit(2)
try:
front = load_mapping_text(parts[1])
except ValueError as exc:
print(f"FAIL: {INTENT.name} frontmatter is not parseable: {exc}", file=sys.stderr)
raise SystemExit(2) from exc
if "layer" not in front:
print(f"FAIL: {INTENT.name} frontmatter has no 'layer:' key (§11)", file=sys.stderr)
raise SystemExit(2)
return str(front["layer"])
def load_declaration() -> dict:
if not DECL.exists():
print(f"FAIL: no declaration at {DECL.relative_to(ROOT)} (§11)", file=sys.stderr)
@ -52,13 +88,46 @@ def load_declaration() -> dict:
except (ValueError, OSError) as exc:
print(f"FAIL: {DECL.name} is not parseable: {exc}", file=sys.stderr)
raise SystemExit(2) from exc
for key in ("layer", "role", "repository", "tooling_contacts", "standard_version"):
# No standard_version: a layer declaration MUST NOT carry one
# (GH-DEC-2026-017 §4, amendment A12). Its presence is malformed.
for key in ("layer", "role", "repository", "tooling_contacts", "derived", "derived_from"):
if key not in data:
print(f"FAIL: {DECL.name} missing required key '{key}' (§11)", file=sys.stderr)
raise SystemExit(2)
if data["layer"] != "engine":
if "standard_version" in data:
print(
f"FAIL: declared layer is {data['layer']!r}, expected 'engine'",
f"FAIL: {DECL.name} carries standard_version; a layer declaration "
"MUST NOT carry a standard version (GH-DEC-2026-017, A12)",
file=sys.stderr,
)
raise SystemExit(2)
if data["derived"] is not True or data["derived_from"] != "INTENT.md":
print(
f"FAIL: {DECL.name} must be marked derived: true, derived_from: INTENT.md "
"(§11 derived-artifact rule, GH-DEC-2026-017, A11)",
file=sys.stderr,
)
raise SystemExit(2)
if fold(data["layer"]) not in LAYER_VOCABULARY:
print(
f"FAIL: declared layer {data['layer']!r} is not a §3 token "
f"({', '.join(sorted(LAYER_VOCABULARY))}, case-insensitive)",
file=sys.stderr,
)
raise SystemExit(2)
intent_layer = load_intent_layer()
if fold(intent_layer) != fold(data["layer"]):
# A finding in its own right; INTENT.md governs but the disagreement
# is reported, not resolved away by precedence (A11).
print(
f"FAIL: INTENT.md declares layer {intent_layer!r} but {DECL.name} "
f"declares {data['layer']!r}; they disagree after case-folding",
file=sys.stderr,
)
raise SystemExit(2)
if fold(intent_layer) != "engine":
print(
f"FAIL: declared layer is {intent_layer!r}, expected Engine",
file=sys.stderr,
)
raise SystemExit(2)
@ -120,8 +189,8 @@ def main() -> int:
if args.report:
print(
f"user-engine — layer {decl['layer']}/{decl['role']}, "
f"standard v{decl['standard_version']}"
f"user-engine — layer {decl['layer']}/{decl['role']} "
f"(derived from {decl['derived_from']})"
)
print(" tooling contacts declared: 0")
print(f" own-store declarations: {len(own_store)}")