code wiki / (root) / nx_contentdiff.nx

nx_contentdiff.nx

buildroot/runtime/nx_contentdiff.nx

5806 B161 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
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. 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. nx_contentdiff <live-elf> <candidate-elf> license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_contentdiff.nx

imports: nx_syscalls.nxnx_gate_verdict.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 sys_mmap cd_slurp sys_openat_rd sys_read sys_close cd_is_print cd_contains sys_write ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap gv_ctr sys_mmap ↻ gv_check gv_puts ↻ gv_verdict gv_puts ↻ gv_num ↻ gv_journal sys_openat_append sys_mmap ↻ gv_catn sys_mmap ↻ sys_munmap ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real gv_cat sys_write ↻ sys_close ↻ sys_munmap ↻

structs

none

consts

28const CD_CAP: i64 = 4194304
29const CD_MINLEN: i64 = 6
30const CD_PRINT_LO: i64 = 32
31const CD_PRINT_HI: i64 = 126
32const CD_SHOW: i64 = 8
33const CD_WORD: i64 = 8
34const CD_SLOTS: i64 = 8
35const CD_S_RUNS: i64 = 0
36const CD_S_LOST: i64 = 1
37const CD_S_SHOWN: i64 = 2

functions

39func cd_slurp(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
53func cd_is_print(c: i64) -> i64
called by 1: main
60func cd_contains(hay: *u8, hn: i64, ndl: *u8, ns: i64, nl: i64) -> i64
called by 1: main
76func main(argc: i64, argv: *i64) -> i64