code wiki / _hdl_build / nx_gate_baseline_harness.nx

nx_gate_baseline_harness.nx

buildroot/runtime/_hdl_build/nx_gate_baseline_harness.nx

13378 B344 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind tooltopic gate
docsdependenciesstructsconstsfunctions

about

nx_gate_baseline_harness.nx -- retrofit a REGRESSION BASELINE onto ANY gate with ZERO gate-source edits. The sensor-gap risk map ([[project-nishi-sensor-gap-census-2026-07-14]]) measured 87% of ~3675 gates with NO regression baseline = they can silently backslide. Hand-editing thousands of gates would be a patch cascade (rule 3) -- so this harness wraps the RUNNER instead: it forks the sovereign build lane on a gate, captures the gate's output + exit code, and banks/guards a per-gate baseline ledger. Wrapping a gate = running one command; the gate's source is never touched. usage: nx_gate_baseline_harness <gate-name> [--rebase] first run -> CAPTURE: bank {rc, int-vector of output} to knowledge/status/gatebase_<gate>.tsv later runs -> GUARD: rc must MATCH the banked rc (universal invariant, judged); numeric drift is SURFACED per position (informational, NOT judged -- auto-judging unknown numbers directionally would make a LYING sensor; per-gate directional specs are the v2 data-row hook). --rebase -> re-bank current state as the new baseline (explicit operator action; refused on rc!=0). LIAR-KILLERS on the harness itself: * signal-aware exit decode (128+sig, the proven sbr_run idiom) -- a SEGFAULTED gate can never read as GREEN. * a red run is REFUSED as a baseline -- a broken state can never become "the standard". * an absent/unreadable output = RED (evidence-grounding: no evidence, no verdict). * ledger writes are atomic (tmp + renameat); only /tmp/gatebase_*.out + knowledge/status/gatebase_*.tsv are ever written -- no gate source is touched (never-brick by construction). Sovereign nx_cc->nxasm; forks _offc/nx_sov_build_run.elf (no gcc, no sh). Run with CWD=nxc2 root. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

syscalls.nx runtime.nx nx_handoff_gate.nx nx_gate_baseline_harness.nx

imports: syscalls.nxruntime.nxnx_handoff_gate.nx

imported by: nobody (leaf or entry point)

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

main print strlen gbh_cat sys_openat_wr gbh_run sys_fork sys_dup3 sys_execve sys_wait4 print_i64 itoa gbh_read sys_read hg_parse_ints hg_baseline_load sys_read ↻ hg_parse_ints ↻ gbh_has gbh_num sys_renameat gbh_bank sys_openat_wr ↻ gbh_num ↻ sys_renameat ↻

structs

none

consts

28const GBH_MAGIC_4096: i64 = 4096
29const GBH_MAGIC_1048576: i64 = 1048576
31const GBH_MAX_VALS: i64 = 64

functions

34func gbh_cat(dst: *u8, off: i64, s: *u8) -> i64
called by 1: main
42func gbh_run(path: *u8, argv: *i64, envp: *i64, redir_out: i64, redir_err: i64) -> i64
58func gbh_has(buf: *u8, len: i64, lit: *u8) -> i64
called by 1: main
76func gbh_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 1: sys_read
93func gbh_num(dst: *u8, off: i64, n: i64) -> i64
called by 2: gbh_bankmain
106func gbh_bank(ledger: *u8, ltmp: *u8, rc: i64, count: i64, vals: *i64, k: i64) -> i64
130func main(argc: i64, argv: *i64) -> i64