32 lines
3.7 KiB
Python
32 lines
3.7 KiB
Python
"""Metadata-only preparation for Claude6078; never opens target arrays."""
|
|
import time
|
|
from pathlib import Path
|
|
from s2_tail_diagnostic import BASE,ROOT,read,save,sha
|
|
|
|
def main():
|
|
start=time.process_time()
|
|
if ROOT.exists():raise FileExistsError('Existing diagnostic root: inspect before any action')
|
|
s=Path('/home/frank14f/MeltMind-runs/phase2-h2-s2-postfit-2026-11-17');c=read(s/'contract.json');p=read(c['pilot_contract']);m=read(s/'predictions-manifest.json')['entries'];a=read(BASE/'artifacts/phase2-b13-e1b-2026-11-17/contract.json')['A_predictions'];oldrows={r['case']:r for r in c['rows']}
|
|
if read(s/'complete.json')['status']!='COMPLETE' or len(m)!=552 or len({e['case'] for e in m})!=552 or len({e['component_id'] for e in m})!=204:raise ValueError('Original completed S2 roster')
|
|
proof=read(s/'predictions-git-freeze.json')
|
|
if proof['files'][str(s/'predictions-manifest.json')]!=sha(s/'predictions-manifest.json'):raise ValueError('Original frozen prediction manifest')
|
|
parts=[]
|
|
for e in sorted(m,key=lambda e:e['case']):
|
|
case=e['case'];cache=p['parts'][case];aa=a[case];g=p['geometry'][case];row=oldrows[case]
|
|
if aa['protocol']!='grouped' or aa['pool']!=100 or aa['fold']!=e['fold'] or aa['nodes']!=e['nodes'] or g['nodes']!=e['nodes'] or row['component_id']!=e['component_id']:raise ValueError('A/H2 same domain and role')
|
|
sources={name:dict(path=d['path'],sha256=d['sha256']) for name,d in [('A',aa),('H2',e),('geometry',g)]}
|
|
for key,name in [('truth','seconds'),('mass','mass'),('raw_ids','raw_ids')]:sources[key]=dict(path=str((BASE/Path(cache['output'])/(name+'.npy')).resolve()),sha256=cache['output_sha256'][name+'.npy'])
|
|
for v in sources.values():
|
|
if not Path(v['path']).is_file():raise FileNotFoundError(v['path'])
|
|
parts.append(dict(case=case,component_id=e['component_id'],fold=e['fold'],nodes=e['nodes'],t_set=cache['t_set'],sources=sources))
|
|
spec=BASE/'references/2026-11-18/phase3-item-c/mold-tail-volume-peak-stability-spec.md'
|
|
if sha(spec)!='05344bacd877de87cbde9eb18139ad124e6cd4a15659e3c469b655b3f5a3f521':raise ValueError('Spec identity')
|
|
names=['s2_tail_diagnostic_math.py','s2_tail_diagnostic.py','s2_tail_diagnostic_guard.py','prepare_s2_tail_diagnostic.py','test_s2_tail_diagnostic.py','r4bc_guard.py','s2_recovery_supervisor.py','s2_recovery_monitoring.py']
|
|
codes={str(BASE/'tools'/n):sha(BASE/'tools'/n) for n in names};codes[str(BASE/'docs/s2-tail-diagnostic-plan-2026-11-18.md')]=sha(BASE/'docs/s2-tail-diagnostic-plan-2026-11-18.md')
|
|
ROOT.mkdir();plan=dict(approval='1794966078.809549',spec_path=str(spec),spec_sha256=sha(spec),descriptive_only=True,gate=None,cpu_cap=3600,worker_cpu_cap=3300,setup_reserve=180,worker_cpu=24,coordinator_cpu=25,worker_rss_bytes=4*2**30,worker_wall_seconds=7200,parts=parts,code_sha256=codes,S2_score=dict(path=str(s/'score/result.json'),sha256=sha(s/'score/result.json')),metadata_sources={str(q):sha(q) for q in [s/'contract.json',s/'predictions-manifest.json',s/'predictions-git-freeze.json',s/'complete.json',Path(c['pilot_contract']),BASE/'artifacts/phase2-b13-e1b-2026-11-17/contract.json']},new_fits=0,new_predictions=0,no_retry=True,light_review_before_targets=True,original_S2_decision_unchanged=True)
|
|
plan.update(coordinator_cpu_limit=90,shutdown_cpu_reserve=30)
|
|
save(ROOT/'plan.json',plan)
|
|
save(ROOT/'preparation.json',dict(status='PREPARED_NO_TARGET_ARRAYS_READ',parts=552,components=204,source_file_existence_checked=True,array_values_read=False,source_hashes_rechecked_at_execution=True,review_pending=True,launched=False,preparation_cpu_seconds=time.process_time()-start,unix=time.time()))
|
|
print(dict(root=str(ROOT),plan_sha256=sha(ROOT/'plan.json'),code_files=len(codes),parts=552,components=204,review_pending=True))
|
|
if __name__=='__main__':main()
|