from pathlib import Path import subprocess,json,datetime,re,sys,hashlib ROOT=Path(__file__).resolve().parents[5] PDF="C:/Users/Connor/.cache/codex-runtimes/codex-primary-runtime/dependencies/python/python.exe" if sys.platform=='win32' else sys.executable out=Path(sys.argv[1]).resolve() assert out.is_relative_to(ROOT/".artifacts/p9-sec-02") assert not (out/"result.json").exists(), "Preserve previous evidence." root=out/'linux/fidelity' files=[root/'long-skills-minimal-en/measurements.json',root/'long-skills-technical-nb/measurements.json'] records=[json.loads(p.read_text(encoding='utf-8')) for p in files] assert len({r['browserVersion'] for r in records})==1 fixtures=[f for r in records for f in r['fixtures']] assert {f['fixture'] for f in fixtures}=={'long-skills-minimal-en','long-skills-technical-nb'} assert len(fixtures)==2 (root/'measurements.json').write_text(json.dumps({'browserVersion':records[0]['browserVersion'],'fixtures':fixtures},indent=2,ensure_ascii=False)+'\n',encoding='utf-8') inputs={str(path.resolve()):hashlib.sha256(path.read_bytes()).hexdigest() for path in root.rglob('*') if path.is_file()} inputs[str((ROOT/'scripts/verify-cv-fidelity.py').resolve())]='64f82e622cc11483c33307d987e969f6cf27f82ab6bdbd72c2aeb1bfbceade87' assert all(hashlib.sha256(Path(name).read_bytes()).hexdigest()==digest for name,digest in inputs.items()) (out/'oracle-inputs.json').write_text(json.dumps({'inputs':inputs},indent=2)+'\n',encoding='utf-8') with (out/'oracle.log').open('w',encoding='utf-8') as log: result=subprocess.run(['rtk','proxy',PDF,'-B','scripts/verify-cv-fidelity.py',str(root)],cwd=ROOT,stdout=log,stderr=subprocess.STDOUT) record={'oracleExitCode':result.returncode,'status':'PASS' if result.returncode==0 else 'FAIL','scope':'Two supplemental real-MariaDB/Linux long-skill fixtures, separate from original24 and ordinary362.','observedUtc':datetime.datetime.now(datetime.timezone.utc).isoformat()} report=json.loads((root/'fidelity-results.json').read_text(encoding='utf-8')) assert all(hashlib.sha256(Path(name).read_bytes()).hexdigest()==digest for name,digest in inputs.items()),'Oracle input drift' record['inputs']=inputs record['reportSha256']=hashlib.sha256((root/'fidelity-results.json').read_bytes()).hexdigest() assert report['total']==2 and {f['fixture'] for f in report['fixtures']}=={f['fixture'] for f in fixtures} record['cases']=report['fixtures'] for case in report['fixtures']: text='\n'.join(p['text'] for p in case['pages']) assert set(re.findall(r'\bS\d{2}\b',text))=={f'S{i:02}' for i in range(1,65)},case['fixture'] assert 'Åse' in text and 'Østby' in text,case['fixture'] assert text.count('Åse')==1,case['fixture'] assert all(value not in text for value in ['file://','http://localhost','document.html']),case['fixture'] assert not re.search(r'\b(?:20\d\d[-/.]\d{1,2}[-/.]\d{1,2}|\d{1,2}[-/.]\d{1,2}[-/.](?:20)?\d{2})\b',text),case['fixture'] (out/'result.json').write_text(json.dumps(record,indent=2,ensure_ascii=False)+'\n',encoding='utf-8') print('Supplemental long-skills/header-footer proof:',record['status'],flush=True) raise SystemExit(result.returncode)