"""Coordinator-authorized local hash checks: no worker Git subprocess.""" import json from pathlib import Path from phase2_h1_worker_v2 import contract,checked,sha def engineering(root): c=json.loads((Path(root)/'engineering-contract.json').read_text()) if c['approval']!='1794892722.876299':raise PermissionError('Missing labelled recovery ruling') for p,h in c['code_sha256'].items():checked(p,h) return c def verified_gate(root,phase): root=Path(root);engineering(root) authorization=json.loads((root/(phase+'-authorization.json')).read_text()) checked(root/'engineering-contract.json',authorization['engineering_sha256']) proof_path=root/(phase+'-git-freeze.json');checked(proof_path,authorization['proof_sha256']) proof=json.loads(proof_path.read_text()) if proof['commit']!=authorization['verified_git_commit']:raise PermissionError('Git coordinator authorization differs') for name,digest in proof['sha256'].items():checked(root/name,digest) return proof def scoring_gate(root): c=contract(root);verified_gate(root,'scoring') frozen=json.loads((Path(root)/'predictions-freeze.json').read_text()) if not frozen['all_prediction_attempts_terminal'] or not frozen['accounting_complete']:raise PermissionError('Prediction barrier missing') return c,frozen