"""Add Claude-requested reporting without changing frozen components or splits.""" import json from pathlib import Path from freeze_g1_components import OUT, sha def main(): private, public = OUT/'custodian', OUT/'public' read=lambda p:json.loads(p.read_text()) frozen=sha(public/'splits.json') splits=read(public/'splits.json'); parts=read(private/'part-splits.json') comps={c['component_id']:c for c in read(public/'components.json')} rows=[]; sensitivity=[] for f in splits['folds']: test=[p for p in parts if p['component_id'] in f['test']] cs=[comps[c] for c in f['test']] keys={p['source_key'] for p in test} retained=[p for p in test if not p['exposure']['development_exposed']] kept={p['component_id'] for p in retained} largest=max(cs,key=lambda c:(c['parts'],c['nodes'])) rows.append(dict(fold=f['fold'],parts=len(test),nodes=sum(p['nodes'] for p in test),components=len(cs),source_keys=len(keys), known_development_exposed_parts=sum(p['exposure']['development_exposed'] for p in test), known_development_exposed_components=sum(c['development_exposed_parts']>0 for c in cs), not_known_exposed_parts=len(retained),not_known_exposed_nonempty_components=len(kept), largest_component=dict(component_id=largest['component_id'],parts=largest['parts'],nodes=largest['nodes'],source_keys=largest['source_keys'], share_of_fold_parts=largest['parts']/len(test),share_of_fold_nodes=largest['nodes']/sum(p['nodes'] for p in test)), within_fold_component_ranges={key:dict(min=min(c[key] for c in cs),max=max(c[key] for c in cs),max_minus_min=max(c[key] for c in cs)-min(c[key] for c in cs)) for key in ['parts','nodes','source_keys']})) sensitivity.append(dict(fold=f['fold'],parts=[p['case'] for p in retained],nonempty_components=sorted(kept), components_empty_after_filter=sorted(set(f['test'])-kept))) result=dict(ruling_message_ts='1794679227.706139',splits_sha256=frozen,folds=rows, across_fold_ranges={key:dict(min=min(r[key] for r in rows),max=max(r[key] for r in rows),max_minus_min=max(r[key] for r in rows)-min(r[key] for r in rows)) for key in ['parts','nodes','components','source_keys']}, sensitivity_label='not known exposed',sensitivity_status='PRE_REGISTERED_DESCRIPTIVE_ONLY_NO_PREDICTIONS', script_sha256=sha(__file__),no_split_change=True,no_labels_model_fitting=True) with (private/'not-known-exposed-test-subsets.json').open('x') as o:json.dump(sensitivity,o,indent=2);o.write('\n') (private/'not-known-exposed-test-subsets.json').chmod(0o600) result['custody_sensitivity_membership_sha256']=sha(private/'not-known-exposed-test-subsets.json') assert sha(public/'splits.json')==frozen with (public/'fold-balance-and-exposure.json').open('x') as o:json.dump(result,o,indent=2);o.write('\n') print(json.dumps(result)) if __name__=='__main__':main()