"""Freeze literal source rows; no formula-generated expected values."""
from pathlib import Path
import hashlib,json
R=Path('/workspace/scratch/1b40da62dcbd')
P=R/'c632_c731/prep'
paths={
'File70':'project_sources/24-File_70.Genesis_Toledot_Atonement_Weave-10-1-.md',
'File69':'project_sources/11-File_69.Enoch_Centered_Genealogical_Accordion-20260823-145801-.md',
'File61':'project_sources/31-File_61.Jacob_Moses_Cumulative_Regular_Root_System-6-.md',
'File18':'project_sources/38-File_18.Chronological_Data_Tables-20260919-141048-.md',
'File12':'project_sources/16-File_12.Calendrical_Physics-20260907-192303-.md',
}
texts={k:(R/v).read_text() for k,v in paths.items()}
def excerpt(key,start,end):
 t=texts[key];a=t.index(start);b=t.index(end,a+len(start));v=t[a:b].rstrip()
 return {'source':key,'heading':start,'start_line':t[:a].count('\n')+1,'end_line':t[:a+len(v)].count('\n')+1,'sha256':hashlib.sha256(v.encode()).hexdigest(),'verbatim':v}
e={
'F70_3.2':excerpt('File70','### 3.2 Year-scale rails','### 3.3 Mixed-resolution'),
'F70_3.4':excerpt('File70','### 3.4 Creation’s','### 3.5 First-pole'),
'F70_5.5':excerpt('File70','### 5.5 Joseph’s final-','### 5.6 Creation'),
'F70_6.1':excerpt('File70','### 6.1 Prophetic exposure','### 6.2 Priestly'),
'F70_6.2':excerpt('File70','### 6.2 Priestly covering','### 6.3 Enochian'),
'F70_6.3':excerpt('File70','### 6.3 Enochian corresponding','### 6.4 The'),
'F70_6.4':excerpt('File70','### 6.4 The','### 6.5 Minimum'),
'F70_6.5':excerpt('File70','### 6.5 Minimum','### 6.6 No-Cainan'),
'F70_6.6':excerpt('File70','### 6.6 No-Cainan','### 6.7 Three-calendar'),
'F70_6.7':excerpt('File70','### 6.7 Three-calendar','## 7. Garment'),
'F70_D':excerpt('File70','# Appendix D —','# Appendix E —'),
'F69_5B.1':excerpt('File69','### 5B.1 The first','### 5B.2 The ten-section'),
'F69_5B.9':excerpt('File69','### 5B.9 Secondary Enoch','## 6.'),
'F61_13.6':excerpt('File61','### 13.6 Egyptian','## 14. Joseph'),
'F12_6.3.1':excerpt('File12','#### 6.3.1 Axiom:','#### 6.3.1a Source-control'),
}
packet={
'purpose':'Literal source input freeze for File70 calendar-half and Appendix D family tests. Mathematical generators and counterexamples live separately in the memo; no expected values below were computed from a candidate generator.',
'sources':{k:{'path':str(R/v),'sha256':hashlib.sha256((R/v).read_bytes()).hexdigest()} for k,v in paths.items()},
'literal_tables':{
 'creation_boundary_rails':{'refs':['F70_3.2','F69_5B.1'],'columns':['opening','after6','completed_first7','Year13','completed_second7_Year14'],'rows':[{'state':'standard_regular_MT','values_BC':[4121,4115,4114,4108,4107]},{'state':'regular_restored_Cainan_130','values_BC':[4251,4245,4244,4238,4237]}],'literal_gaps':[6,1,6,1],'literal_total':14,'role_note':'Year13 exposure and Year14 covering are repository typological placements, not explicit Genesis event dates.'},
 'creation_rail_node_class':{'ref':'F69_5B.1','rows':[{'base_BC':4116,'insertion':130,'restored_BC':4246,'role':'Year6 head'},{'base_BC':4114,'insertion':130,'restored_BC':4244,'role':'completed Creation endpoint'}]},
 'joseph_nodes':{'refs':['F70_5.5','F61_13.6'],'birth_BC':1915,'rows':[{'date_BC':1898,'age':17,'role':'descent/death-token field; local textual-age-derived comparison'},{'date_BC':1885,'age':30,'role':'elevation/investiture/marriage/Plenty begins'},{'date_BC':1878,'age':37,'role':'Plenty/Famine hinge'},{'date_BC':1871,'age':44,'role':'Famine close'}],'literal_successive_spans':[13,7,7],'literal_total_descent_to_close':27,'entry':{'date_BC':1876,'famine_completed_years':2,'role':'Jacob household Entry, distinct from Joseph descent'}},
 'calendar_half_rows':{'ref':'F70_6.7','rows':[{'calendar':'Prophetic','head_BC':4238,'tail_BC':1898,'span':2340,'half_units':13,'days_per_half':180,'narrative':'exposure/stripping/death-token'},{'calendar':'Priestly','head_BC':4237,'tail_BC':1885,'span':2352,'half_units':14,'days_per_half':168,'narrative':'covering/investiture/marriage'},{'calendar':'Enochian','head_BC':4251,'tail_BC':1885,'span':2366,'half_units':13,'days_per_half':182,'narrative':'corresponding Creation and Plenty/Famine rails'}],'register_year_lengths':[360,336,364]},
 'restored_corresponding_rows':{'ref':'F70_6.3','rows':[{'Creation_BC':4251,'Joseph_BC':1885,'span':2366},{'Creation_BC':4244,'Joseph_BC':1878,'span':2366},{'Creation_BC':4237,'Joseph_BC':1871,'span':2366}],'literal_factorizations':['14×13 = 182','13×182 = 2366','(13/2)×364 = 2366','13×14×13 = 2366']},
 'conversion_path':{'ref':'F70_6.4','nodes_BC':[4251,4238,1898,1885],'spans':[13,2340,13],'total':2366,'Enochian_minus_Prophetic':26,'year_length_difference':4},
 'cross_rail_extrema':{'ref':'F70_6.5','rows':[{'kind':'minimum','head_BC':4237,'tail_BC':1885,'span':2352},{'kind':'corresponding','head_BC':4251,'tail_BC':1885,'span':2366},{'kind':'maximum','head_BC':4251,'tail_BC':1871,'span':2380}],'offsets_from_corresponding':[-14,0,14],'source_max_factorization':'17×140'},
 'no_Cainan_companion':{'refs':['F70_6.1','F70_6.6'],'regular_insertion':130,'corresponding_rows':[{'Creation_BC':4121,'Joseph_BC':1885,'span':2236},{'Creation_BC':4114,'Joseph_BC':1878,'span':2236},{'Creation_BC':4107,'Joseph_BC':1871,'span':2236}],'literal_factorization':'43×52','exposure_row':{'Creation_BC':4108,'Joseph_BC':1898,'span':2210,'factorization':'17×130'},'restored_exposure_factorization':'18×130'},
 'appendix_D_source_comparison':{'refs':['F70_D','F69_5B.9'],'status':'pre-existing secondary regular restored-Cainan Gear2 comparison; appendix only; no newly applied Gear operation','Creation_final7_BC':[4244,4237],'Enoch_final7_BC':[3264,3257],'corresponding_spans':[980,980],'Enoch_rail_width':7,'outer_Creation_to_Enoch':987,'minimum_partition_nodes_BC':[4237,3257,1885],'minimum_partition_spans':[980,1372],'jubilee_counts':[20,28],'jubilee_total':48,'total_span':2352,'outer_chain_nodes_BC':[4244,4237,3257,1885],'outer_chain_spans':[7,980,1372],'literal_scale_equations':['490+490 = 980','7×(70+70) = 980','70×(7+7) = 980']},
},
'controls':[
'Frozen literals are repository source data, not independent historical verification.',
'Joseph1898 is source-local textual-age-derived; Genesis37:2 toledot heading remains undated.',
'Year6/Adam heads, completed boundaries, Gear labels and typological Day13/14 roles remain distinct.',
'AppendixD3257 is used only as its already supplied secondary comparison; no new upstream Gear transport.',
'No inverse-of-inverse; no primer work; no new historical anchors.',
'Same-side BC subtraction throughout the primary packet; calendar-day expressions are declared scale comparisons.',
'Equivalent factorizations and cross-rail extrema are dependent outputs, not independent witnesses.',
],
'source_excerpts':e,
}
required={'File70':['4238−1898','4237−1885','4251−1885','4121−1885','1915−1898 = 17','1915→1885 BC = 30','4237−3257','3257−1885'],
'File69':['`4121 BC` | `4115 BC` | `4114 BC` | `4108 BC` | `4107 BC`','`4251 BC` | `4245 BC` | `4244 BC` | `4238 BC` | `4237 BC`','| Gear 2 | `4244–4237 BC` | `3264–3257 BC` | `980` | `987` |'],
'File61':['1915 − 1885 = 30']}
for k,phrases in required.items():
 for phrase in phrases:assert phrase in texts[k],(k,phrase)
(P/'file70_calendar_packet.json').write_text(json.dumps(packet,indent=2,ensure_ascii=False)+'\n')
print(json.dumps({'status':'frozen','literal_tables':len(packet['literal_tables']),'source_excerpts':len(e),'source_phrase_checks':sum(map(len,required.values())),'output':str(P/'file70_calendar_packet.json')}))
