code wiki / (root) / nx_http_probe_gate.nx

nx_http_probe_gate.nx

buildroot/runtime/nx_http_probe_gate.nx

21262 B428 linesdepth 7pulls 12 transitivereach 0 importersview sourcekind gate/prooftopic http
docsdependenciesstructsconstsfunctions

about

nx_http_probe_gate.nx -- THE REFEREE FOR nx_http_probe. Hermetic, in-process, no external service. WHAT IT HAS TO PROVE, AND WHY THE OBVIOUS GATE WOULD NOT PROVE IT. The organ under test replaces a cron one-liner whose ONLY defect was that it failed SILENTLY: the row fired, the command did not run, all output was discarded, and the capability-plane watch went stale at 10.9x its budget with nobody able to name which link broke. A gate that only asks "does a healthy endpoint return 0" would pass a probe that ALSO returns 0 for a dead one, and a gate that only reads exit codes would pass a probe that stamps the heartbeat on a FAILING run -- which is the same blindness wearing a green badge. So every failure fixture asserts TWO things: the NAMED exit code, and THE ABSENCE OF THE HEARTBEAT. **** THE STAMP IS THE THING THE WATCHER BELIEVES. ASSERTING ITS ABSENCE IS THE TOOTH. **** THE POSITIVE CONTROL IS NOT DECORATION. A guard that refuses everything passes every negative test, and four SSRF deny-tests once went green over a wholly broken guard for exactly that reason. T1-T4 are the input that MUST be accepted, so an always-fail probe cannot score. THE ABSENCE FIXTURES REUSE THE PATH THE POSITIVE CONTROL JUST WROTE. A fixture that asserts "no file appeared at some path" is vacuous if nothing could ever have appeared there. T1/T2 prove this organ writes THIS EXACT PATH; the failing runs then unlink it and prove it stays gone. FIXTURES ARE ASSEMBLED AT RUNTIME, NOT WRITTEN AS LITERALS. A source-scanning detector finds its own fixture, and the estate has paid for that twice. The JSON marker is built from a quote byte, so the needle and the body it lives in come from ONE code path and cannot drift apart. SCRATCH LIVES IN /tmp/nx_http_probe_gate/, NEVER the production tree: a gate that shares a fixture with a production beat reports on the FIXTURE, not on the code (nx_gate_fixture_ratchet_gate). Setup creates and clears; there is no teardown, because a teardown does not run when a run crashes. PORTS ARE PROVEN FREE BY BINDING THEM, NEVER ASSUMED. A probe port you did not verify free is not a control, it is a second instance. If any port is taken the gate SKIPs -- "I could not look" is not "it is broken". expect_exit: 0 license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_clock.nx nx_gate_verdict.nx nx_http_probe_lib.nx nx_http_probe_gate.nx

imports: nx_syscalls.nxnx_clock.nxnx_gate_verdict.nxnx_http_probe_lib.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_unlinkat hpg_listen sys_socket sys_mmap ↻ sys_setsockopt hpg_sa sys_mmap ↻ sys_bind sys_close sys_listen sys_close ↻ gv_need gv_puts ↻ sys_openat_wr gv_verdict gv_note_bare_rate gv_bare_rate gv_at gv_obj_has_n

structs

none

consts

38const HPG_PORT_OK: i64 = 19791
39const HPG_PORT_500: i64 = 19792
40const HPG_PORT_HANG: i64 = 19793
41const HPG_PORT_CLOSED: i64 = 19794
42const HPG_BACKLOG: i64 = 16
43const HPG_ADDR_BYTES: i64 = 16
44const HPG_BUF: i64 = 8192
45const HPG_DQUOTE: i64 = 34
46const HPG_DIR_MODE: i64 = 493
49const HPG_TRACE_OFF: i64 = 0
50const HPG_TRACE_ON: i64 = 1
51const HPG_NS_PER_MS: i64 = 1000000
52const HPG_BAD_CODE: i64 = 999
55const HPG_BUDGET_SEC: i64 = 1
59const HPG_HANG_MIN_MS: i64 = 500
60const HPG_HANG_MAX_MS: i64 = 3000
63const HPG_EPOCH_SLACK: i64 = 120
66const HPG_FD_STDERR: i64 = 2
67const HPG_FD_ERRSAVE: i64 = 200

functions

69func hpg_cat(d: *u8, o: i64, s: *u8) -> i64
75func hpg_catc(d: *u8, o: i64, c: i64) -> i64 { d[o] = c as u8; return o + 1 }
called by 1: hpg_marker
78func hpg_sa(port: i64) -> *u8
called by 1: hpg_listen calls 1: sys_mmap
86func hpg_listen(port: i64) -> i64
101func hpg_respond_once(lfd: i64, resp: *u8, rlen: i64) -> i64
116func hpg_reap(pid: i64) -> i64
called by 1: main calls 3: sys_mmapsys_wait4sys_munmap
124func hpg_exists(path: *u8) -> i64
called by 1: main calls 2: sys_openat_rdsys_close
130func hpg_slurp(path: *u8, dst: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
142func hpg_marker(dst: *u8, word: *u8) -> i64
called by 1: main calls 2: hpg_catchpg_cat
153func hpg_response(dst: *u8, statusline: *u8, marker: *u8) -> i64
called by 1: main calls 1: hpg_cat
164func main(argc: i64, argv: *i64) -> i64