run_heldout_nested_frame_split_047.py VOYNICH RESEARCH ARCHIVE | 16 SEPTEMBER 2026 2 _csv(OUT/'heldout_signflip_null.csv',index=False) passed=bool(obs>0 and (fd.gain>0).sum()>=4 and pv<.05 and len(set(fd.selected_rule))==1 and fd.selected_rule.iloc[0]!='BASE') summary={'test':'HELDOUT-NESTED-FRAME-SPLIT-047','candidate_rules':len(RULES),'fixed_eligible_lines':le n(eligible),'selected_rules':fd.selected_rule.tolist(),'weighted_heldout_gain':obs,'positive_folds':int( (fd.gain>0).sum()),'signflip_p':pv,'pass':passed,'rule_budget_cost':0,'rulebook_action':'REFINE_EDGE_HAN DOFF' if passed else 'NONE','boundary':'Raw-surface segmentation only; no semantics or plaintext.'};(OUT/'summary.json').write_text(json.dumps(summary,indent=2)) report=['# HELDOUT-NESTED-FRAME-SPLIT-047','',('**PASS — ONE-RULE NESTED FRAME SPLIT**' if passed else '**FAIL — SIMPLE NESTED FRAME RULE REJECTED**'),'','Ten historically executable candidates were compared on the identical baseline-eligible line universe: no split plus nine right-edge/left-edge membership variants. The rule was selected on four folio folds and scored on the untouched fifth. Edge atoms were retained as closers/openers; no dictionary or exception list was allowed.','',f'- Fixed shared multi-token lines: {len(eligible)}',f"- Fold selections: {' | '.join(fd.selected_rule)}",f'- Weighted held-out gain: {obs:+.6f}',f'- Positive folds: {(fd.gain>0).sum()}/5',f'- Sign-flip p: {pv:.6f}','','## Rule audit','',('The result refines existing EDGE HANDOFF at the sub-token level; it does not add a seventh rule. Six rules remain.' if passed else 'No new rule. The six-rule ledger remains unchanged; local B2→L1 repair is not generalized.')];(OUT/'report.md').write_text('\n'.join(repo rt)+'\n');pd.DataFrame([{'test':'HELDOUT-NESTED-FRAME-SPLIT-047','rule':'EDGE HANDOFF','status':'STRENGTHENED' if passed else 'UNCHANGED','evidence':f'fixed-line gain={obs:+.6f}; folds={(fd.gain>0).sum()}/5; p={pv:.6f}','live_rule_count':6}]).to_csv(OUT/'rule_recovery_audit.csv',ind ex=False);files=sorted(x for x in OUT.iterdir() if x.is_file() and x.name!='SHA256SUMS.txt');(OUT/'SHA256SUMS.txt').write_text('\n'.join(f'{hashlib.sha256(x.read_bytes()). hexdigest()} {x.name}' for x in files)+'\n');print(json.dumps(summary,indent=2)) if __name__=='__main__':main()