Files
chimera-gfx-Public/tests/test_retroarch_phase10bn.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

47 lines
2.2 KiB
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-or-later
"""Phase-1.0BN materializer preflight 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 Phase10BNGuardrails(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.data = json.loads((root / "manifests/retroarch/phase-1.0bn-materializer-preflight-patch-chain-audit.json").read_text(encoding="utf-8"))
def test_parent_and_exact_inputs(self) -> None:
parent = root / "manifests/retroarch/phase-1.0bm-real-facade-fixture-result.json"
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(), self.data["source_bindings"]["phase10bm_manifest_sha256"])
for key in ("smoke_patch_sha256", "early_diag_patch_sha256", "composition_sha256"):
self.assertRegex(self.data["source_bindings"][key], r"^[0-9a-f]{64}$")
def test_preflight_captures_real_blocker(self) -> None:
preflight = self.data["preflight"]
for key in ("sdl_commit_exact", "sdl_source_clean", "stage_absent", "build_absent", "archive_absent", "smoke_patch_applies_to_clean_source"):
self.assertTrue(preflight[key], key)
for key in ("early_diag_patch_applies_directly_to_clean_source", "current_request_graph_has_complete_patch_chain", "current_changed_file_set_complete", "current_cmake_contract_complete"):
self.assertFalse(preflight[key], key)
self.assertFalse(self.data["decision"]["preflight_passed"])
def test_only_offline_remediation_is_open(self) -> None:
auth = self.data["authorizations"]
self.assertTrue(auth["temporary_offline_patch_rebase_authorized"])
self.assertTrue(auth["corrected_contract_source_authorized"])
for key, value in auth.items():
if key not in ("temporary_offline_patch_rebase_authorized", "corrected_contract_source_authorized"):
self.assertFalse(value, key)
self.assertFalse(self.data["decision"]["materialization_allowed"])
if __name__ == "__main__":
unittest.main(argv=[__file__])