code wiki / _hdl_build / nx_intent_gate.nx
nx_intent_gate.nx
buildroot/runtime/_hdl_build/nx_intent_gate.nx
about
nx_intent_gate.nx -- the ENGINEER's gate for CR4 (intent WAL: work interrupted by a
crash stops being silently lost). Proves, re-runnably:
1 paired START+DONE -> nothing filed (a finished step is not an orphan)
2 pre-boot START with no DONE -> exactly ONE pm_plan row filed + INTENT-FILED mark
3 idempotent: same WAL again -> nothing refiled (the FILED mark holds)
4 in-flight protection: START from THIS boot (epoch >= boot_epoch) -> never filed
5 live writer: a REAL nx_team_pulse run appends START and matching DONE to the real WAL
Fixtures in /tmp (fixture conf has no E/D rows so revive runs them in milliseconds);
the real WAL/pm_plan are only touched by row 5's genuine pulse. Durable verdict ->
knowledge/status/intent_gate.log. Exit 0 iff 5/5.
Sovereign (syscalls only, no .sh). Run from nxc2 root. 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
| 14 | const IG_RUN_MS: i64 = 60000 // bound on one fixture revive (no organs -> instant) |
| 15 | const IG_PULSE_MS: i64 = 600000 // bound on the real pulse run (row 5) |
| 16 | const IG_SIGKILL: i64 = 9 |
functions
| 18 | func _p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 19 | func _pn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=48+(m%10);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 } |
| 20 | func _fp(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 } |
| 21 | func _fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(fd,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=48+(m%10);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 } |
| 22 | func ig_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 23 | func ig_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i } |
| 24 | func ig_numcat(dst: *u8, off: i64, v: i64) -> i64 |
| 34 | func ig_read_all(path: *u8, buf: *u8, cap: i64) -> i64 |
| 43 | func ig_contains(hay: *u8, n: i64, pat: *u8) -> i64 |
| 56 | func ig_count_pat(hay: *u8, n: i64, pat: *u8) -> i64 |
| 70 | func ig_last_num_after(hay: *u8, n: i64, pat: *u8) -> i64 |
| 92 | func ig_find_in(buf: *u8, from: i64, to: i64, pat: *u8) -> i64 |
| 104 | func ig_digits_at(buf: *u8, pos: i64, to: i64) -> i64 called by 1: ig_region_pair |
| 119 | func ig_region_pair(w: *u8, wn: i64) -> i64 |
| 143 | func ig_unlink(path: *u8) -> i64 { return __syscall(87, path, 0, 0, 0, 0, 0) } |
| 144 | func ig_write_file(path: *u8, content: *u8) -> i64 |
| 153 | func ig_run(elf: *u8, argv: *i64, ms: i64, mute: i64) -> i64 |
| 182 | func ig_revive(conf: *u8, lg: *u8, jr: *u8, wal: *u8, pm: *u8) -> i64 |
| 194 | func ig_row(lfd: i64, idx: i64, name: *u8, ok: i64, acc: *i64) -> i64 |
| 204 | func main() -> i64 |