from research import *
s=begin(1400,'Complete the portable claim bindings','Do all55 indexed files now resolve within the evidence packet?',{},['model/claim_portability_initial_audit.json','evidence/additional_support'])
d=json.loads((ROOT/'model/claim_portability_initial_audit.json').read_text());added=[]
for x in d['bindings']:
 if not x['packet_paths']:
  p=Path(x['indexed_path']);rel='evidence/additional_support/'+p.parent.name+'_'+p.name
  assert hashlib.sha256((ROOT/rel).read_bytes()).hexdigest()==x['sha256']
  x['packet_paths']=[rel];added.append({'path':rel,'sha256':x['sha256'],'bytes':(ROOT/rel).stat().st_size})
d['status']='PASS: all55 indexed files have exact local packet copies';d['additional_support']=added
a=artifact('deliverables/490d_Portable_Claim_Bindings_C1431.json',json.dumps(d,indent=2)+'\n')
finish(s,{'portable_bindings':a,'added_support':added},'The four inherited support files are now frozen inside the packet. All55 indexed source/proof files resolve by content hash without access to original absolute paths.','Prepare the reproducible print-rendering pipeline.',{'four_added':len(added)==4,'all_resolve':all(any((ROOT/p).exists() and hashlib.sha256((ROOT/p).read_bytes()).hexdigest()==x['sha256'] for p in x['packet_paths']) for x in d['bindings'])})
