code wiki / _hdl_build / nx_consol_apply_gate.nx

nx_consol_apply_gate.nx

buildroot/runtime/_hdl_build/nx_consol_apply_gate.nx

6437 B120 linesdepth 4pulls 6 transitivereach 0 importersview sourcekind gate/prooftopic consol
docsdependenciesstructsconstsfunctions

about

nx_consol_apply_gate.nx -- GATE for the gated consolidation applier (5 teeth, 2 neg-controls + restore-verify). PREREQ: stage _offc/nx_consol_apply.elf + _offc/nx_fix_build.elf. Run from nxc2. The mock build (nx_fix_build) reads /tmp/cab_input -> artifact, so the artifact DEPENDS on that file. T1 SAFE: shadow is an UNRELATED file -> retire it -> build byte-identical -> CONSOLIDATED, shadow now at retire-path, gone from origin. T2 NEG (the never-brick tooth): shadow IS /tmp/cab_input (the file the build reads) -> retire -> build output changes (content -> "MISSING") -> REFUSED, and the shadow is RESTORED at its origin. T3 restore-verify: after T2, /tmp/cab_input exists again AND byte-equals the original (rollback sound). T4 shadow-absent -> clean exit 2. T5 idempotent origin: after T1, re-running with the (now-absent) origin shadow -> exit 2, no partial state. Verdict exit 0 iff 5/5. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 4 imports · 0 importers

nx_seat_drive_lib.nx nx_seg_store.nx nx_deploy_lib.nx nx_syscalls.nx nx_consol_apply_gate.nx

imports: nx_seat_drive_lib.nxnx_seg_store.nxnx_deploy_lib.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main ag_atoi ss_writefile sys_openat_wr sys_write sys_close sys_fsync ag_len sys_unlinkat ag_run sys_mmap dep_run_capture sys_fork sys_openat_wr ↻ sys_dup3 sys_mmap ↻ sys_execve_clean sys_close ↻ sys_execve sys_exit sys_wait4 ag_exists sys_openat_rd sys_close ↻ sd_w sys_write ↻ sys_mmap ↻ dp_read sys_openat_rd ↻ sys_read sys_close ↻ sd_count ag_read sys_openat_rd ↻ sys_read ↻ sys_close ↻ sys_exit ↻ ag_itoa sys_mmap ↻ sys_execve ↻

structs

none

consts

none

functions

17func ag_atoi(s: *u8) -> i64 { var v: i64 = 0; var i: i64 = 0; while s[i] != (0 as u8) { let c: i64 = s[i] as i64; if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } } i = i + 1 } return v }
called by 1: main
18func ag_itoa(dst: *u8, v: i64) -> i64 { var m: i64 = v; let t: *u8 = sys_mmap(24); 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 { dst[i] = t[k - 1 - i]; i = i + 1 } dst[k] = 0 as u8; return k }
called by 1: main calls 1: sys_mmap
19func ag_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: main
20func ag_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd >= 0 { sys_close(fd); return 1 } return 0 }
called by 1: main calls 2: sys_openat_rdsys_close
21func ag_read(path: *u8, buf: *u8, cap: i64) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 - 1 } let n: i64 = sys_read(fd, buf, cap - 1); sys_close(fd); return n }
called by 1: main calls 3: sys_openat_rdsys_readsys_close
24func ag_run(shadow: *u8, retire: *u8, artifact: *u8, outp: *u8) -> i64
called by 1: main calls 2: sys_mmapdep_run_capture
34func main(argc: i64, argv: *i64) -> i64