#!/usr/bin/env python3 """New fixture only; no production DB or compilation.""" import json import os import subprocess import time from pathlib import Path bench = Path(__file__).resolve().parents[1] root = (bench / "state/guard-smoke" / ("queue-" + str(time.time_ns()))).resolve() os.environ["BENCH_STATE_DIR"] = str(root / "db") from harness import paths from harness.stageworker import Worker jd = root / 'runs' / ('rSmoke' + str(time.time_ns())) / 'cls--smoke--nash-e--ptq--int8' rd = (jd / 'rollouts/01').resolve() for d in ['workspace', 'handles', 'agent', 'stages']: (rd / d).mkdir(parents=True) job = json.loads((bench / 'runs/r20260915-03/cls--resnet18--nash-e--ptq--int8/job.json').read_text()) job.update(run_id=jd.parent.name, job_id=jd.name) (jd / 'job.json').write_text(json.dumps(job)) (jd / 'data').mkdir() (jd / 'data/README').write_text('PUBLIC-DATA') work = paths.expand(paths.config()['paths']['work_root']) own_work = work / jd.parent.name / jd.name / 'r01' own_work.mkdir(parents=True) (own_work / 'probe-output').write_text('OWN-WORK') other_work = work / jd.parent.name / jd.name / 'r00' other_work.mkdir() (other_work / 'probe-output').write_text('OTHER-WORK') other = jd.parent / 'cls--resnet18--nash-m--ptq--int8/oracle' other.mkdir(parents=True) (other / 'result.json').write_text('{"secret":"OTHER-JOB-DECOY"}') (jd/'rollouts/00').mkdir() (jd/'rollouts/00/claim.json').write_text('{"secret":"SIBLING-DECOY"}') (rd / 'rollout.json').write_text('{}') (jd / 'oracle').mkdir() (jd / 'oracle/result.json').write_text('{"secret": "hidden"}') (rd/'workspace/smoke.yaml').write_text('calibration_parameters:\n calibration_type: default\n') print('fixture:', rd, flush=True) jail = [str(paths.BENCH_ROOT / 'scripts/agent_jail.sh'), str(rd), 'e2e', '--'] subprocess.run([str(paths.BENCH_ROOT/'scripts/jail_probe.sh'), str(rd)], check=True) with Worker(rd): cmd = f'{paths.BENCH_ROOT}/bin/bench stage run calibrate --config smoke.yaml' p = subprocess.run(jail + ['bash','-c', cmd], capture_output=True, text=True, check=True) hid = p.stdout.splitlines()[0] p = subprocess.run(jail + [str(paths.BENCH_ROOT/'bin/bench'), 'stage', 'wait', hid, '--poll', '1'], capture_output=True, text=True, timeout=60, check=True) print(p.stdout) status = json.loads((rd/'handles'/hid/'status.json').read_text()) assert status['state'] == 'DONE' and status['result'] == 'OK' print('QUEUE RESULT: OK (real calibrate; isolated fixture DB)', flush=True)