31 lines
4.2 KiB
Python
31 lines
4.2 KiB
Python
"""Prepare only; never launches model prediction, score or a waiter."""
|
|
import json,time
|
|
from pathlib import Path
|
|
from phase2_fixed_io import BASE
|
|
from phase2_h1_worker_v2 import checked,sha,save
|
|
from phase2_home_freeze_io import freeze,verify
|
|
from phase2_gate_outcome_postfit import config
|
|
|
|
def read(p):return json.loads(Path(p).read_text())
|
|
def main():
|
|
root=Path('/home/frank14f/MeltMind-runs/phase2-gate-outcome-v2-postfit-2026-11-17')
|
|
if root.exists():raise FileExistsError('Existing postfit root: inspect, do not duplicate')
|
|
prep_root=Path('/home/frank14f/MeltMind-runs/phase2-gate-outcome-calibration-v2-2026-11-17');prep=read(prep_root/'contract.json');verify(prep_root,'launch');verify(prep_root,'comparison-contract');cmp=read(prep_root/'comparison-contract.json');groot=BASE/'artifacts/phase2-b13-e1b-2026-11-17';science=read(groot/'contract.json')
|
|
assert sha(prep_root/'contract.json')==cmp['preparation_contract_sha256'];assert prep['total_cpu_seconds']==72000 and cmp['rule']['approval']=='1794917650.044649'
|
|
sources={str(p):sha(p) for p in [prep_root/'contract.json',prep_root/'comparison-contract.json',groot/'contract.json',groot/'predictions-manifest.json',groot/'score/result.json']}
|
|
for m in cmp['models']:
|
|
for arm in ['A','G']:sources[m[arm]['path']]=m[arm]['sha256']
|
|
for p,h in sources.items():checked(p,h)
|
|
codes={str(BASE/p):h for p,h in prep['code_sha256'].items()}
|
|
for p in ['tools/phase2_gate_outcome_statistics.py','tools/phase2_gate_outcome_review.py','tools/phase2_gate_outcome_postfit.py','tools/prepare_phase2_gate_outcome_postfit.py','tools/test_phase2_gate_outcome_postfit.py','docs/phase2-gate-outcome-v2-postfit-2026-11-17.md']:
|
|
codes[str(BASE/p)]=sha(BASE/p)
|
|
c=dict(version='gate-outcome-v2-postfit-v1',approval='1794916421.489089',comparison_approval='1794917650.044649',total_cpu_seconds=72000,postfit_cpu_seconds=3600,setup_cpu_seconds=120,worker_cpu=8,disk_bytes=3*2**30,new_fits=0,candidate_label_reads=0,preparation_root=str(prep_root),preparation_contract=str(prep_root/'contract.json'),comparison_contract=str(prep_root/'comparison-contract.json'),comparison_contract_sha256=sha(prep_root/'comparison-contract.json'),comparison_rule=cmp['rule'],bands=cmp['bands'],parts=science['parts'],original_score=str(groot/'score/result.json'),source_sha256=sources,code_sha256=codes,new_prediction_parts=493,exact_reuse_parts=52,invalid_gate_parts=7,full_original_terminal_required=True,predictions_freeze_before_score=True,actual_semantic_PASS_required=True,no_retry=True)
|
|
root.mkdir();save(root/'contract.json',c)
|
|
save(root/'acceptance.json',dict(status='PASS',tests=18,elapsed_seconds=1.606,command='python -m unittest tools.test_phase2_gate_outcome_postfit',scope='8 metric/paired grouping tests,4 prediction/budget/terminal tests,6 actual file/Git semantic review tests; no validator or freeze mock, temporary path constants only',test_source_sha256=sha(BASE/'tools/test_phase2_gate_outcome_postfit.py'),new_actual_predictions=0,new_comparisons=0,setup_cpu_charge=120,unix=time.time()))
|
|
save(root/'preparation-audit.json',dict(status='PREPARED_NOT_LAUNCHED',original_feature_pid=666520,original_feature_pins_verified=True,comparison_rule_fixed=True,models_hash_checked=10,no_labels_opened=True,no_prediction_or_comparison=True,no_new_waiter=True,unix=time.time()))
|
|
freeze(root,'implementation',[root/'contract.json',root/'acceptance.json',root/'preparation-audit.json',*[Path(p) for p in codes],prep_root/'comparison-contract.json'])
|
|
proof=verify(root,'implementation');binding=dict(reviewed_commit=proof['commit'],contract_sha256=sha(root/'contract.json'),implementation_proof_sha256=sha(root/'implementation-git-freeze.json'),comparison_contract_sha256=c['comparison_contract_sha256'],code_sha256=codes)
|
|
save(root/'expected-review-binding.json',binding);freeze(root,'review-binding',[root/'contract.json',root/'expected-review-binding.json',root/'implementation-git-freeze.json',root/'implementation-authorization.json']);config(root)
|
|
print(json.dumps(dict(root=str(root),implementation_commit=proof['commit'],contract_sha256=sha(root/'contract.json'),implementation_proof_sha256=sha(root/'implementation-git-freeze.json'),binding_sha256=sha(root/'expected-review-binding.json'),actual_PASS_pending=True,no_launch=True)))
|
|
if __name__=='__main__':main()
|