code wiki / _hdl_build / _ark_gate_test.nx
_ark_gate_test.nx
buildroot/runtime/_hdl_build/_ark_gate_test.nx
about
_ark_gate_test.nx -- ARK-GATE-001 BOTH-ARMS gate (NO-FAKE-GREEN).
Proves the gate-aware nx_ark_push on a THROWAWAY /tmp git repo + bare origin
-- the real /mnt/c/Users/elder/nishi-core repo is NEVER touched. The gated
ark_push ELF is run with argv overrides (repo/branch/marker/state/log all in
/tmp). Three arms, each asserted by capturing origin's HEAD before/after:
ARM-A no fresh ACHIEVED marker -> HOLD: origin HEAD UNCHANGED + log HOLD
ARM-B fresh ACHIEVED marker -> PUSH: origin HEAD ADVANCED + verdict GREEN
ARM-C same marker, re-run -> HOLD (already-pushed): origin HEAD UNCHANGED
Also stages a dirty file before ARM-A to prove un-gated work stays LOCAL.
Emits ARKGATEGATE <p>/3 verdict=GREEN|RED -> knowledge/status/ark_gate_test.log
with a ||MARK= anchor so reconcile flips ARK-GATE-001 -> DONE on evidence.
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
| 15 | const T_ELF: *u8 = "/tmp/_apk_gated.elf" // the gated ark_push (built before the gate runs) |
| 16 | const T_GIT: *u8 = "/usr/bin/git" |
| 17 | const T_ROOT: *u8 = "/tmp/_agt_work" // scratch work tree |
| 18 | const T_ORIGIN: *u8 = "/tmp/_agt_origin.git" // scratch bare origin |
| 19 | const T_BRANCH: *u8 = "main" |
| 20 | const T_MARKER: *u8 = "/tmp/_agt_ark_gate.marker" |
| 21 | const T_STATE: *u8 = "/tmp/_agt_ark_push.state" |
| 22 | const T_LOG: *u8 = "/tmp/_agt_ark_push.log" |
| 23 | const T_HEADTXT:*u8 = "/tmp/_agt_head.txt" // origin HEAD capture |
| 24 | const T_OUTLOG: *u8 = "knowledge/status/ark_gate_test.log" |
| 25 | const MODE: i64 = 420 |
functions
| 27 | func t_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 28 | func t_f(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 } |
| 29 | func t_n(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)) as u8;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 } |
| 31 | func t_write(path: *u8, s: *u8) -> i64 |
| 39 | func t_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 52 | func t_run(argv: *i64, outpath: *u8) -> i64 called by 5: t_gitt_origin_headt_arkpusht_build_gatedmain calls 7: sys_forksys_openat_wrsys_dup3sys_mmapsys_execvesys_exit+1 |
| 76 | func t_git(repo: *u8, a: *u8, b: *u8, c: *u8, d: *u8) -> i64 |
| 92 | func t_origin_head(out: *u8) -> i64 |
| 104 | func t_streq(a: *u8, an: i64, b: *u8, bn: i64) -> i64 called by 1: main |
| 113 | func t_arkpush() -> i64 |
| 127 | func t_log_has(pat: *u8) -> i64 |
| 143 | func t_chk(label: *u8, ok: i64, bad: *i64) -> i64 |
| 152 | func t_build_gated() -> i64 |
| 186 | func main() -> i64 |