swayfx-mosaic/tooling/probes/step20c-targeted-diagnostic/prepare.py
fy59 ed9375797e test(mosaic): record targeted STEP20C partial closure
Record exact-SHA scale and extended G samples, same-source blur measurements
and retained negative saved/input results. Keep STEP20C NEXT and production
multi-output unsupported; no production integration.

Preserve immutable probe fixtures, offline regressions and compact artifact
provenance. Fourteen consumed runs / 125 output captures, independent final
audit accepted. Saved timeout/GPU lifetime, whole-H1 return, input after camera
mutation and all-frame damage remain open.
2026-10-14 07:00:33 +02:00

24 lines
1.9 KiB
Python

#!/usr/bin/env python3
"""Prepare review inputs only; never build, stage, accept, or launch."""
import argparse,json,subprocess,shutil
from diagnostic import *
def main():
p=argparse.ArgumentParser();p.add_argument('--lab',type=Path,required=True);a=p.parse_args();lab=gate.owned(a.lab);gate.verify(lab)
diag=lab/'diagnostic';need(diag.is_dir(),'existing same laboratory diagnostic directory')
registration_path=lab/'diagnostic-registration.json'
expected=dict(scope=SCOPE,spec=SPEC)
if registration_path.exists():need(gate.read(registration_path)==expected,'unchanged fixed registration')
else:gate.durable(registration_path,expected,True)
# Copy only reviewed Python/README bytes; never regenerate the passive C.
copy=diag/'diagnostic-source';copy.mkdir(exist_ok=True)
for path in HERE.iterdir():
if path.is_file():shutil.copy2(path,copy/path.name)
env={**os.environ,'PYTHONDONTWRITEBYTECODE':'1'};cmd=[sys.executable,str(HERE/'test_diagnostic.py')]
run=subprocess.run(cmd,env=env,capture_output=True,text=True);raw=run.stdout+run.stderr;(diag/'offline.stdout').write_text(raw)
receipt=dict(command=cmd,exit=run.returncode,status='PASS' if run.returncode==0 else 'FAIL',executed=int(re.search(r'Ran (\d+) tests',raw)[1]),raw_sha256=gate.sha(diag/'offline.stdout'),sources={str(p):gate.sha(p) for p in HERE.iterdir() if p.is_file()})
gate.durable(diag/'offline.json',receipt,True);need(run.returncode==0,'offline tests')
need(gate.read(diag/'syntax-check.json')['exit']==0,'C17 syntax check')
gate.durable(diag/'preparation-freeze.json',dict(scope=SCOPE,status='READY_FOR_INDEPENDENT_REVIEW',spec=SPEC,files=bindings(lab)),True)
gate.verify(lab);print(json.dumps(dict(status='READY_FOR_INDEPENDENT_REVIEW',freeze_sha256=gate.sha(diag/'preparation-freeze.json'),runtime='NOT RUN',build='NOT RUN')))
if __name__=='__main__':main()