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-mv/blob/main/tests/universal/source-aware/legacy.mjs # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tests / universal / source-aware / legacy.mjs` 57 lines ยท 7505 bytes Raw Blame History 1 // External TEST ORACLE ONLY: unchanged C OSC and checker2 APIs, not production compiler. 2 import fs from 'node:fs';import path from 'node:path';import assert from 'node:assert/strict';import {spawnSync,execFileSync} from 'node:child_process';import {hash} from './fixtures.mjs'; 3 const run=process.argv[2],base='`69790fb4ad1e803ca79245430745b96129d1dcf4`',out=path.join(run,'legacy');fs.mkdirSync(out,{recursive:true}); 4 const cmd=(e,a)=>{let r=spawnSync(e,a,{maxBuffer:16*1024*1024});if(r.status!==0)throw Error(e+' '+r.status+' '+r.stderr);return r.stdout;}; 5 // The legacy paths must still hold the base's code. Since base, main changed them in exactly three ways, each 6 // checked byte for byte here; anything else (an added, renamed or otherwise edited file) fails: 7 // (1) the Apache-2.0 SPDX header (HDR) put in front of a file, base bytes unchanged after it, and committed 8 // .crumb metadata (edited, or removed with every crumb on 2026-11-08); (2) the SHA-256 cutover (#776): src/sha256.c deleted, src/sha256.h reduced to the 9 // include of the Omega-generated API. The current oracle is then built against that generated SHA-256 10 // (src/omega_om_units.c), so the byte-identical IR comparison below also covers the cutover; 11 // (3) reviewed edits merged after base, each file pinned by the SHA-256 of its whole current content 12 // (ACCEPTED). Train r2 (#972) carried two: #942 put per-maximum and opcode-default mutant switches into 13 // the OSC IR decoder (src/compiler/osc_ir.c; the default build defines no mutant, so every refusal stays 14 // live) and #963 made the osh follow-ups (src/osh). The oracle below is built from the current 15 // src/compiler and the src/osh .osc files are fixtures, so the byte-identical IR comparison covers both. 16 // Two more were merged on 2026-11-06: #525 (OSC IR format version 6, issue #451; src/compiler/osc_ir.c 17 // re-pinned and src/compiler/osc_ir.h pinned; osc_ir_encode still writes versions 1..5 byte for byte, and 18 // the oracle is built from these files) and #962 (checker2 refuses some-path leaks and aliased mutable 19 // borrows, issue #465; src/checker2/c2_check.c, linked into the oracle, which requires checker2 to accept 20 // every lowered fixture). Both are covered by the byte-identical IR comparison below. 21 // Any further edit to a pinned file fails here until it is reviewed and its hash re-pinned. 22 const ACCEPTED={ 23 'src/checker2/c2_check.c':'`a3457a3bd07014826cf65426f15ad67f4fdcaf2195f23559d10e5fbfa808c6e3`', 24 'src/compiler/osc_ir.c':'`f09cbe0c5093d912526b4b0c1e5a43a4b8409a4d12a40cb6592fb1cf9db1edfc`', 25 'src/compiler/osc_ir.h':'`e0d39653177e0e9515311e5ae56302fd296c094dc40fc1dedf890eeb4f61fa97`', 26 'src/osh/host/osh_builtin.c':'`24658416184462ca93830efbd7bf5c318b13d0259c413fd738acc9bca1b02a86`', 27 'src/osh/host/osh_exec.c':'`086762229ce1cc2023ec0712483cd4f0431b0ac36ab450b40e625ab665ad9e1a`', 28 'src/osh/host/osh_host.h':'`5ec628fb5ef7f90306e9d32f31d8ad79a77dd50880d2824d90c364dfbcd26ea5`', 29 'src/osh/host/osh_shell.c':'`98449941764020b78b29acc6f3ace5de8359615ebd91ed787eaa8f91958d1714`', 30 'src/osh/host/osh_vars.c':'`8f3e0a3a03c361097a8bb21407130e3416503f053f6dd2d4156fdc563e818e8f`', 31 'src/osh/osh_expand.osc':'`78bede578b860826b01592458ec9861ef13f70a30a7c023add62ec989650c71d`', 32 'src/osh/osh_expand.osc.in':'`5aa979a36c98e5b5819560b5c3fa18d99519a723cee54d7b7788595e14d8a961`', 33 'src/osh/osh_expand_ref.c':'`9d84d760aa8ff3c9434241280ddd531a00fd61aa8a191b1d5f32e2eba5dc3bbe`', 34 'src/osh/osh_layout.lst':'`5706e9fd6ca28b3bdcc3d5cb4e8a9abc1f662b5b3da7a96c273f4644716401f5`'}; 35 const HDR=['/* SPDX-License-Identifier: Apache-2.0',' * Copyright 2026 Drake Stapleton (AIEN / aien-dev)',' *',' * Licensed under the Apache License, Version 2.0 (the "License");',' * you may not use this file except in compliance with the License.',' * You may obtain a copy of the License at',' *',' * http://www.apache.org/licenses/LICENSE-2.0',' *',' * Unless required by applicable law or agreed to in writing, software',' * distributed under the License is distributed on an "AS IS" BASIS,',' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',' * See the License for the specific language governing permissions and',' * limitations under the License.',' */',''].join('\n'); 36 const legacyPaths=['src/compiler','src/checker2','src/sha256.c','src/sha256.h','tests/compiler/progs','tests/compiler/slices','tests/physics0/osc','src/osh']; 37 const changed=cmd('git',['diff','--no-renames','--name-status','-z',base,'--',...legacyPaths]).toString().split('\0').filter(Boolean); 38 let cutover=false; 39 for(let i=0;ip.endsWith('.c')&&p!=='oscc_main.c').map(p=>path.join(root,'src/compiler',p)); 51 const sha=fs.existsSync(path.join(root,'src/sha256.c'))?[path.join(root,'src/sha256.c')]:[path.join(root,'src/omega_om_units.c'),'-pthread']; 52 const files=[...compiler,...sha,path.join(root,'src/checker2/c2_ir.c'),path.join(root,'src/checker2/c2_check.c')],exe=path.join(out,name); 53 cmd(process.env.CC||'cc',['-std=gnu11','-D_GNU_SOURCE','-Wall','-Wextra','-Werror','-O2','-I'+path.join(root,'src'),'-I'+path.join(root,'src/compiler'),'-I'+path.join(root,'src/checker2'),'-o',exe,'tests/universal/source-aware/legacy.c',...files]);return exe;} 54 let baseExe=build(out,'base-oracle'),currentExe=build('.','current-oracle'),rows=[]; 55 const fixtures=[...['tests/compiler/progs','tests/compiler/slices','tests/physics0/osc','src/osh'].flatMap(d=>fs.readdirSync(d).filter(x=>x.endsWith('.osc')).map(x=>d+'/'+x)),'tests/universal/arithmetic.osc']; 56 for(let f of fixtures){let a=cmd(baseExe,[f]),b=cmd(currentExe,[f]);assert.ok(a.equals(b),'lower IR changed '+f);rows.push({source:f,bytes:a.length,irSHA256:hash(a).toString('hex'),byteIdenticalToBase:true,strictDecodeReencode:true,checker2Accepted:true});} 57 assert.ok(rows.length>=59);fs.writeFileSync(path.join(run,'legacy.json'),JSON.stringify({base,externalTestOnly:true,orchestration:'Node + independent host C API adapter, no production runtime',compiler:cmd(process.env.CC||'cc',['--version']).toString().split('\n')[0],requested:fixtures.length,executed:rows.length,rows},null,2)+'\n');console.log('legacy compatibility '+rows.length+' fixtures byte-identical');