nx_handoff_gate.nx
buildroot/runtime/nx_handoff_gate.nx
about
nx_handoff_gate.nx -- SHARED deep-gate primitives (the DRY keystone of the sensor-gap program).
Per [[feedback-handoff-chain-sota-gate-doctrine]] step 1: makes deepening ANY gate cheap (rule 15 DRY)
instead of hand-rolling ~3000 liar-killers. Three sensor families, one import:
LIAR-KILLERS -- hg_neg_control (a wrong-input score must stay under a floor, else the metric is
GAMED/broken), hg_monotonic_* (physics: drift accumulates, counts don't jump back),
hg_invariant_le/ge (bounds: drifted can never beat its clean floor),
hg_evidence_file (a claim's artifact must OPEN on disk -- never asserted).
REGRESSION -- hg_baseline_load (absent baseline => -1, NEVER fabricated) + hg_no_backslide /
hg_no_worsen (stored SOTA-track guard: a change that worsens any tracked value = RED)
+ hg_baseline_print (the canonical capture line).
TELEMETRY -- HgStage per-handoff records (quality/bytes/time/fail) + hg_chain_report (per-stage
table, not just a final number) + LOCALIZERS hg_chain_worst_drop (WHICH handoff lost
the most quality) and hg_chain_max_time (WHERE the time goes).
Pure logic + read-only I/O; deterministic; no writes (never-brick by construction). Library (no main);
proven by runtime/_hdl_build/nx_handoff_gate_proof.nx. First consumer: nx_sensor_gap_census.
license_tier: ORIGINAL
dependencies 2 imports · 5 importers
imports: syscalls.nxruntime.nx
imported by: nx_gate_baseline_harness.nxnx_gate_baseline_sweep.nxnx_gate_mutation_sweep.nxnx_handoff_gate_proof.nxnx_sensor_gap_census.nx
structs
| 151 | struct HgStage |
consts
| 159 | const HG_STAGE_BYTES: i64 = 40 |
functions
| 24 | func hg_neg_control(wrong_score: i64, floor: i64) -> i64 called by 1: main |
| 30 | func hg_monotonic_nondec(vals: *i64, n: i64) -> i64 called by 1: main |
| 40 | func hg_monotonic_noninc(vals: *i64, n: i64) -> i64 called by 1: main |
| 50 | func hg_invariant_le(a: i64, b: i64) -> i64 called by 1: main |
| 55 | func hg_invariant_ge(a: i64, b: i64) -> i64 called by 1: main |
| 61 | func hg_evidence_file(path: *u8) -> i64 |
| 71 | func hg_parse_ints(buf: *u8, len: i64, out: *i64, maxn: i64) -> i64 |
| 98 | func hg_baseline_load(path: *u8, out: *i64, maxn: i64) -> i64 |
| 116 | func hg_no_backslide(cur: *i64, base: *i64, n: i64) -> i64 |
| 126 | func hg_no_worsen(cur: *i64, base: *i64, n: i64) -> i64 called by 1: main |
| 136 | func hg_baseline_print(tag: *u8, vals: *i64, n: i64) -> i64 |
| 161 | func hg_stage_at(stages: *HgStage, i: i64) -> *HgStage |
| 165 | func hg_stage_set(stages: *HgStage, i: i64, name: *u8, quality: i64, bytes: i64, time_us: i64, fail: i64) -> i64 |
| 176 | func hg_chain_fails(stages: *HgStage, n: i64) -> i64 |
| 188 | func hg_chain_worst_drop(stages: *HgStage, n: i64) -> i64 |
| 206 | func hg_chain_max_time(stages: *HgStage, n: i64) -> i64 |
| 221 | func hg_chain_report(tag: *u8, stages: *HgStage, n: i64) -> i64 |