#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-3.0-or-later """Validate exact Phase-1.0AV offline canary bindings.""" from __future__ import annotations import argparse import hashlib import json from pathlib import Path def digest(path: Path) -> str: return hashlib.sha256(path.read_bytes()).hexdigest() def main() -> int: parser = argparse.ArgumentParser() parser.add_argument("--root", type=Path, required=True) args = parser.parse_args() root = args.root path = root / "manifests/retroarch/phase-1.0av-launch-context-canary-contract.json" data = json.loads(path.read_text(encoding="utf-8")) binding = data["source_bindings"] assert digest(root / "manifests/retroarch/phase-1.0au-live-channel-feasibility.json") == binding["phase10au_manifest_sha256"] assert digest(root / "tools/phase10av_launch_context_canary.py") == binding["contract_sha256"] assert digest(root / "tests/test_phase10av_launch_context_canary.py") == binding["tests_sha256"] assert data["pair_contract"]["same_payload_sha256_required"] is True assert data["result_contract"]["distinct_terminal_after_d04_required"] is True assert data["interpretation_limits"]["submit_zero_means_visible_flip"] is False assert not any(data["authorizations"].values()) assert not any(value is not None for key, value in data["tracked_state"].items() if key.endswith("sha256") or key in {"raw_run_id", "bigapp_run_id", "target_address", "target_port"}) assert data["decision"]["causal_hardware_comparison_ready"] is False print("Phase-1.0AV launch-context canary validation passed") return 0 if __name__ == "__main__": raise SystemExit(main())