#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-3.0-or-later """Validate Phase-1.0AU against exact official Git objects.""" from __future__ import annotations import argparse import hashlib import json import subprocess from pathlib import Path def git(repo: Path, *args: str) -> str: return subprocess.run(["git", *args], cwd=repo, check=True, capture_output=True, text=True).stdout.strip() def check(repo: Path, commit: str, path: str, blob: str, size: int) -> None: spec = f"{commit}:{path}" assert git(repo, "rev-parse", spec) == blob assert int(git(repo, "cat-file", "-s", spec)) == size def main() -> int: parser = argparse.ArgumentParser() parser.add_argument("--root", type=Path, required=True) parser.add_argument("--sdk-root", type=Path, required=True) parser.add_argument("--shsrv-root", type=Path, required=True) args = parser.parse_args() path = args.root / "manifests/retroarch/phase-1.0au-live-channel-feasibility.json" data = json.loads(path.read_text(encoding="utf-8")) binding = data["source_bindings"] at_path = args.root / "manifests/retroarch/phase-1.0at-fd-deadline-model.json" assert hashlib.sha256(at_path.read_bytes()).hexdigest() == binding["phase10at_manifest_sha256"] sdk_paths = { "sdk_sys_unistd": "include/freebsd/sys/unistd.h", "sdk_unistd": "include/freebsd/unistd.h", "sdk_sys_fcntl": "include/freebsd/sys/fcntl.h", "sdk_time": "include/freebsd/time.h", "sdk_wait": "include/freebsd/sys/wait.h", "sdk_signal": "include/freebsd/signal.h", } for prefix, source in sdk_paths.items(): check(args.sdk_root, binding["sdk_commit"], source, binding[f"{prefix}_blob"], binding[f"{prefix}_size"]) shsrv_paths = {"shsrv_builtin": "builtin.c", "shsrv_shell": "sh.c", "shsrv_service": "shsrv.c"} for prefix, source in shsrv_paths.items(): check(args.shsrv_root, binding["shsrv_commit"], source, binding[f"{prefix}_blob"], binding[f"{prefix}_size"]) assert data["public_source_contracts"]["source_level_design_inputs_complete"] is True assert data["official_composition_audit"]["worker_uses_rffdg"] is False assert data["official_composition_audit"]["worker_uses_rfcfdg_close_all"] is True assert not any(data["authorizations"].values()) assert data["decision"]["live_result_channel_implementation_allowed"] is False print("Phase-1.0AU live-channel feasibility validation passed") return 0 if __name__ == "__main__": raise SystemExit(main())