code wiki / _hdl_build / nx_friction_census.nx
nx_friction_census.nx source
↩ module page · 98 lines · 7863 B
1// nx_friction_census.nx -- INWARD census of OPERATING friction + ADOPTION status (the operator's census/critic/
2// adversary method pointed at our OWN dev loop, so the machinery catches the next adoption gap WITHOUT the operator).
3// Root cause of the recurring build-lane + collision friction = an ADOPTION gap: fixes get BUILT/DESIGNED then not
4// WIRED as the default path. Each row cites the solution's implementation file (CRITIC = liar-kill: a claimed fix
5// must have a real file) + its honest adoption status. ADVERSARY = the "built-but-not-adopted" count (a standing
6// guard against shelving fixes). license_tier: ORIGINAL expect_exit: 0
7import "nx_syscalls.nx"
8const K_MAGIC_65536: i64 = 65536
9
10func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
11func pn(v: i64) -> i64 { let b: *u8=sys_mmap(32) as *u8; var x: i64=v; var ng: i64=0; if x<0{ng=1;x=0-x} var i: i64=31; if x==0{b[i]=48 as u8;i=i-1} while x>0{b[i]=(48+x%10) as u8;x=x/10;i=i-1} if ng==1{b[i]=45 as u8;i=i-1} sys_write(1,(b as i64+i+1) as *u8,31-i); return 0 }
12func slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
13func fexists(path: *u8) -> i64 {
14 let szp: *i64 = sys_mmap(16) as *i64
15 let b: *u8 = sys_read_file(path, szp)
16 if (b as i64) == 0 { return 0 }
17 if szp[0] < 64 { return 0 }
18 return 1
19}
20func ocat(o: *u8, at: i64, s: *u8) -> i64 { var i: i64=0; var a: i64=at; while s[i]!=(0 as u8){o[a]=s[i]; a=a+1; i=i+1} return a }
21
22// one friction row. status: 2=ADOPTED(default path) 1=BUILT/SHIPPED-NOT-DEFAULT 0=NONE. solf = solution file (cited).
23// CRITIC liar-kill: status>0 requires solf to EXIST (a claimed fix must have a real implementation) else -> NONE.
24func fr(rep: *u8, ro: *i64, name: *u8, solf: *u8, status: i64, note: *u8, sums: *i64) -> i64 {
25 var af: i64 = 0
26 if slen(solf) > 0 { af = fexists(solf) }
27 var verdict: i64 = 0
28 if status > 0 { if af == 1 { verdict = status } }
29 var liar: i64 = 0
30 if status > 0 { if af == 0 { liar = 1 } }
31 var o: i64 = ro[0]
32 o = ocat(rep, o, "FRICTION " as *u8); o = ocat(rep, o, name)
33 if verdict == 2 { o = ocat(rep, o, " [ADOPTED] " as *u8) }
34 if verdict == 1 { o = ocat(rep, o, " [BUILT-NOT-DEFAULT] " as *u8) }
35 if verdict == 0 { if liar == 1 { o = ocat(rep, o, " [LIAR-KILL -> NONE] " as *u8) } }
36 if verdict == 0 { if liar == 0 { o = ocat(rep, o, " [NONE] " as *u8) } }
37 o = ocat(rep, o, note); o = ocat(rep, o, "\n" as *u8)
38 ro[0] = o
39 sums[0] = sums[0] + 1
40 if verdict == 2 { sums[1] = sums[1] + 1 }
41 if verdict == 1 { sums[2] = sums[2] + 1 }
42 if liar == 1 { sums[3] = sums[3] + 1 }
43 return verdict
44}
45
46func main() -> i64 {
47 hw("=== nx_friction_census -- INWARD: operating friction + ADOPTION status (why the fixes exist but friction persists) ===\n" as *u8)
48 var fails: i64 = 0
49 let rep: *u8 = sys_mmap(K_MAGIC_65536)
50 let ro: *i64 = sys_mmap(16) as *i64
51 let sums: *i64 = sys_mmap(64) as *i64
52 var o: i64 = 0
53 o = ocat(rep, o, "NISHI OPERATING-FRICTION CENSUS -- 2026-07-12. Root cause = ADOPTION gap: fixes BUILT/DESIGNED but not WIRED as the default path.\n\n" as *u8)
54 ro[0] = o
55
56 fr(rep, ro, "concurrent SSOT torn writes " as *u8, "runtime/_hdl_build/nx_ws_cas.nx" as *u8, 2, "WMS ws_put_locked flock-CAS, MEASURED-exceeds-git (0/144 lost vs ~135); ADOPTED for the registry." as *u8, sums)
57 fr(rep, ro, "cap lottery (-32001) " as *u8, "runtime/nx_tools_api.nx" as *u8, 2, "_cap-in-body recipe + least-authority read cap in .mcp.json; works every session once applied." as *u8, sums)
58 fr(rep, ro, "live-verify coin-flip :443 " as *u8, "runtime/nx_https_get_cli.nx" as *u8, 2, "connect-override {url,127.0.0.1:8443} deterministically hits OUR edge, not DSM nginx." as *u8, sums)
59 fr(rep, ro, "WSL build wedge (E_UNEXPECT)" as *u8, "runtime/_hdl_build/nx_mgmt_api.nx" as *u8, 1, "build-over-API /api/build serializes on ONE NAS daemon = zero wsl.exe race; NOT DEFAULT (needs admin cap + tree-sync) -> I fall back to WSL." as *u8, sums)
60 fr(rep, ro, "multi-session edit collision" as *u8, "runtime/nx_crdt_sync.nx" as *u8, 1, "CRDT merge PROVEN (nx_crdt_seq+sync, beats git neg-control); NOT wired to the live Edit surface -> collisions persist until integration." as *u8, sums)
61 // NEG-CONTROL: a phantom fix with no implementation file -> the liar-kill MUST force it to NONE.
62 fr(rep, ro, "NEG-CONTROL phantom fix " as *u8, "runtime/nx_phantom_fix_absent.nx" as *u8, 2, "claims ADOPTED but has NO file -> the census must LIAR-KILL it to NONE (teeth check)." as *u8, sums)
63
64 let total: i64 = sums[0]; let adopted: i64 = sums[1]; let partial: i64 = sums[2]; let liar: i64 = sums[3]
65 let score: i64 = adopted * 1000 / total
66 hw("\n rows="); pn(total); hw(" ADOPTED="); pn(adopted); hw(" BUILT-NOT-DEFAULT="); pn(partial); hw(" liar-killed="); pn(liar); hw(" score(adopted/total)="); pn(score); hw("/1000\n" as *u8)
67
68 // T1 grounded
69 var t1: i64 = 0
70 if total >= 5 { t1 = 1 }
71 if t1 == 1 { hw("T1 PASS census grounded (>=5 friction rows)\n" as *u8) } else { fails=fails+1; hw("T1 FAIL\n" as *u8) }
72 // T2 CRITIC liar-kill has teeth (the phantom fix was forced to NONE)
73 var t2: i64 = 0
74 if liar >= 1 { t2 = 1 }
75 if t2 == 1 { hw("T2 PASS liar-kill BITES: a claimed fix with no implementation file -> NONE (cannot fake an adopted fix)\n" as *u8) } else { fails=fails+1; hw("T2 FAIL liar-kill silent\n" as *u8) }
76 // T3 ADVERSARY: the adoption gap is REAL and reported (fixes exist but are not the default). This is the finding.
77 var t3: i64 = 0
78 if partial >= 1 { if adopted < total { t3 = 1 } }
79 if t3 == 1 { hw("T3 PASS adversary reports the ADOPTION GAP: "); pn(partial); hw(" SOTA fix(es) BUILT but NOT adopted-as-default = the systemic pattern\n" as *u8) } else { fails=fails+1; hw("T3 FAIL adversary silent\n" as *u8) }
80
81 // report + adoption ladder (the ordered next-steps to close each gap)
82 o = ro[0]
83 o = ocat(rep, o, "\nSCORE " as *u8); let bb: *u8 = sys_mmap(32) as *u8; var bx: i64 = score; var bi: i64 = 31; if bx==0 { bb[bi]=48 as u8; bi=bi-1 } while bx>0 { bb[bi]=(48+bx%10) as u8; bx=bx/10; bi=bi-1 } var bj: i64 = bi+1; while bj<32 { rep[o]=bb[bj]; o=o+1; bj=bj+1 }
84 o = ocat(rep, o, "/1000 adopted-in-the-default-loop. THE FINDING: the recurring friction is NOT missing capability -- the fixes are BUILT (CAS exceeds-git, build-over-API shipped, CRDT proven) but 2 of the biggest are NOT the DEFAULT path.\n" as *u8)
85 o = ocat(rep, o, "\nADOPTION LADDER (close each gap by wiring the EXISTING fix as default):\n" as *u8)
86 o = ocat(rep, o, " A1 build-over-API as DEFAULT -- route every build through /api/build (1 serialized NAS daemon) -> retires WSL + the E_UNEXPECTED race. UNBLOCK = admin cap.\n" as *u8)
87 o = ocat(rep, o, " A2 wire CRDT to the edit surface -- edits flow through nx_crdt_seq/sync (merge) instead of raw optimistic-concurrency writes. UNBLOCK = a harness edit-hook OR a sovereign CRDT edit API both sessions adopt.\n" as *u8)
88 o = ocat(rep, o, " A3 keep this census STANDING -- re-run each session; if a fix is ADOPTED it stays green; a NEW built-but-not-default fix trips the adversary. The machinery now catches the next adoption gap.\n" as *u8)
89 rep[o] = 0 as u8
90 let fd: i64 = sys_openat_wr("knowledge/friction_census.txt\x00" as *u8, 0x1a4)
91 sys_write(fd, rep, o); sys_close(fd)
92 hw("T4 report + adoption ladder -> knowledge/friction_census.txt ("); pn(o); hw(" bytes)\n" as *u8)
93
94 if fails == 0 { hw("FRICTION-CENSUS GREEN -- adoption gap MEASURED + named; liar-kill + adversary bite. score "); pn(score); hw("/1000 adopted-in-loop\n" as *u8); sys_exit(0); return 0 }
95 hw("FRICTION-CENSUS RED fails="); pn(fails); hw("\n" as *u8)
96 sys_exit(1)
97 return 1
98}