from research import *
family="sp"
p=ROOT/'prep/manuscript_sp.json'
packet=json.loads(p.read_text());modules=packet if isinstance(packet,list) else packet['modules'];m=modules[0]
textbody=m.get('text',m.get('body',''))
for old,new in [["the aligned SP-with-Cainan and native LXX birth path retains different lifespan measurements","the aligned Noah-to-Abraham birth path of SP-with-Cainan and native LXX still carries different lifespan measurements"]]:textbody=textbody.replace(old,new)
s=begin(1072,'Manuscript: '+m['title'],'Does this section accurately connect its complete source family to the shared explanation?',{'draft_sha256':hashlib.sha256(p.read_bytes()).hexdigest(),'module_index':0},['C1071','prep/manuscript_sp.json'])
sources=m.get('sources',[]);source_notes=[]
for x in sources:
 if isinstance(x,str):source_notes.append(x)
 else:source_notes.append(x.get('file','')+' '+(', '.join(x.get('sections',[])) if 'sections' in x else x.get('section','')))
steps=m.get('steps',[])
if not steps and family=='round':steps=['C932–C952','C1058–C1068']
content='### '+m['title']+'\n\n'+textbody+'\n\n*Sources:* '+'; '.join(source_notes)+'.\n\n*Research record:* '+', '.join('C'+str(x) if isinstance(x,int) else str(x) for x in steps)+'.\n'
rel='deliverables/sections/01_sp_1.md'
a=artifact(rel,content)
checks={'local_repartition':130+800==230+700==930,'both_measurements_named':'Regular' in textbody and 'Cumulative' in textbody,'alignment_scope':'Noah-to-Abraham' in textbody}
finish(s,{'section':a,'body_words':len(textbody.split()),'source_references':len(source_notes)},"The opening source-ledger section now explains Regular and Cumulative chronology as distinct ordered measurements, and limits the birth-alignment example to its established Noah-to-Abraham path.",'Reassess the next explanatory section against its source roles and the sealed calculations.',checks)

