Assistant: codex Assistant-Model: gpt-6.1-sol Assistant-Session: 01a126e1-76f8-7643-8cf3-e93336539ade
46 lines
1.8 KiB
Python
46 lines
1.8 KiB
Python
"""Accepted A12 r3 semantics, retaining local contact scanners and scope."""
|
|
import importlib.util
|
|
from pathlib import Path
|
|
import pytest
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
SCRIPT = ROOT / "scripts/check_layer_conformance.py"
|
|
|
|
def checker():
|
|
spec = importlib.util.spec_from_file_location("v08_checker", SCRIPT)
|
|
module = importlib.util.module_from_spec(spec)
|
|
spec.loader.exec_module(module)
|
|
return module
|
|
|
|
@pytest.mark.parametrize("value,pinned", [
|
|
({"intent_version": "0.3"}, False),
|
|
({"spec_version": "0.7"}, False),
|
|
({"note": "per v0.6 section 13"}, False),
|
|
({"note": "revised 0.7 wording"}, False),
|
|
({"schema_version": "0.1"}, False),
|
|
({"standard": "security-layer-model 0.8"}, True),
|
|
({"STANDARD": ["security-layer-model v0.8"]}, True),
|
|
({"companion": [["SECURITY-COMPANION v0.3"]]}, True),
|
|
({"nested": {"standard_version": "0.8"}}, True),
|
|
({"nested": {"companion_version": "0.3"}}, True),
|
|
({"references": ["security-layer-model@0.8"]}, True),
|
|
({"references": ["security-layer-model_v0.7.md"]}, True),
|
|
])
|
|
def test_reference_pin_provenance_semantics(value, pinned):
|
|
module = checker()
|
|
assert bool(module.find_versions(value, "test")) is pinned
|
|
|
|
def test_run_names_exact_accepted_standard_and_scope():
|
|
module = checker()
|
|
assert "security-layer-model_v0.8.md" in module.VALIDATED_AGAINST
|
|
assert "3d8298560069ef471fba28d2b1245fb2309328f231dad1a667cdf0ce5a5a7c8b" in module.VALIDATED_AGAINST
|
|
assert "INTENT.md" in module.SCOPE
|
|
|
|
def test_governing_role_disagreement_is_a_finding(tmp_path, monkeypatch):
|
|
module = checker()
|
|
intent = tmp_path / "INTENT.md"
|
|
intent.write_text("---\nlayer: Engine\nrole: PDP\n---\n")
|
|
monkeypatch.setattr(module, "INTENT", intent)
|
|
with pytest.raises(SystemExit) as caught:
|
|
module.load_intent_layer()
|
|
assert caught.value.code == 2
|