nx_contentdiff_typed_candidate_t309.nx
buildroot/runtime/nx_contentdiff_typed_candidate_t309.nx
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 · 1 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_contentdiff_lib.nx
imported by: nx_contentdiff_typed_gate_t309.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| 185 | struct NxCdDisplay {total:i64,shown:i64,source:i64,ident:i64,section:i64,other:i64} |
consts
| 38 | const CD_CAP: i64 = 4194304 |
| 39 | const CD_MINLEN: i64 = 6 |
| 40 | const CD_SHOW: i64 = 8 |
| 41 | const CD_SHOW_ALL: i64 = 0 - 1 |
| 42 | const CD_SHOW_BAD: i64 = 0 - 2 |
| 43 | const CD_DECIMAL_BASE: i64 = 10 |
| 44 | const CD_I64_MAX: i64 = 9223372036854775807 |
| 45 | const CD_DIGIT_ZERO: i64 = 48 |
| 46 | const CD_DIGIT_NINE: i64 = 57 |
| 186 | const CD_STRUCT_ALL:i64=0 |
| 187 | const CD_STRUCT_OTHER:i64=1 |
| 188 | const CD_STRUCT_SOURCE:i64=2 |
functions
| 49 | func cd_display_arg(p: *u8) -> i64 |
| 65 | func cd_slurp(path: *u8, buf: *u8, cap: i64) -> i64 |
| 90 | func cd_show_other(a: *u8, an: i64, b: *u8, bn: i64) -> i64 calls 1: cd_show_other_limit |
| 93 | func cd_show_other_limit(a: *u8, an: i64, b: *u8, bn: i64, limit: i64) -> i64 called by 1: cd_show_other calls 7: cdl_runlencdl_containscdl_is_srcpathcdl_is_identcdl_is_sectnamegv_puts+1 |
| 123 | func cd_show_gained(a: *u8, an: i64, b: *u8, bn: i64) -> i64 calls 1: cd_show_gained_limit |
| 126 | func cd_show_gained_limit(a: *u8, an: i64, b: *u8, bn: i64, limit: i64) -> i64 called by 1: cd_show_gained calls 7: cdl_runlencdl_containscdl_is_srcpathcdl_is_identcdl_is_sectnamegv_puts+1 |
| 151 | func cd_show_lost(a: *u8, an: i64, b: *u8, bn: i64) -> i64 calls 1: cd_show_lost_limit |
| 154 | func cd_show_lost_limit(a: *u8, an: i64, b: *u8, bn: i64, limit: i64) -> i64 |
| 175 | func cd_display_summary(label: *u8, shown: i64, total: i64) -> i64 |
| 189 | func cd_structured_names(a:*NxCdStructured,b:*NxCdStructured,label:*u8,mode:i64,limit:i64,out:*NxCdDisplay)->i64 |
| 212 | func cd_structured_error(state:i64,reason:*u8)->i64 |
| 217 | func cd_structured_paths(livep:*u8,candp:*u8,display:i64)->i64 |
| 222 | func cd_structured_paths_result(livep:*u8,candp:*u8,display:i64,measured:*NxCdResult)->i64 called by 2: cd_structured_pathsmain calls 14: sys_map_filecd_structured_errorsys_munmap_directgv_putscds_initsys_mmap_try+8 |
| 278 | func main(argc:i64,argv:*i64)->i64 |