Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-bridge/blob/main/evidence/text-parent-verification/verify-text-parent.py # omega-bridge Omega-first language interoperability: checked conversion backends and native language bindings Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-bridge / evidence / text-parent-verification / verify-text-parent.py` 41 lines ยท 2585 bytes Raw Blame History 1 from pathlib import Path 2 import subprocess as sp,json,hashlib 3 h=Path.home();w=h/'workspace/omega-bridge-text-native';out=h/'handoffs/bridge-text-parent-verification';out.mkdir(exist_ok=True) 4 sha='`74905efb3f4f8503cbacf3d521450bd82aed3a09`' 5 assert sp.check_output(['git','-C',str(w),'rev-parse','HEAD'],text=True).strip()==sha 6 sp.run(['git','-C',str(w),'diff','--exit-code','`6876f4d79883592bd19ba229a664cede99fe35ca`',sha,'--','src','seed','tools','tests','provenance'],check=True) 7 bridge=w/'build/native/bridge' 8 assert hashlib.sha256(bridge.read_bytes()).hexdigest()=='`a45e11608c79cd834ab06149106798c45562daeebba2f28210606009323bdc78`' 9 rows=[] 10 for filename in ['baseline.json','extended-native-oracle.json']: 11 rows+=json.loads((h/'handoffs/bridge-text-baseline'/filename).read_text())['cases'] 12 assert len(rows)==17 and len({r['source_sha256'] for r in rows})==17 13 results=[] 14 for i,r in enumerate(rows): 15 src=bytes.fromhex(r['source_hex']) if 'source_hex' in r else r['source'].encode() 16 assert hashlib.sha256(src).hexdigest()==r['source_sha256'] 17 for target in ['C','P']: 18 source=out/f'input-{i}.om';source.write_bytes(src) 19 got=sp.run([str(w/'tools/bridge'),'c' if target=='C' else 'python',str(source)],capture_output=True,timeout=15) 20 record={'name':r['name'],'target':target,'conversion_rc':got.returncode} 21 if r['native_compile_rc']!=0: 22 record['expected_refusal']=r['native_compile_rc'] 23 record['refusal_matches']=got.returncode==r['native_compile_rc'] and not got.stdout 24 assert got.returncode!=0 and not got.stdout,(r['name'],target,'unsafe acceptance') 25 else: 26 assert got.returncode==0 and got.stdout,(r['name'],got) 27 path=out/f'case-{i}.{ "c" if target=="C" else "py"}' 28 path.write_bytes(got.stdout) 29 if target=='C': 30 exe=out/f'case-{i}.exe' 31 built=sp.run(['cc','-std=c11','-O2',str(path),'-o',str(exe)],capture_output=True,timeout=30) 32 assert built.returncode==0,built.stderr 33 cmd=[str(exe)] 34 else:cmd=['python3',str(path)] 35 run=sp.run(cmd,input=b'',capture_output=True,timeout=15) 36 assert run.returncode==r['native_rc'] and run.stdout.hex()==r['native_stdout_hex'] and not run.stderr,(r['name'],target,run) 37 record.update(runtime_rc=run.returncode,stdout_hex=run.stdout.hex()) 38 record['pass']=record.get('refusal_matches',True);results.append(record) 39 report={'head':sha,'unique_sources':len(rows),'requested':len(rows)*2,'executed':len(results),'passed':sum(x['pass'] for x in results),'results':results} 40 (out/'results.json').write_text(json.dumps(report,indent=2)+'\n') 41 print(json.dumps({k:v for k,v in report.items() if k!='results'}))