Files
chimera-gfx-Public/tests/test_retroarch_phase10bo.py
Chimera GFX release export a6037502d7
phase0-ci / build-and-audit (push) Successful in 2m14s
Publish Chimera GFX source
2026-09-03 03:27:14 +02:00

51 lines
2.3 KiB
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-or-later
"""Phase-1.0BO patch-chain remediation guardrails."""
import argparse
import hashlib
import json
from pathlib import Path
import unittest
parser = argparse.ArgumentParser()
parser.add_argument("--root", type=Path, required=True)
root = parser.parse_args().root
class Phase10BOGuardrails(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.data = json.loads((root / "manifests/retroarch/phase-1.0bo-patch-chain-remediation-result.json").read_text(encoding="utf-8"))
def test_parent_and_corrected_sources_bound(self) -> None:
parent = root / "manifests/retroarch/phase-1.0bn-materializer-preflight-patch-chain-audit.json"
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(), self.data["source_bindings"]["phase10bn_manifest_sha256"])
for key in ("policy_sha256", "request_graph_sha256", "composition_sha256"):
self.assertRegex(self.data["source_bindings"][key], r"^[0-9a-f]{64}$")
def test_rebase_and_contract_are_complete(self) -> None:
evidence = self.data["rebase_evidence"]
for key in ("windows_checkout_crlf_rejected", "first_wsl_checkout_incomplete_rejected", "smoke_patch_dry_run_passed", "smoke_patch_applied", "early_diag_patch_dry_run_passed_after_smoke", "early_diag_patch_applied_after_smoke", "final_diff_check_passed"):
self.assertTrue(evidence[key], key)
self.assertEqual(len(evidence["exact_changed_files"]), 4)
contract = self.data["corrected_contract"]
self.assertEqual(contract["request_count"], 10)
for key, value in contract.items():
if key in ("retroarch_build_included", "device_action_included"):
self.assertFalse(value, key)
elif key != "request_count":
self.assertTrue(value, key)
def test_only_runner_source_is_open(self) -> None:
auth = self.data["authorizations"]
self.assertTrue(auth["one_shot_runner_source_authorized"])
for key, value in auth.items():
if key != "one_shot_runner_source_authorized":
self.assertFalse(value, key)
self.assertFalse(self.data["decision"]["materialization_allowed"])
if __name__ == "__main__":
unittest.main(argv=[__file__])