Files
MeltMind/tools/prepare_naive_ordering.py

63 lines
4.5 KiB
Python

"""Freeze the corrected, explicitly authorized full-node diagnostic before execution."""
import json
from pathlib import Path
import numpy as np
import scipy
from freeze_g1_components import sha
from s2_custody_common import checked,read_json
from s2_recovery_supervisor import save
ROOT=Path('artifacts/naive-ordering-2026-11-15')
def main():
if ROOT.exists():raise FileExistsError('Do not overwrite a naive-ordering batch')
base=Path('artifacts/s2-custody-evaluation-2026-11-15');s2=read_json(base/'contract.json')
for p,h in s2['code_sha256'].items():checked(p,h)
roster=read_json(checked(s2['roster'],s2['roster_sha256']))
cases=sorted(r['case'] for r in roster['parts'] if r['included'])
assert len(cases)==617
paths=set(s2['code_sha256'])|{str(p) for p in Path('tools').glob('*naive_ordering*.py')}
sources=[s2['roster'],s2['exposure_membership'],s2['models'],str(base/'contract.json'),
str(base/'custody/label-index.json'),str(base/'custody/part-scores.json'),
str(base/'prediction-index.json'),str(base/'predictions-complete.json'),
'docs/naive-ordering-contract-2026-11-15.md','docs/mold-route-a-review-2026-11-15.md']
c=dict(version='naive-ordering-corrected-v1',latest_ruling='1794733619.697459',
custody_ruling='1794733395.244139',direction_ruling='1794733255.090409',
main_review_complete=True,launch_authorized_after_freeze=True,
S2_root=str(base),S2_contract=str(base/'contract.json'),S2_contract_sha256=sha(base/'contract.json'),
roster=s2['roster'],roster_sha256=s2['roster_sha256'],cases=cases,
archive=s2['archive'],archive_stat=s2['archive_stat'],
label_index=str(base/'custody/label-index.json'),label_index_sha256=sha(base/'custody/label-index.json'),
prediction_index=str(base/'prediction-index.json'),prediction_index_sha256=sha(base/'prediction-index.json'),
original_part_scores=str(base/'custody/part-scores.json'),original_part_scores_sha256=sha(base/'custody/part-scores.json'),
exposure_membership=s2['exposure_membership'],exposure_membership_sha256=s2['exposure_membership_sha256'],
worker_cpus=[16,18,20,22],coordinator_cpus=[28,29],
limits=dict(worker_cpu_seconds=36000,preparation_cpu_seconds=28800,post_cpu_seconds=7200,
workers=4,part_cpu_seconds=180,part_wall_seconds=600,part_rss_bytes=4*2**30,
part_disk_bytes=2*2**30,disk_bytes=20*2**30,retries=0,GPU_seconds=0),
numpy_version=np.__version__,scipy_version=scipy.__version__,
full_decodes_authorized=617,full_decode_policy='Exactly one whole-VTU Fill_time array per part; immutable attempt; preserve S2 cache and validate all common IDs',
time_scale='Per fold and nested learning pool component/part-equal mean(full_VTU_T_end/t_set); shared all arms',
CDF='Strict< used for all new predictions; save[F<,F<=] per tie group',
full_volume='all retained tet node lumped volume including d=0',
conditional_volume='frozen PPS multiplicity once; no second node-volume weight',
alpha='estimate (M+/Mall)*K/2000; plugin intervals are not certified whole-domain bounds',
old_Dw_distance='Reuse original Df/Vf; verify CDF equivalence; no re-solve',
new_distance='Dw^2 only, edge midpoint interpolation then square; exclude zero-speed edges, no epsilon, retain every node/mass',
eikonal_vs_Dijkstra_tested=False,original_models_refitted=False,
training_clocks_frozen_before_maps=True,complete_prediction_manifest_before_score=True,
scopes=['full-volume true-order oracles','conditional reorders R2/N/E/B0','reused Dw clock-only','new Dw2 approximation','full-volume timing curves'],
statistics=dict(replicates=2000,seed=2026111408,margin=.1,pools=[25,50,100],six_region_unchanged=True,
baseline='Original R2 part scores reused',naive_close_band=[-.1,.1],oracle_rows_separate=True,confirmatory=False),
S3A_scope_unchanged=True,interpretation='Exploration after S2 results were known; not a fresh confirmatory test',
source_sha256={p:sha(p) for p in sources},code_sha256={p:sha(p) for p in sorted(paths)})
ROOT.mkdir();save(ROOT/'contract.json',c)
save(ROOT/'prelaunch.json',dict(status='AUTHORIZED_FIXED_NOT_STARTED',contract_sha256=sha(ROOT/'contract.json'),
custody_decodes=0,new_distance_solves=0,new_fits=0,original_Dw_reused=True,
latest_ruling=c['latest_ruling'],full_decode_ruling=c['custody_ruling']))
print(json.dumps(read_json(ROOT/'prelaunch.json')))
if __name__=='__main__':main()