nx_http_probe_gate.nx
buildroot/runtime/nx_http_probe_gate.nx
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
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
structs
| none |
consts
| 38 | const HPG_PORT_OK: i64 = 19791 |
| 39 | const HPG_PORT_500: i64 = 19792 |
| 40 | const HPG_PORT_HANG: i64 = 19793 |
| 41 | const HPG_PORT_CLOSED: i64 = 19794 |
| 42 | const HPG_BACKLOG: i64 = 16 |
| 43 | const HPG_ADDR_BYTES: i64 = 16 |
| 44 | const HPG_BUF: i64 = 8192 |
| 45 | const HPG_DQUOTE: i64 = 34 |
| 46 | const HPG_DIR_MODE: i64 = 493 |
| 49 | const HPG_TRACE_OFF: i64 = 0 |
| 50 | const HPG_TRACE_ON: i64 = 1 |
| 51 | const HPG_NS_PER_MS: i64 = 1000000 |
| 52 | const HPG_BAD_CODE: i64 = 999 |
| 55 | const HPG_BUDGET_SEC: i64 = 1 |
| 59 | const HPG_HANG_MIN_MS: i64 = 500 |
| 60 | const HPG_HANG_MAX_MS: i64 = 3000 |
| 63 | const HPG_EPOCH_SLACK: i64 = 120 |
| 66 | const HPG_FD_STDERR: i64 = 2 |
| 67 | const HPG_FD_ERRSAVE: i64 = 200 |
functions
| 69 | func hpg_cat(d: *u8, o: i64, s: *u8) -> i64 |
| 75 | func hpg_catc(d: *u8, o: i64, c: i64) -> i64 { d[o] = c as u8; return o + 1 } called by 1: hpg_marker |
| 78 | func hpg_sa(port: i64) -> *u8 |
| 86 | func hpg_listen(port: i64) -> i64 |
| 101 | func hpg_respond_once(lfd: i64, resp: *u8, rlen: i64) -> i64 |
| 116 | func hpg_reap(pid: i64) -> i64 |
| 124 | func hpg_exists(path: *u8) -> i64 |
| 130 | func hpg_slurp(path: *u8, dst: *u8, cap: i64) -> i64 |
| 142 | func hpg_marker(dst: *u8, word: *u8) -> i64 |
| 153 | func hpg_response(dst: *u8, statusline: *u8, marker: *u8) -> i64 |
| 164 | func main(argc: i64, argv: *i64) -> i64 |