code wiki / (root) / nx_contentdiff_display_20260907.nx

nx_contentdiff_display_20260907.nx

buildroot/runtime/nx_contentdiff_display_20260907.nx

14875 B316 linesdepth 5pulls 6 transitivereach 0 importersview sourcekind tooltopic contentdiff
docsdependenciesstructsconstsfunctions

about

nx_contentdiff.nx -- THE PROMOTE RULER. Answers one question: does the candidate binary still contain everything the LIVE binary contains? WHY (debts 1785452162, 1785526315, 1785526809): the ecosystem has ~703 deployed organs awaiting a rebuild, and the gate guarding that queue was BYTE SIZE. Size is uninformative IN BOTH DIRECTIONS, proven twice by measurement: SHRINK is not regression -- 16 live organs had LARGER .prev files, yet the smaller live binaries were string SUPERSETS (lost_from_live=0). Restoring the bigger ones would have BEEN the regression. GROWTH is not improvement -- nx_law_warden rebuilt GREW 161951 -> 186696 bytes while losing three whole detectors (laws_measured 11 -> 8, enforced_permil 1000 -> 727). A gate keyed on bytes is therefore wrong about half the time and cannot tell you which half. THE RULER: printable content. Every printable run of >= CD_MINLEN bytes in the LIVE binary must still be findable somewhere in the candidate. Anything missing is capability the rebuild would DESTROY. Searching the candidate's RAW BYTES (not a re-extracted string set) is deliberate and stricter: a string that survived but got tokenized differently still counts as present, so a MISS is a real miss. ★2026-08-06 -- THE RULER MOVED OUT, THE ORACLE STAYED. This organ had NO DEPLOYED BINARY and no registry row, so the check it specifies had never actually run anywhere: debt 1785531571 asked for it to be wired into /api/promote and nothing could be, because the measure lived inside this main() with nothing importable to wire. It now lives in nx_contentdiff_lib (cdl_lost) and is called BOTH here and by the staging guard inside md_promote_staged. This file keeps its exact output contract; it simply no longer owns a private copy of the arithmetic. FAIL-CLOSED: unreadable input is RED, never "clean". Verdict GREEN iff lost_from_live == 0. NOT DEDUPED, and it says so in the output: runs are counted as encountered, so the counts are occurrence counts and lost>0 is the signal -- declaring that beats a silent, prettier number. THE ORACLE SPENDS THE FULL BUDGET (every run, whole run) -- it runs to completion and can afford it. nx_contentdiff <live-elf> <candidate-elf> [all|positive-display-limit] Optional display depth changes evidence visibility only; counts and verdict remain shared. license_tier: ORIGINAL 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_display_2026090

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_puts sys_write sys_exit cd_display_arg 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 ↻ cd_slurp sys_openat_rd sys_read sys_close cdl_lost cdl_count_runs cdl_runlen cdl_is_print cdl_runlen ↻ cdl_contains cd_show_lost_limit cdl_runlen ↻ cdl_contains ↻ gv_puts ↻ sys_write ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap cdl_symclass

structs

none

consts

38const CD_CAP: i64 = 4194304
39const CD_MINLEN: i64 = 6
40const CD_SHOW: i64 = 8
41const CD_SHOW_ALL: i64 = 0 - 1
42const CD_SHOW_BAD: i64 = 0 - 2
43const CD_DECIMAL_BASE: i64 = 10
44const CD_I64_MAX: i64 = 9223372036854775807
45const CD_DIGIT_ZERO: i64 = 48
46const CD_DIGIT_NINE: i64 = 57

functions

49func cd_display_arg(p: *u8) -> i64
called by 1: main
65func cd_slurp(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
90func cd_show_other(a: *u8, an: i64, b: *u8, bn: i64) -> i64
93func cd_show_other_limit(a: *u8, an: i64, b: *u8, bn: i64, limit: i64) -> i64
123func cd_show_gained(a: *u8, an: i64, b: *u8, bn: i64) -> i64
126func cd_show_gained_limit(a: *u8, an: i64, b: *u8, bn: i64, limit: i64) -> i64
151func cd_show_lost(a: *u8, an: i64, b: *u8, bn: i64) -> i64
154func cd_show_lost_limit(a: *u8, an: i64, b: *u8, bn: i64, limit: i64) -> i64
175func main(argc: i64, argv: *i64) -> i64