feat: add typed tier assurance guardrails
This commit is contained in:
parent
3d0f614f49
commit
c65a2f1ff9
13 changed files with 727 additions and 7 deletions
|
|
@ -1,8 +1,12 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from dataclasses import replace
|
||||
from pathlib import Path
|
||||
|
||||
from adaptive_pricing_core.governance import assess_tier_definition_assurance
|
||||
from adaptive_pricing_core.pricing_models import AssuranceClaim
|
||||
from observatory.api import build_dashboard_payload
|
||||
from observatory.load import load_pricing_models
|
||||
|
||||
DATA_DIR = Path(__file__).resolve().parent.parent / "data"
|
||||
|
||||
|
|
@ -46,3 +50,30 @@ def test_recommendations_include_governed_execution_gate() -> None:
|
|||
assert execution_gate["confidence"] == "0.88"
|
||||
assert execution_gate["risks"]
|
||||
assert execution_gate["supporting_observations"]
|
||||
|
||||
|
||||
def test_changed_assurance_claim_requires_one_time_definition_approval() -> None:
|
||||
previous = next(
|
||||
item for item in load_pricing_models(DATA_DIR) if item.id == "flat-899-eur-monthly"
|
||||
)
|
||||
current = replace(
|
||||
previous,
|
||||
assurance_claims=(
|
||||
AssuranceClaim(
|
||||
id="availability-tier",
|
||||
kind="availability",
|
||||
customer_wording="Survives a zone loss.",
|
||||
minimum_levels={"V": 3},
|
||||
delivering_service="railiance-platform",
|
||||
evidence_ref="evidence/zone-failover.json",
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
assessment = assess_tier_definition_assurance(current, previous)
|
||||
unchanged = assess_tier_definition_assurance(current, current)
|
||||
|
||||
assert assessment.decision == "approval_required"
|
||||
assert assessment.approvals[0].evidence_refs == ("evidence/zone-failover.json",)
|
||||
assert unchanged.decision == "proceed"
|
||||
assert unchanged.approvals == ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue