"""Freeze explicit safe public lists and scoped task evidence. Never publish.""" from pathlib import Path import json,hashlib,shutil ROOT=Path(__file__).resolve().parents[1] def read(p):return json.loads(p.read_text()) def sha(p): with p.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest() def write(p,v):p.parent.mkdir(parents=True,exist_ok=True);p.write_text(json.dumps(v,ensure_ascii=False,sort_keys=True,indent=2)+'\n') def cp(source,target):target.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(source,target) audit=ROOT.parent/'quality/WINDTUNNEL_KNOWN_ITEM_INTEGRITY.json';assert read(audit)['status']=='pass' known=ROOT/'stage/known-item-v2';cp(audit,known/'independent-audit.json');cp(audit,ROOT/'stage/data-v2/independent-known-item-audit.json') manifest=read(known/'runtime-manifest.json');manifest['capability_status']='independently_audited_same_wave_known_exact_instrument';write(known/'runtime-manifest.json',manifest) request=read(known/'example-request.json');request['expected_manifest_sha256']=sha(known/'runtime-manifest.json');write(known/'example-request.json',request) inventory=[] for folder in sorted((ROOT/'stage').iterdir()): if (folder/'runtime-manifest.json').exists():inventory.append({'directory':str(folder.relative_to(ROOT)),'manifest_sha256':sha(folder/'runtime-manifest.json'),'architecture':read(folder/'runtime-manifest.json')['architecture'],'public_model_bundle_eligible':folder.name!='cross-wave-v2'}) write(ROOT/'results/initial-stage-inventory.json',inventory);write(ROOT/'results/runtime-bundles.json',inventory) for folder in (ROOT/'stage').iterdir(): if not folder.is_dir():continue if folder.name!='reproduction': cp(ROOT/'results/digest-scope-reconciliation.json',folder/'digest-scope-reconciliation.json') if (folder/'runtime.py').exists():cp(ROOT/'runtime.py',folder/'runtime.py') for filename,target in [('WINDTUNNEL_ENCODER_CROSSWAVE_INTEGRITY.json','encoder-v1'),('WINDTUNNEL_CROSS_WAVE_INTEGRITY.json','cross-wave-v1')]: p=ROOT.parent/'quality'/filename if p.exists():cp(p,ROOT/'stage'/target/'independent-expansion-audit.json') # Reproduction code/data contracts; no input snapshots, raw CSV, environments or replacement weights. repro=ROOT/'stage/reproduction';repro.mkdir(exist_ok=True) for source in [ROOT/'README.md',ROOT/'INSTALL.md',ROOT/'NOTICE',ROOT/'runtime.py',ROOT/'prospective.py',ROOT/'requirements-training.txt',ROOT/'input_inventory.json']: cp(source,repro/source.name) for sub in ['src','configs']: for source in (ROOT/sub).rglob('*'): if source.is_file() and source.suffix in ['.py','.json','.sha256'] and '__pycache__' not in source.parts:cp(source,repro/sub/source.relative_to(ROOT/sub)) # Full public experimental evidence. First-pass weights with failed/ambiguous gates remain excluded. for name in ['registry_summary.json','source-receipts.json','source_reconciliation.json','digest-scope-reconciliation.json','known-training.json','known-evaluation.json','known-slices.json','cross-wave-training.json','cross-wave-evaluation.json','cross-wave-crosswalk.json','cross-wave-release-qualification.json','base-verification.json','runtime-checks.json','runtime-smoke-receipts.json','prospective-checks.json']: cp(ROOT/'results'/name,repro/'evidence'/name) for name in ['training.json','evaluation.json','roles.json']:cp(ROOT/'results/encoder'/name,repro/'evidence/encoder'/name) public_names=['baseline-v1','known-item-v2','encoder-v1','cross-wave-v1','data-v2','reproduction'];bundles=[] for name in public_names: folder=ROOT/'stage'/name;files=[] for path in sorted(folder.rglob('*')): relative=path.relative_to(folder) if not path.is_file() or 'base' in relative.parts or '.cache' in relative.parts or '__pycache__' in relative.parts:continue assert path.suffix not in ['.csv','.bin','.pkl','.pickle','.pyc'] assert not ('adapter.safetensors' in str(relative) and name!='encoder-v1') files.append({'path':str(relative),'bytes':path.stat().st_size,'sha256':sha(path)}) entry={'bundle':name,'local_dir':str(folder.relative_to(ROOT)),'files':files,'total_bytes':sum(f['bytes'] for f in files)} if (folder/'runtime-manifest.json').exists():entry['trusted_runtime_manifest_sha256']=sha(folder/'runtime-manifest.json') bundles.append(entry) write(ROOT/'PUBLICATION_ALLOWLIST.json',{'schema_version':'windtunnel-publication-allowlist-v1','new_spend_usd':0,'publication_performed':False,'parent_lead_only':True,'policy':'Upload only listed files; preserve existing Hub roots/artifacts and existing dataset configurations. Add extension paths or an explicitly chosen new known-item model repo.','excluded':['raw/ respondent-level source files','python-deps/ Python environment','base/ pinned external model downloads','results/encoder/adapter.safetensors failed replacement','results/encoder/probe.safetensors research probe','stage/cross-wave-v2/ all local replacement-model files: ambiguous family novelty gate'],'bundles':bundles}) write(ROOT/'ITEM_STATUS.json',{'M17':{'status':'implemented_audited_narrow_gate_pass','instruments':52,'added':36,'families':12,'data_rows_national':52,'data_rows_supported_cells':444,'new_model_publication_eligible':True,'evidence':['results/known-evaluation.json','results/known-slices.json','../quality/WINDTUNNEL_KNOWN_ITEM_INTEGRITY.json']},'M18':{'status':'implemented_expanded_evaluation_replacement_not_promoted','train_dev_test_families':[5,2,4],'train_dev_test_questions':[23,5,18],'new_test_families':2,'minimum_family_gate':10,'replacement_weights_publication_eligible':False,'evidence':['results/encoder/training.json','results/encoder/evaluation.json','results/encoder/roles.json'],'external_dependencies':['Broader independently grouped question families and new real response evidence; independent human methodological review']},'M19':{'status':'implemented_additional_retrospective_evidence_prospective_blocked','additional_exact_pairs':8,'represented_families':3,'entirely_new_families':1,'replacement_weights_publication_eligible':False,'evidence':['results/cross-wave-evaluation.json','results/cross-wave-release-qualification.json','results/digest-scope-reconciliation.json'],'external_dependencies':['Untouched later-wave outcomes/new human response collection after real prospective preregistration','Real-person panel overlap audit','Independent human methodological review']},'runtime':{'status':'passed_three_architectures','public_model_bundles':4,'local_comparison_bundles':5,'evidence':['results/runtime-checks.json','results/runtime-smoke-receipts.json']},'spend_usd':0,'published':False}) print(json.dumps({'public_bundles':len(bundles),'public_bytes':sum(v['total_bytes'] for v in bundles),'replacement_encoder_included':False,'replacement_cross_wave_included':False}))