feat: implement institutional governance and recovery architecture
This commit is contained in:
@@ -28,6 +28,8 @@ from govoplan_release.version_alignment import candidate_catalog_version_issues
|
||||
from .evidence import (
|
||||
BoundaryEvidenceReview,
|
||||
InstalledEvidenceReview,
|
||||
PROOF_REQUIREMENTS,
|
||||
REFERENCE_READINESS_SCOPES,
|
||||
public_key_material_from_keyrings,
|
||||
review_boundary_evidence,
|
||||
review_installed_composition,
|
||||
@@ -929,9 +931,8 @@ def build_report(
|
||||
boundary_review.proof_scope
|
||||
if boundary_review is not None
|
||||
else {
|
||||
"target_environment": {"checked": False, "valid": None},
|
||||
"external_providers": {"checked": False, "valid": None},
|
||||
"production_approval": {"checked": False, "valid": None},
|
||||
scope: {"checked": False, "valid": None}
|
||||
for scope in PROOF_REQUIREMENTS
|
||||
}
|
||||
)
|
||||
proof_scope = {
|
||||
@@ -961,6 +962,24 @@ def build_report(
|
||||
**installed_scope,
|
||||
**boundary_scope,
|
||||
}
|
||||
missing_readiness = tuple(
|
||||
scope
|
||||
for scope in REFERENCE_READINESS_SCOPES
|
||||
if proof_scope.get(scope, {}).get("checked") is not True
|
||||
)
|
||||
failed_readiness = tuple(
|
||||
scope
|
||||
for scope in REFERENCE_READINESS_SCOPES
|
||||
if proof_scope.get(scope, {}).get("checked") is True
|
||||
and proof_scope.get(scope, {}).get("valid") is not True
|
||||
)
|
||||
proof_scope["reference_readiness"] = {
|
||||
"checked": not missing_readiness,
|
||||
"valid": not missing_readiness and not failed_readiness,
|
||||
"required_scopes": list(REFERENCE_READINESS_SCOPES),
|
||||
"missing_scopes": list(missing_readiness),
|
||||
"failed_scopes": list(failed_readiness),
|
||||
}
|
||||
return {
|
||||
"report_version": "0.5.0",
|
||||
"status": status,
|
||||
@@ -1043,9 +1062,8 @@ def render_review(report: dict[str, Any]) -> str:
|
||||
unchecked_boundaries = [
|
||||
label
|
||||
for key, label in (
|
||||
("target_environment", "target-environment"),
|
||||
("external_providers", "external-provider"),
|
||||
("production_approval", "production-approval"),
|
||||
(scope, scope.replace("_", "-"))
|
||||
for scope in PROOF_REQUIREMENTS
|
||||
)
|
||||
if report.get("proof_scope", {}).get(key, {}).get("checked") is not True
|
||||
]
|
||||
@@ -1057,6 +1075,18 @@ def render_review(report: dict[str, Any]) -> str:
|
||||
)
|
||||
if unchecked_boundaries:
|
||||
lines.append("No " + ", ".join(unchecked_boundaries) + " proof was performed.")
|
||||
readiness = report.get("proof_scope", {}).get("reference_readiness", {})
|
||||
if readiness.get("valid") is True:
|
||||
lines.append("Reference-readiness evidence gate: passed.")
|
||||
else:
|
||||
unresolved = [
|
||||
*readiness.get("missing_scopes", []),
|
||||
*readiness.get("failed_scopes", []),
|
||||
]
|
||||
lines.append(
|
||||
"Reference-readiness evidence gate: not established"
|
||||
+ (f" ({', '.join(dict.fromkeys(unresolved))})." if unresolved else ".")
|
||||
)
|
||||
return "\n".join(lines) + "\n"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user