generated from coulomb/repo-seed
Implement governance workflows and close WP-0008
This commit is contained in:
48
projects/coulomb-pricing/tests/test_governance.py
Normal file
48
projects/coulomb-pricing/tests/test_governance.py
Normal file
@@ -0,0 +1,48 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from observatory.api import build_dashboard_payload
|
||||
|
||||
DATA_DIR = Path(__file__).resolve().parent.parent / "data"
|
||||
|
||||
|
||||
def test_governance_payload_contains_policy_health_and_audit_surfaces() -> None:
|
||||
payload = build_dashboard_payload(DATA_DIR, "2026-06")
|
||||
governance = payload["governance"]
|
||||
|
||||
assert governance["policy"]["policy_id"] == "coulomb-governance-v1"
|
||||
assert governance["publication_assessment"]["decision"] == "approval_required"
|
||||
assert governance["audit_surface"]["provider"] == "stripe"
|
||||
assert governance["audit_surface"]["revision_count"] == 0
|
||||
assert any(
|
||||
check["id"] == "provider-execution-health" and check["status"] == "warn"
|
||||
for check in governance["health_checks"]
|
||||
)
|
||||
|
||||
|
||||
def test_safe_tuning_contract_stays_pilot_only_and_hides_customer_visibility() -> None:
|
||||
payload = build_dashboard_payload(DATA_DIR, "2026-06")
|
||||
contract = next(
|
||||
item
|
||||
for item in payload["governance"]["safe_tuning_contracts"]
|
||||
if item["model_id"] == "membership-plus-overage"
|
||||
)
|
||||
|
||||
assert contract["mode"] == "pilot_only"
|
||||
assert contract["customer_visible"] is False
|
||||
assert any(example["outcome"] == "accepted" for example in contract["examples"])
|
||||
assert all(example["visible_to_customer"] is False for example in contract["examples"])
|
||||
|
||||
|
||||
def test_recommendations_include_governed_execution_gate() -> None:
|
||||
payload = build_dashboard_payload(DATA_DIR, "2026-06")
|
||||
execution_gate = next(
|
||||
item for item in payload["recommendations"] if item["id"] == "execution-governance-gate"
|
||||
)
|
||||
|
||||
assert execution_gate["recommendation_type"] == "execution"
|
||||
assert execution_gate["governance"]["decision"] == "approval_required"
|
||||
assert execution_gate["confidence"] == "0.88"
|
||||
assert execution_gate["risks"]
|
||||
assert execution_gate["supporting_observations"]
|
||||
Reference in New Issue
Block a user