code wiki / _hdl_build / nx_gate_baseline_harness.nx
nx_gate_baseline_harness.nx
buildroot/runtime/_hdl_build/nx_gate_baseline_harness.nx
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
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
structs
| none |
consts
| 28 | const GBH_MAGIC_4096: i64 = 4096 |
| 29 | const GBH_MAGIC_1048576: i64 = 1048576 |
| 31 | const GBH_MAX_VALS: i64 = 64 |
functions
| 34 | func gbh_cat(dst: *u8, off: i64, s: *u8) -> i64 called by 1: main |
| 42 | func gbh_run(path: *u8, argv: *i64, envp: *i64, redir_out: i64, redir_err: i64) -> i64 |
| 58 | func gbh_has(buf: *u8, len: i64, lit: *u8) -> i64 called by 1: main |
| 76 | func gbh_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 93 | func gbh_num(dst: *u8, off: i64, n: i64) -> i64 |
| 106 | func gbh_bank(ledger: *u8, ltmp: *u8, rc: i64, count: i64, vals: *i64, k: i64) -> i64 |
| 130 | func main(argc: i64, argv: *i64) -> i64 |