code wiki / (root) / nx_handoff_gate.nx

nx_handoff_gate.nx

buildroot/runtime/nx_handoff_gate.nx

8009 B244 linesdepth 4pulls 4 transitivereach 5 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

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

syscalls.nx runtime.nx nx_handoff_gate.nx nx_gate_baseline_harness.nx nx_gate_baseline_sweep.nx nx_gate_mutation_sweep.nx nx_handoff_gate_proof.nx nx_sensor_gap_census.nx

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

151struct HgStage

consts

159const HG_STAGE_BYTES: i64 = 40

functions

24func hg_neg_control(wrong_score: i64, floor: i64) -> i64
called by 1: main
30func hg_monotonic_nondec(vals: *i64, n: i64) -> i64
called by 1: main
40func hg_monotonic_noninc(vals: *i64, n: i64) -> i64
called by 1: main
50func hg_invariant_le(a: i64, b: i64) -> i64
called by 1: main
55func hg_invariant_ge(a: i64, b: i64) -> i64
called by 1: main
61func hg_evidence_file(path: *u8) -> i64
called by 3: mainmainmain
71func hg_parse_ints(buf: *u8, len: i64, out: *i64, maxn: i64) -> i64
98func hg_baseline_load(path: *u8, out: *i64, maxn: i64) -> i64
called by 3: mainmainmain calls 2: sys_readhg_parse_ints
116func hg_no_backslide(cur: *i64, base: *i64, n: i64) -> i64
called by 2: mainmain
126func hg_no_worsen(cur: *i64, base: *i64, n: i64) -> i64
called by 1: main
136func hg_baseline_print(tag: *u8, vals: *i64, n: i64) -> i64
called by 1: main calls 2: printprint_i64
161func hg_stage_at(stages: *HgStage, i: i64) -> *HgStage
165func hg_stage_set(stages: *HgStage, i: i64, name: *u8, quality: i64, bytes: i64, time_us: i64, fail: i64) -> i64
called by 1: main calls 1: hg_stage_at
176func hg_chain_fails(stages: *HgStage, n: i64) -> i64
called by 1: hg_chain_report calls 1: hg_stage_at
188func hg_chain_worst_drop(stages: *HgStage, n: i64) -> i64
called by 1: main calls 1: hg_stage_at
206func hg_chain_max_time(stages: *HgStage, n: i64) -> i64
called by 1: main calls 1: hg_stage_at
221func hg_chain_report(tag: *u8, stages: *HgStage, n: i64) -> i64