code wiki / (root) / nx_execsurface_gate.nx

nx_execsurface_gate.nx

buildroot/runtime/nx_execsurface_gate.nx

29488 B559 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_execsurface_gate.nx -- referee for nx_execsurface (2026-08-23, compare CE2). END-TO-END: forks the DEPLOYED ./nx_execsurface.elf into a /tmp/<gate>/ fixture path (never the production artifact), reads the rows back the way the shared classifier does, and checks BOTH directions of the surface rule: a program the clock demonstrably runs is credited, a program only MENTIONED is not. T1 precondition the organ did not exit 3 UNOBSERVABLE (gv_need -> SKIP, never RED) T2 exit 0 and the receipt names the artifact T3 the last line is the canonical stamp (# asof=...) with a non-zero asof T4 partition on_surface + ref_only + dark == organs (a partition is a claim) T5 full population: counted rows == organs declared, and == an INDEPENDENT count of *.elf at . and _offc/ T6 positive control: a program the live clocksched- plane names (read here, FULL prefix, never bare) has clock=1 and first_surface=clock T7 neg-control: a fabricated name has no row T8 anti-vacuity of the 2-hop rule: at least one row is credited fork:<caller> AND that caller's own row is on a surface; at least one row is ref:<caller> AND that caller's own row is NOT on a surface (both directions present in the real population, so the rule demonstrably discriminates) T9 every clock-credited row's name really appears in the plane (no credit without a plane token) T10 plan expansion (2026-09-17): the first live clock row that runs nx_plan_run.elf <id> names a plan whose first tool has a census row on a surface (first_surface plan, or a direct surface); the pre-change census is the planted known-bad: it reads that tool REGISTERED-DARK and this tooth goes RED against it T11 a "../<x>.elf literal credits a fork (the regen-forked gapmap) T12 EVERY ROSTER CONF (2026-09-18): every gate row of every conf a live clock row runs through nx_gate_roster_run beat, whatever journal that beat writes, that has a census row reads roster=1. The confs and rows are re-derived HERE by an independent reading (the runner's grammar written again, never the organ's lib), so the organ cannot vouch for itself. T13 the other rosters: the same over the confs OTHER than the runner's default (the heavy and the slow rosters). The pre-change census is the planted known-bad: it read one conf by name, so those gates read roster=0 and T13 goes RED. T14/T15 two methods, one answer: the organ's receipt counts the same beats, and the same beats writing ANOTHER journal (credited too: the close ruler reads each of them from its own journal), as the gate's own reading of the plane. license_tier: ORIGINAL expect_exit: 0 GREEN | 1 RED | 3 SKIP

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_tool_run.nx nx_gate_verdict.nx nx_execsurface_gate.nx

imports: nx_syscalls.nxnx_tool_run.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main gv_head gv_puts sys_write gv_ctr sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_mkdir sys_mmap ↻ tr_run_capture sys_mmap ↻ sys_pipe2 sys_fork sys_close sys_dup3 sys_execve_clean sys_close_inherited sys_close_inherited_proc sys_openat_rd sys_mmap ↻ sys_getdents64 dirent_reclen sys_close ↻ sys_munmap sys_execve tr_exec_failed sys_write ↻

structs

none

consts

33const EG_CAP: i64 = 65536
34const EG_PLANE_CAP: i64 = 1048576
35const EG_FIX_DIR: *u8 = "/tmp/nx_execsurface_gate"
36const EG_FIX_OUT: *u8 = "/tmp/nx_execsurface_gate/execsurface.tsv"
37const EG_RC_UNOBSERVABLE: i64 = 3
38const EG_DIRBUF: i64 = 131072
157const EG_ROSTER_DEFAULT: *u8 = "knowledge/gateroster.conf" // what the runner's beat reads when it names no conf
158const EG_ROSTER_JRNL: *u8 = "knowledge/status/gateroster.jrnl" // the production journal: what the beat writes when it names none
159const EG_NOT_A_BEAT: i64 = 0 - 1
160const EG_BEAT_ELF: *u8 = "nx_gate_roster_run.elf beat"
161const EG_BEAT_BARE: *u8 = "nx_gate_roster_run beat"

functions

40func eg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
41func eg_starts(s: *u8, p: *u8) -> i64 { var i: i64 = 0; while p[i] != (0 as u8) { if s[i] != p[i] { return 0 } i = i + 1 } return 1 }
42func eg_ends(s: *u8, sfx: *u8) -> i64
called by 2: eg_count_elfsmain calls 1: eg_slen
50func eg_digits(b: *u8, i: i64) -> i64
called by 1: eg_kv
62func eg_kv(line: *u8, key: *u8) -> i64
called by 1: main calls 3: eg_sleneg_startseg_digits
72func eg_row(b: *u8, n: i64, name: *u8) -> i64
called by 2: eg_roster_checkmain calls 1: eg_slen
89func eg_field(b: *u8, n: i64, r: i64, f: i64, out: *u8, cap: i64) -> i64
104func eg_on_surface(b: *u8, n: i64, r: i64) -> i64
121func eg_find_in(b: *u8, s: i64, e: i64, lit: *u8) -> i64
called by 2: eg_beat_confmain calls 1: eg_slen
133func eg_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } d[p] = 0 as u8; return p }
called by 1: main
134func eg_count_elfs(dir: *u8) -> i64
163func eg_isid(c: i64) -> i64
called by 1: eg_roster_check
173func eg_sep(c: i64) -> i64 { if c == 32 { return 1 } if c == 9 { return 1 } if c == 13 { return 1 } return 0 }
called by 1: eg_beat_conf
177func eg_beat_conf(p: *u8, s: i64, e: i64, co: *i64) -> i64
called by 1: main calls 3: eg_find_ineg_sleneg_sep
202func eg_seen(seen: *u8, sn: i64, path: *u8) -> i64
called by 1: main calls 1: eg_slen
215func eg_roster_check(b: *u8, datalen: i64, conf: *u8, cnt: *i64) -> i64
253func main(argc: i64, argv: *i64) -> i64