code wiki / _hdl_build / nx_lossclass.nx
nx_lossclass.nx
buildroot/runtime/_hdl_build/nx_lossclass.nx
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
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
structs
| none |
consts
| 35 | const LC_CAP: i64 = 262144 |
| 36 | const LC_EXIT_UNSCORABLE: i64 = 5 |
functions
| 38 | func lw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 39 | func lwe(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(2,s,n); return 0 } |
| 40 | func 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 } |
| 41 | func lq() -> i64 { let c:*u8=sys_mmap(8); c[0]=34 as u8; sys_write(1,c,1); sys_munmap(c,8); return 0 } |
| 42 | func lkv(k: *u8) -> i64 { lq(); lw(k); lq(); lw(":" as *u8); return 0 } |
| 44 | func lc_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 46 | func lc_streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 54 | func lc_find(buf: *u8, n: i64, pat: *u8) -> i64 |
| 69 | func lc_num_at(buf: *u8, n: i64, p: i64) -> i64 called by 1: lc_grep_count |
| 79 | func lc_grep_count(tok: *u8, dir: *u8, ext: *u8, partial: *i64) -> i64 |
| 103 | func lc_classify(tok: *u8, dir: *u8, ext: *u8) -> i64 |
| 134 | func lc_selftest() -> i64 |
| 195 | func main(argc: i64, argv: *i64) -> i64 |