code wiki / _hdl_build / nx_lossclass.nx

nx_lossclass.nx

buildroot/runtime/_hdl_build/nx_lossclass.nx

11982 B208 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_lossclass.nx -- the missing discriminator for nx_stale_check's CAPABILITY-LOSS verdict. WHY THIS EXISTS (root-caused 2026-08-06). nx_stale_check compares a fresh build against the deployed elf and, when a DEPLOYED STRING IS ABSENT FROM THE REBUILD, returns CAPABILITY-LOSS + "DO NOT RESTAGE". That conflates TWO OPPOSITE EVENTS: (a) REGRESSION -- the source genuinely lost the capability. Restaging destroys shipped function. (b) CORRECTION -- someone DELIBERATELY deleted a string because it was a LIE or described a bug that has since been FIXED. Restaging SHIPS THE FIX. Measured cases that provoked this organ, BOTH class (b): nx_https_get lost "BAD_CIPHER ... (0x1302 AES-256-GCM-SHA384)" because R9 (2026-08-05) made 0x1302 REAL -- the diagnostic had become false. Token 0x1302: 41 source hits. nx_page_verify lost "image/avif" from its Accept header because the estate has NO AVIF decoder and advertising it was a lie (nx_codec_caps_gate pins it BY NAME). 17 source hits. CONSEQUENCE: a gauge that reads every deletion as damage BLOCKS EVERY CORRECTION FROM PRODUCTION. In an estate whose doctrine is to delete unfounded claims, that gauge manufactures the staleness it reports (CURRENT=77/1427 measured the same day). ***THE STALENESS GAUGE WAS CAUSING THE STALENESS.*** THE DISCRIMINATOR: a capability that was CORRECTED still has its SUBJECT in the tree -- the topic is discussed, gated, re-implemented. A capability genuinely LOST has no trace. So: grep the missing string's most distinctive TOKEN across the source tree. token still present => DELIBERATE-EDIT => restage is SAFE (and is how the fix ships) token absent => GENUINE-LOSS => do NOT restage; recover the source first ***A FAILED SEARCH IS NOT AN ABSENT TOKEN.*** If the fork never ran or the scan was partial, this organ returns UNSCORABLE and REFUSES to classify. Reporting a defeat as "absent" would flip the verdict to GENUINE-LOSS and block a good fix -- the exact laundering nx_ui_audit was caught doing. nx_lossclass classify <token> [srcdir] [ext] (srcdir default buildroot/runtime, ext default nx) nx_lossclass selftest exit: 0 classified | 2 usage | 3 selftest-fail | 5 unscorable license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_tool_run.nx nx_syscalls.nx nx_lossclass.nx

imports: nx_tool_run.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main lwe sys_write sys_exit lc_streq lc_selftest lw sys_write ↻ 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 ↻ lc_grep_count sys_mmap ↻ tr_run_capture sys_mmap ↻ sys_pipe2 sys_fork sys_close sys_dup3 sys_execve_clean sys_close_inherited sys_close_inherited_proc sys_execve tr_exec_failed sys_write ↻ sys_exit ↻ sys_read sys_wait4

structs

none

consts

35const LC_CAP: i64 = 262144
36const LC_EXIT_UNSCORABLE: i64 = 5

functions

38func lw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
39func lwe(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(2,s,n); return 0 }
called by 1: main calls 1: sys_write
40func lwn(v: i64) -> i64 { var m: i64=v; if m<0{lw("-" as *u8);m=0-m} let t:*u8=sys_mmap(28); var k:i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i:i64=0; let o:*u8=sys_mmap(28); while i<k{o[i]=t[k-1-i];i=i+1} sys_write(1,o,k); sys_munmap(t,28); sys_munmap(o,28); return 0 }
41func lq() -> i64 { let c:*u8=sys_mmap(8); c[0]=34 as u8; sys_write(1,c,1); sys_munmap(c,8); return 0 }
42func lkv(k: *u8) -> i64 { lq(); lw(k); lq(); lw(":" as *u8); return 0 }
called by 1: lc_classify calls 2: lqlw
44func lc_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 2: lc_findmain
46func lc_streq(a: *u8, b: *u8) -> i64
called by 1: main
54func lc_find(buf: *u8, n: i64, pat: *u8) -> i64
called by 1: lc_grep_count calls 1: lc_slen
69func lc_num_at(buf: *u8, n: i64, p: i64) -> i64
called by 1: lc_grep_count
79func lc_grep_count(tok: *u8, dir: *u8, ext: *u8, partial: *i64) -> i64
103func lc_classify(tok: *u8, dir: *u8, ext: *u8) -> i64
134func lc_selftest() -> i64
195func main(argc: i64, argv: *i64) -> i64