52 lines
3.4 KiB
Python
52 lines
3.4 KiB
Python
"""Metadata-only v0.4 contract preparation, keeping all original exact evidence."""
|
|
from pathlib import Path
|
|
import numpy as np
|
|
import scipy
|
|
from s2_recovery_supervisor import save
|
|
from s3b_v04_runtime import ROOT,RULE,CLARIFICATION,OLD_CPU,read,sha,checked
|
|
from s3b_v04_math import PARAMETERS
|
|
|
|
|
|
def main():
|
|
if ROOT.exists():raise FileExistsError('Never replace v0.4 attempt root')
|
|
old=Path('artifacts/s3b-a-ten-part-2026-11-15')
|
|
original=read(old/'contract.json');terminal=read(old/'complete.json')
|
|
if terminal['status']!='TEN_STOPPED' or terminal['worker_CPU_s']!=OLD_CPU:raise ValueError('Original ledger mismatch')
|
|
for p,h in {**original['code_sha256'],**original['source_sha256']}.items():checked(p,h)
|
|
receipts=sorted(Path('artifacts/s3b-a-v04-synthetic-2026-11-15').glob('attempt-*/synthetic.receipt.json'))
|
|
if not receipts or read(receipts[-1])['status']!='PASS':raise ValueError('No new synthetic acceptance')
|
|
references=[]
|
|
for i in range(3):
|
|
dest=old/'parts'/f'part-{i:02d}'/'output';result=read(dest/'result.json')
|
|
if result['status']!='COMPLETE':raise ValueError('Incomplete reference')
|
|
references.append(dict(index=i,case=original['ten_parts'][i]['case'],
|
|
result=str(dest/'result.json'),result_sha256=sha(dest/'result.json'),
|
|
field=str(dest/'event-field.npz'),field_sha256=sha(dest/'event-field.npz')))
|
|
sources=[old/'contract.json',old/'complete.json',Path(original['roster']),
|
|
Path('docs/s3b-a-v0.4-paper-draft-2026-11-15.md'),
|
|
Path('docs/s3b-a-v0.4-approved-contract-2026-11-15.md'),*receipts]
|
|
code=[Path('tools')/name for name in ['s3b_v04_math.py','s3b_v04_runtime.py','run_s3b_v04_part.py',
|
|
'run_s3b_v04_ten.py','prepare_s3b_v04_ten.py','test_s3b_v04.py',
|
|
's3b_graph.py','s3b_runtime.py','test_s3b_graph.py','boundary_distance.py',
|
|
's2_recovery_supervisor.py','s2_recovery_monitoring.py']]
|
|
c=dict(version='S3B-a-volume-batch-v04-ten-v1',authorizing_ruling=RULE,clarification=CLARIFICATION,
|
|
accepted_draft_sha256='429bf06cf8961b42ba52352d1d74feda49854bdb3c426632915a6f8b2ada71d9',
|
|
old_stop_commit='d9c481d87c9b53e6af33885e30ce597472d8d5ca',
|
|
roster=original['roster'],roster_sha256=original['roster_sha256'],ten_parts=original['ten_parts'],
|
|
all_cases=original['all_cases'],total_nodes=original['total_nodes'],exact_references=references,
|
|
candidate_order=['splu','gmres_ilu'],parameters=PARAMETERS,worker_cpu=16,coordinator_cpus=[30,31],
|
|
old_worker_CPU_s=OLD_CPU,new_synthetic_worker_CPU_s=sum(read(p)['cpu_seconds'] for p in receipts),
|
|
limits=dict(total_worker_CPU_s=72000,postfit_reserve_CPU_s=7200,
|
|
part_CPU_s=1800,part_wall_s=1800,part_RSS_bytes=4*2**30,
|
|
ten_disk_bytes=5*2**30,total_disk_bytes=20*2**30,workers=1,processes_per_worker=1),
|
|
numpy_version=np.__version__,scipy_version=scipy.__version__,
|
|
label_policy='same exact geometry file allowlist; no labels in prediction',
|
|
stage='candidate ten only; then approved reference and full-count cost gates before full617',
|
|
source_sha256={str(p):sha(p) for p in sources},code_sha256={str(p):sha(p) for p in code})
|
|
checked('docs/s3b-a-v0.4-paper-draft-2026-11-15.md',c['accepted_draft_sha256'])
|
|
ROOT.mkdir();save(ROOT/'contract.json',c)
|
|
print(dict(root=str(ROOT),contract_sha256=sha(ROOT/'contract.json'),new_synthetic_worker_CPU_s=c['new_synthetic_worker_CPU_s']))
|
|
|
|
|
|
if __name__=='__main__':main()
|