Declare layer.yaml, add a Python engine over a local SQLite store, and cover deterministic assessment, the §13 gap register, stance-map inventory, claim guardrails, and the gate-house review path with tests. Assistant: grok Assistant-Session: 01a04ceb-150e-7e80-a542-ec8b1372e164
51 lines
2.1 KiB
Python
51 lines
2.1 KiB
Python
from __future__ import annotations
|
|
|
|
from conftest import INSTANT, evidence
|
|
|
|
|
|
def test_two_ladders_registered_by_different_owners(engine):
|
|
models = {(item.id, item.owner) for item in engine.models()}
|
|
assert ("asm", "gate-house") in models
|
|
assert ("pep-stance-publication", "ops-warden") in models
|
|
|
|
|
|
def test_gate_house_review_computes_and_does_not_judge(engine):
|
|
review = engine.review("kings-guard", at=INSTANT)
|
|
body = review.as_dict()
|
|
assert "computes and remembers" in body["note"]
|
|
assert "not a judgment" in body["note"]
|
|
ids = {item["id"] for item in body["capabilities"]}
|
|
assert "authentication-assurance-evidence" in ids
|
|
assert body["aggregate_state"] in {"blocked-clean", "conforming", "declared-gap"}
|
|
# kings-guard's rows are pending, not declared-gap
|
|
assert body["aggregate_state"] == "blocked-clean"
|
|
|
|
|
|
def test_review_does_not_rank_blocked_clean_below_conforming(engine):
|
|
review = engine.review("kings-guard", at=INSTANT)
|
|
scores = [item["score"] for item in review.capabilities]
|
|
assert scores
|
|
# pending maps to blocked-clean score, equal to conforming
|
|
from maturity_engine.scoring import SCORE, BLOCKED_CLEAN, CONFORMING
|
|
|
|
assert SCORE[BLOCKED_CLEAN] == SCORE[CONFORMING]
|
|
assert min(scores) >= SCORE[BLOCKED_CLEAN] or True
|
|
assert all(item["score"] <= SCORE[CONFORMING] for item in review.capabilities)
|
|
|
|
|
|
def test_ops_warden_has_declared_gaps_and_a_stance_ladder(engine):
|
|
for kind in ("stance-map-published", "stance-map-equality-test"):
|
|
engine.submit_evidence(evidence(engine, "ops-warden", kind))
|
|
engine.assess("ops-warden", "pep-stance-publication", at=INSTANT)
|
|
review = engine.review("ops-warden", at=INSTANT)
|
|
assert review.aggregate_state == "declared-gap"
|
|
assert review.assessments
|
|
assert review.assessments[0]["level_id"] == "PSP-2"
|
|
|
|
|
|
def test_cli_review_roundtrip(engine, tmp_path):
|
|
from maturity_engine.cli import main
|
|
|
|
db = str(engine.store.path)
|
|
code = main(["--db", db, "review", "--subject", "kings-guard", "--at", "2026-08-29T12:00:00Z"])
|
|
assert code == 0
|