code wiki / _hdl_build / nx_contentdiff_gate.nx

nx_contentdiff_gate.nx

buildroot/runtime/_hdl_build/nx_contentdiff_gate.nx

12609 B196 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind gate/prooftopic contentdiff
docsdependenciesstructsconstsfunctions

about

nx_contentdiff_gate.nx -- THE REFEREE FOR THE PROMOTE CAPABILITY RULER. WHY IT EXISTS: nx_contentdiff_lib is the arithmetic behind BOTH the hand-run oracle (nx_contentdiff) AND the staging guard inside md_promote_staged, i.e. it decides whether a promote is allowed to destroy printable content. On 2026-09-03 a census found it had NO GATE ANYWHERE -- the ruler that judges every promote in the estate was itself unjudged, so every property it claims rested on the fact that nobody had seen it misbehave. ★A GREEN THAT NEVER HAD A CORRESPONDING RED IS UNVERIFIED, and here there was not even a green: there was no test. It proves the properties the promote decision actually rests on: * the loss measure is CORRECT on constructed subset / superset / identical / disjoint inputs; * it is FAIL-CLOSED -- an empty or unreadable candidate is TOTAL loss, never clean (the direction that matters, because the flattering failure here silently blesses a broken artifact); * the SYMMETRY class names all four outcomes, so a rename cannot read as a removal; * the SOURCE-PATH partition is narrow enough that it cannot swallow real content, and it RECONCILES. license_tier: ORIGINAL Read-only. No hw writes (Rule 26). expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_contentdiff_lib.nx nx_contentdiff_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_contentdiff_lib.nx

imported by: nobody (leaf or entry point)

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

main gv_head gv_puts sys_write gv_ctr sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ cg_prm sys_mmap ↻ sys_mmap ↻ cg_run gv_check gv_puts ↻ cdl_lost cdl_count_runs cdl_runlen cdl_is_print cdl_runlen ↻ cdl_contains cdl_symclass cdl_is_srcpath cdl_is_ident cdl_lost_srcpath cdl_runlen ↻ cdl_contains ↻ cdl_is_srcpath ↻ cdl_is_ident ↻

structs

none

consts

21const CG_BUF: i64 = 4096
22const CG_MINLEN: i64 = 6
23const CG_NUL: i64 = 0

functions

26func cg_run(b: *u8, off: i64, s: *u8) -> i64
called by 1: main
34func cg_prm() -> *i64
called by 1: main calls 1: sys_mmap
42func main(argc: i64, argv: *i64) -> i64