K8: record blocked owner review and release evidence

This commit is contained in:
2026-08-21 14:27:23 +08:00
parent 2ef2d82db3
commit b1b5a3cc8a
62 changed files with 171781 additions and 19 deletions

View File

@@ -0,0 +1,43 @@
import json
import sys
import unittest
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from generate_release_closure import generate
ROOT = Path(__file__).resolve().parents[1]
GATE = ROOT / "coverage/release-candidate-gate.report.json"
class ReleaseCandidateGateTests(unittest.TestCase):
def test_gate_contract_stops_release_on_explicit_blockers(self):
gate = json.loads(GATE.read_text(encoding="utf-8"))
self.assertEqual(gate["schema"], "release-candidate-gate.v1")
self.assertEqual(gate["status"], "blocked")
self.assertEqual(gate["release_decision"], "blocked_not_release_candidate")
self.assertEqual(gate["release_action"], "STOP_RELEASE")
self.assertFalse(gate["candidate_eligible"])
self.assertEqual(gate["blocked_count"], 6)
self.assertTrue(gate["checks"]["context_consistency"]["context_ids_match"])
self.assertEqual(gate["checks"]["locked_schema_contracts"]["status"], "verified")
self.assertEqual(gate["checks"]["license_source_index"]["status"], "verified")
self.assertEqual(gate["checks"]["migration_rollback_offline"]["status"], "verified")
self.assertEqual(gate["checks"]["release_prerequisites"]["status"], "blocked")
self.assertIn("official_oracle_missing", {blocker["id"] for blocker in gate["blockers"]})
license_blocker = next(blocker for blocker in gate["blockers"] if blocker["id"] == "license_closure_incomplete")
self.assertIn("57 Web/WASM", license_blocker["reason"])
self.assertEqual(gate["failure_policy"]["on_hash_mismatch"], "STOP_RELEASE")
def test_gate_generation_is_deterministic(self):
before = GATE.read_bytes()
generated = generate(ROOT, ROOT / "coverage")
after = GATE.read_bytes()
self.assertEqual(before, after)
self.assertEqual(generated["gate"]["report_sha256"], json.loads(after.decode())["report_sha256"])
if __name__ == "__main__":
unittest.main()