code wiki / _hdl_build / nx_sclass_flow04_gate.nx
nx_sclass_flow04_gate.nx
buildroot/runtime/_hdl_build/nx_sclass_flow04_gate.nx
about
nx_sclass_flow04_gate.nx -- the EVIDENCE GATE for SCLASS-FLOW-04 ("de-flake the control plane:
dispatch/journal/boot-revive intermittent RED -> 3x deterministic GREEN each"). PM-routed to the engineer.
ROOT CAUSE (found by measurement, not assumption): the three control-plane gates tried to be hermetic by
namespacing their /tmp scratch with getpid -- but __syscall(39) is BROKEN on this backend (returns the
CONSTANT -25 for every process). So every concurrent run shared the same scratch files (/tmp/m6_ledger_-25.log,
/tmp/rj_good_.jrnl, /tmp/dlg_<ms>_-25.tsv) and corrupted each other => intermittent RED under any parallel sweep.
Sequentially they pass (each truncates at start); concurrently they collided. FIX: a g_uniq() that claims a
process-unique token ATOMICALLY via O_EXCL (/tmp/nxuq_<n>), now namespacing ALL scratch in all three gates.
THIS GATE proves the de-flake on the REAL built ELFs:
PHASE 1 (the literal criterion): build each gate once, run each 3x CONSECUTIVELY -> 9/9 must be GREEN.
PHASE 2 (the actual flake trigger): run each gate's ELF F4_CONC times CONCURRENTLY -> 0 fails (the proof
the fix holds; before the fix this RED-ed 5..8 of 8).
LIAR-KILL: a bogus ELF path must yield non-zero -> the harness genuinely detects RED, never rubber-stamps.
GREEN iff phase1==9 AND every gate's concurrent-fails==0 AND the liar-kill fired. expect_exit: 0
license_tier: ORIGINAL
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 20 | const F4_RUNNER: *u8 = "_offc/nx_sov_build_run.elf\x00" as *u8 |
| 21 | const F4_CONC: i64 = 8 // concurrent instances per gate (the original flake showed at 4..8) |
functions
| 23 | func fw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 24 | func fn(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{sys_write(1,"-\x00" as *u8,1);m=0-m} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 } |
| 25 | func fcat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; var i: i64=0; while s[i]!=(0 as u8){dst[o]=s[i];o=o+1;i=i+1} return o } called by 1: f4_elf_path |
| 28 | func f4_elf_path(name: *u8, out: *u8) -> i64 |
| 37 | func f4_spawn(path: *u8, arg1: *u8) -> i64 |
| 53 | func f4_wait(pid: i64) -> i64 |
| 60 | func f4_run(path: *u8, arg1: *u8) -> i64 { return f4_wait(f4_spawn(path, arg1)) } |
| 62 | func main() -> i64 |