aien-sovereign-core-mv
AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.
Brought by drakestapleton
aien-sovereign-core-mv / om / q38-head / mutants.py
| 1 | #!/usr/bin/env python3 |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | """External wrong-program controls; each changed Omega unit must fail the oracle.""" |
| 4 | import json |
| 5 | import os |
| 6 | from pathlib import Path |
| 7 | import subprocess |
| 8 | import sys |
| 9 | |
| 10 | src=Path(__file__).with_name('select.om').read_text() |
| 11 | out=Path(sys.argv[1]); out.mkdir(parents=True,exist_ok=True) |
| 12 | cases={ |
| 13 | 'truncated_norm': ('for i ulong 5120', 'for i ulong 2048'), |
| 14 | 'strict_threshold': ('take = ge upper', 'take = gt upper'), |
| 15 | 'zero_bound': ('ret up mul f64 coef hn', 'ret 0.0'), |
| 16 | 'negative_coefficient': ('if lt v 0.0\ntrap 5\nend', 'note missing negative coefficient refusal'), |
| 17 | 'no_outward_rounding': ('bits = bitcast ulong x', 'ret x\nend\nfn unused x f64 to f64\nbits = bitcast ulong x'), |
| 18 | } |
| 19 | results=[] |
| 20 | for name,(old,new) in cases.items(): |
| 21 | assert src.count(old)==1,(name,'mutation not unique') |
| 22 | p=out/name; p.mkdir(exist_ok=True) |
| 23 | unit=p/'select.om'; unit.write_text(src.replace(old,new)) |
| 24 | with (p/'build.log').open('w') as f: |
| 25 | build=subprocess.run(['sh',str(Path(os.environ['OMEGA_BRIDGE'])/'tools/native'),str(p/'native'),str(unit)],stdout=f,stderr=subprocess.STDOUT) |
| 26 | assert build.returncode==0,(name,'compile failure is not a caught behavioral mutant') |
| 27 | with (p/'check.log').open('w') as f: |
| 28 | check=subprocess.run([sys.executable,str(Path(__file__).with_name('check.py')),str(p/'native/libomega_native.so')],stdout=f,stderr=subprocess.STDOUT) |
| 29 | assert check.returncode!=0,(name,'mutant survived') |
| 30 | results.append({'mutant':name,'build_exit':build.returncode,'check_exit':check.returncode}) |
| 31 | print(json.dumps({'status':'PASS','controls':results},indent=2)) |