#!/usr/bin/env python3
"""Mandatory actual native team OVR calibration and preserved transfer ABI suite."""
from pathlib import Path
import argparse,subprocess,json,hashlib
ap=argparse.ArgumentParser();ap.add_argument('rom',type=Path);ap.add_argument('output',type=Path);a=ap.parse_args();o=a.output.resolve();o.mkdir(parents=True,exist_ok=True);h=Path(__file__).resolve().parent;checks=[]
for name in ['team_ovr_cases','refinement_overall']:
 with(o/(name+'.log')).open('w')as f:r=subprocess.run(['python3',str(h/'testcases'/(name+'.py')),str(a.rom.resolve()),str(o/name)],stdout=f,stderr=f,timeout=900)
 checks.append(dict(name=name,returncode=r.returncode));assert r.returncode==0,('team OVR release blocked',name)
(o/'results.json').write_text(json.dumps(dict(status='passed',ROM_sha256=hashlib.sha256(a.rom.read_bytes()).hexdigest(),checks=checks),indent=2)+'\n');print('PASS team OVR native club grade plus roster-mean delta for32 clubs, matched mixed-metric negative, original transfer/Allstar/foreign ABI contexts',flush=True)
