def run(load,check): pairs=load('C286_DATA.json')['source_pairs'];reg=load('C286_DATA.json')['target_register'];old=load('C317_DATA.json')['rows'];out=[] def cum(i):return [z for z in pairs if z['Shem_Cainan']==z['Flood_Cainan']==1 and z['Shem_index']==z['Flood_index']==i] def mt(g,role):return [z for z in reg if z['tradition']=='MT' and z['gear']==g and z['role']==role and z['Cainan']==z['Terah60']==z['full430']==1] for x in sorted(old,key=lambda x:x['i']): i,g,rail=x['i'],x['gear'],x['rail'];tag=f'i{i}';a0=cum(i);a2=cum(i+2);role='Flood start' if rail=='primary' else 'Flood close';m0=mt(g,'Noah birth');r0=mt(g,role);m2=mt(g+1,'Noah birth');r2=mt(g+1,role) check(tag+' baseline pair admission',len(a0)==len(m0)==len(r0)==1) check(tag+' upper pair domain',bool(a2)==(i+2<=7) and bool(m2)==bool(r2)==(g+1<=3)) row={'i':i,'SP_gear':g,'rail':rail,'cumulative_pair_before':a0[0],'cumulative_pair_after':a2[0] if a2 else None,'MT_Noah_before':m0[0],'MT_Flood_before':r0[0],'MT_Noah_after':m2[0] if m2 else None,'MT_Flood_after':r2[0] if r2 else None} if a2: u,v=a0[0],a2[0];check(tag+' full cumulative translation',[v['S']-u['S'],v['F']-u['F']]==[2,2]);check(tag+' cumulative lifespan invariant',u['F']-u['S']==v['F']-v['S']==600) check(tag+' held OFF Flood distinction',x['q']-u['S']==1060 and x['q']-v['S']==1058 and x['q']-u['F']==460 and x['q']-v['F']==458) row['held_OFF_Flood_to_ON_Flood_before_after']=[460,458] if r2: N0,N2,R0,R2=m0[0]['center'],m2[0]['center'],r0[0]['center'],r2[0]['center'];span=600 if rail=='primary' else 601 check(tag+' full MT translation',[N2-N0,R2-R0]==[2,2]);check(tag+' MT interval invariant',N0-R0==N2-R2==span);check(tag+' old Noah to new Flood',N0-R2==span-2) row['MT_same_Gear_Noah_to_Flood']=span;row['old_MT_Noah_to_new_MT_Flood']=span-2 out.append(row) check('three complete lifts',sum(bool(x['cumulative_pair_after']) and bool(x['MT_Flood_after']) for x in out)==3) return {'step':'C336','rows':out,'cumulative_whole_pair_shift':[2,2],'regular_MT_whole_pair_shift':[2,2],'endpoint_reselection':'The full native-ON pair retains600, while holding OFF-Flood makes1060 shrinkto1058. The full MT pair retains600/start or601/close, while holding the old MT Noah makes598/start or599/close.','coherent_source_operation_selects_529':False,'source_scope':'All partner records are retrieved from the already frozen C286 register; no Gear is assigned to cumulative states.'}