#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-3.0-or-later """Tracked guardrails for Phase-1.0AY.""" from __future__ import annotations import argparse 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 Phase10AYGuardrails(unittest.TestCase): @classmethod def setUpClass(cls) -> None: path = ROOT / "manifests/retroarch/phase-1.0ay-target-source-base.json" cls.data = json.loads(path.read_text(encoding="utf-8")) def test_base_preserves_m_and_inactive_n(self) -> None: base = self.data["base_selection"] self.assertTrue(base["selected_commit_descends_from_phase10m_source"]) self.assertTrue(base["target_source_blobs_unchanged_from_phase10m"]) self.assertTrue(base["selected_commit_contains_inactive_phase10n_runner"]) self.assertTrue(base["existing_runner_must_remain_inactive"]) self.assertTrue(base["separate_worktree_required"]) def test_scope_is_host_only(self) -> None: scope = self.data["permitted_patch_scope"] self.assertTrue(scope["host_tests_only"]) for key in ("launcher_compile_define", "target_profile", "cross_build", "artifact", "live_runner_activation"): self.assertFalse(scope[key]) def test_authority_and_artifact_gates_are_closed(self) -> None: self.assertFalse(any(self.data["authorizations"].values())) self.assertFalse(self.data["decision"]["target_profile_allowed"]) self.assertFalse(self.data["decision"]["target_artifact_build_allowed"]) self.assertFalse(self.data["decision"]["device_action_allowed"]) if __name__ == "__main__": unittest.main(argv=[__file__])