code wiki / _hdl_build / nx_sclass_flow04_gate.nx

nx_sclass_flow04_gate.nx

buildroot/runtime/_hdl_build/nx_sclass_flow04_gate.nx

6904 B130 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/prooftopic sclass
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_sclass_flow04_gate.nx

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

main fw sys_write sys_mmap f4_run f4_wait sys_mmap ↻ sys_wait4 f4_spawn sys_fork sys_openat_wr sys_dup3 sys_mmap ↻ sys_execve sys_exit fn sys_mmap ↻ sys_write ↻ f4_elf_path fcat f4_spawn ↻ f4_wait ↻ sys_exit ↻

structs

none

consts

20const F4_RUNNER: *u8 = "_offc/nx_sov_build_run.elf\x00" as *u8
21const F4_CONC: i64 = 8 // concurrent instances per gate (the original flake showed at 4..8)

functions

23func fw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
24func 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 }
called by 1: main calls 2: sys_mmapsys_write
25func 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
28func f4_elf_path(name: *u8, out: *u8) -> i64
called by 1: main calls 1: fcat
37func f4_spawn(path: *u8, arg1: *u8) -> i64
53func f4_wait(pid: i64) -> i64
called by 2: f4_runmain calls 2: sys_mmapsys_wait4
60func f4_run(path: *u8, arg1: *u8) -> i64 { return f4_wait(f4_spawn(path, arg1)) }
called by 1: main calls 2: f4_waitf4_spawn
62func main() -> i64