code wiki / (root) / nx_tools_canary_gate.nx

nx_tools_canary_gate.nx

buildroot/runtime/nx_tools_canary_gate.nx

6519 B134 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/prooftopic tools
docsdependenciesstructsconstsfunctions

about

nx_tools_canary_gate.nx -- CANARY for the tools daemon (debt seq1373). license_tier: ORIGINAL WHY THIS EXISTS: nx_tools_api_serve.elf serves EVERY sovereign MCP tool, so it is the ONE service with no sovereign recovery path -- if a promoted binary crash-loops, the session loses nx_mgmt and therefore cannot call /api/rollback, because the rollback path runs THROUGH the thing being replaced. Promoting it on the strength of a compile is restart-and-hope. This gate makes the proof mechanical instead (rule 26). IT RUNS, IT DOES NOT MERELY COMPILE: it starts the STAGED binary on a throwaway port and then drives that SAME binary's own plain-HTTP probe client against it over a real socket. A successful bind is NOT evidence; a real GET /api/tools round-trip that returns the registry body is. T1 is the NON-VACUITY tooth: the identical probe against a port where nothing listens MUST fail. Without it a probe that silently returns 0 would report GREEN for a dead binary -- proving your 0 is the whole point.

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_gate.nx nx_tools_canary_gate.nx

imports: nx_syscalls.nxnx_gate.nx

imported by: nobody (leaf or entry point)

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

main gw sys_write sys_mmap tc_probe sys_fork sys_openat_wr sys_dup3 sys_mmap ↻ sys_execve sys_exit sys_wait4 tc_spawn sys_fork ↻ sys_openat_wr ↻ sys_dup3 ↻ sys_mmap ↻ sys_execve ↻ sys_exit ↻ sys_sleep_ms sys_mmap ↻ sys_munmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close tc_has tc_slen tc_kill sys_mmap ↻ sys_wait4 ↻ sys_sleep_ms ↻ gn sys_write ↻ sys_mmap ↻ sys_exit ↻

structs

none

consts

14const TC_STAGED: *u8 = "/volume1/homes/elderwesto/nishihost/nx_tools_api_serve.elf.new" as *u8
15const TC_PORT: *u8 = "18991" as *u8
16const TC_DEADPORT: *u8 = "18992" as *u8
17const TC_SRVLOG: *u8 = "/tmp/nx_tools_canary_srv.out" as *u8
18const TC_PROBELOG: *u8 = "/tmp/nx_tools_canary_probe.out" as *u8

functions

20func tc_slen(s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { i = i + 1 } return i }
called by 1: tc_has
21func tc_has(buf: *u8, n: i64, pat: *u8) -> i64
called by 1: main calls 1: tc_slen
35func tc_spawn(elf: *u8, a1: *u8, a2: *u8, logf: *u8) -> i64
53func tc_probe(elf: *u8, port: *u8, path: *u8, logf: *u8) -> i64
80func tc_kill(pid: i64) -> i64
called by 1: main calls 3: sys_mmapsys_wait4sys_sleep_ms
94func main() -> i64