code wiki / _hdl_build / nx_s21_census.nx

nx_s21_census.nx source

↩ module page · 213 lines · 18299 B

1// nx_s21_census.nx -- production caller of nx_capability_census for the S21 EXPERIENTIAL UX/CX surface, 2// AND the generator of the LIVE /experiential page (knowledge/experiential_index.html) -- the page is 3// EMITTED BY THE CENSUS RUN so it can never drift from disk truth again (operator 2026-07-16: "are you 4// building all of this? and keeping it syncd" -- the old page was hand-authored and went stale the same 5// day the organs landed). Grades from DISK FACTS (our implementing organ opens on disk) x SOVEREIGN-FETCHED 6// competitor evidence (knowledge/census/*.raw: Playwright/Puppeteer/Cypress/Selenium/axe-core/Lighthouse/ 7// BackstopJS/browser-use READMEs). NEVER self-scored: 8// RESEARCHER = the fetched .raw corpus CENSUS = cc_comp_attest x cc_our_grade (disk fact) 9// ADVERSARY = 3 discipline teeth CRITIC = GAP tally + keystone 10// HONESTY: no h2h beat-gate exists yet -> our grade caps at PRESENT -> verdict caps at PARITY, never AHEAD. 11// license_tier: ORIGINAL expect_exit: 0 12import "nx_syscalls.nx" 13import "nx_capability_census.nx" 14 15const NRAW: i64 = 8 16const CAP: i64 = 262144 17const HCAP: i64 = 262144 18 19static s21_hb: i64 // HTML table-rows buffer (lazy mmap) 20static s21_ho: i64 // offset 21 22func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 23func pn(v: i64) -> i64 { let t: *u8=sys_mmap(24); var m: i64=v; if m<0{sys_write(1,"-" as *u8,1);m=0-m} 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} let b: *u8=sys_mmap(24); var j: i64=0; while j<k{b[j]=t[k-1-j];j=j+1} sys_write(1,b,k); return 0 } 24func pad(s: *u8, w: i64) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); while n<w { sys_write(1," " as *u8,1); n=n+1 } return 0 } 25 26func hcat(s: *u8) -> i64 { 27 if s21_hb == 0 { s21_hb = sys_mmap(HCAP as nx_size) as i64 } 28 let b: *u8 = s21_hb as *u8 29 var i: i64 = 0 30 while s[i] != (0 as u8) { b[s21_ho + i] = s[i]; i = i + 1 } 31 s21_ho = s21_ho + i 32 return 0 33} 34func hnum(v: i64) -> i64 { 35 if s21_hb == 0 { s21_hb = sys_mmap(HCAP as nx_size) as i64 } 36 let b: *u8 = s21_hb as *u8 37 if v == 0 { b[s21_ho] = 48 as u8; s21_ho = s21_ho + 1; return 0 } 38 let t: *u8 = sys_mmap(24) 39 var m: i64 = v 40 var k: i64 = 0 41 while m > 0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } 42 var j: i64 = k - 1 43 while j >= 0 { b[s21_ho]=t[j]; s21_ho=s21_ho+1; j=j-1 } 44 return 0 45} 46 47// grade one axis; print the text row; append the HTML row; bump tally; return verdict. 48func axis(paths: *i64, buf: *u8, label: *u8, term: *u8, organ: *u8, disp: *u8, exceed: *u8, tally: *i64) -> i64 { 49 let comp: i64 = cc_comp_attest(paths, NRAW, term, buf, CAP) 50 let our: i64 = cc_our_grade(organ, exceed) 51 let v: i64 = cc_verdict(comp, our) 52 pad(label, 30) 53 hw(" comp=" as *u8); pn(comp); hw("/8 our=" as *u8); hw(cc_grade_str(our)) 54 hw(" => " as *u8); hw(cc_verdict_str(v)); hw("\n" as *u8) 55 tally[v] = tally[v] + 1 56 // HTML row (same truth, same run) 57 hcat("<tr><td>" as *u8); hcat(label) 58 hcat("</td><td>" as *u8); hnum(comp) 59 hcat("</td><td>" as *u8) 60 if our == 0 { hcat("absent" as *u8) } else { hcat("present (<code>" as *u8); hcat(disp); hcat("</code>)" as *u8) } 61 hcat("</td><td class=\"v " as *u8); hcat(cc_verdict_str(v)); hcat("\">" as *u8); hcat(cc_verdict_str(v)); hcat("</td></tr>\n" as *u8) 62 return v 63} 64 65func s21_write_page(tally: *i64) -> i64 { 66 let pg: *u8 = sys_mmap(HCAP as nx_size) 67 var o: i64 = 0 68 // head + styles (the page the operator reads -- plain english, dark fleet theme) 69 let head: *u8 = "<!doctype html><html lang=\"en\"><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width,initial-scale=1\"><title>Nishi Experiential Testing — a SOTA-grounded census</title><style>\n:root{--bg:#0b0f14;--ink:#d4dae3;--mut:#8a93a3;--line:#232833;--gap:#f85149;--par:#d29922;--ahead:#3fb950}\nbody{background:var(--bg);color:var(--ink);font:15px/1.55 system-ui,sans-serif;margin:0}\nmain{max-width:960px;margin:0 auto;padding:32px 20px 64px}h1{font-size:27px;margin:.1em 0}h2{font-size:19px;margin:1.6em 0 .5em}\n.sub{color:var(--mut);max-width:78ch}.verdict{background:#1a1213;border:1px solid #3a2224;border-left:3px solid var(--gap);border-radius:10px;padding:14px 18px;margin:18px 0;font-size:15px}\n.tags{display:flex;gap:10px;flex-wrap:wrap;margin:12px 0}.pill{border-radius:20px;padding:3px 12px;font-size:13px;font-weight:600}\n.pGAP{background:#2a1214;color:var(--gap)}.pPAR{background:#2a2410;color:var(--par)}.pAH{background:#12281a;color:var(--ahead)}.pN{background:#161b24;color:var(--mut)}\n.scroll{overflow-x:auto;border:1px solid var(--line);border-radius:10px;margin:12px 0}table{border-collapse:collapse;width:100%;min-width:640px;font-size:13.5px}\nth,td{text-align:left;padding:8px 12px;border-bottom:1px solid var(--line)}th{color:var(--mut);font-weight:600;background:#0e1722}\ntd.v{font-weight:700}td.GAP{color:var(--gap)}td.PARITY{color:var(--par)}td.AHEAD{color:var(--ahead)}\n.prov{background:#0e1722;border:1px solid var(--line);border-radius:10px;padding:14px 18px;color:var(--mut);font-size:13px}\na{color:#6aa3ff}code{background:#161b24;border-radius:5px;padding:1px 6px;font-size:12.5px}\n</style></head><body><main>\n<h1>Nishi Experiential Testing — a SOTA-grounded census</h1>\n<p class=\"sub\">An honest, evidence-grounded grade of where Nishi's experiential UX/CX testing stands against the real state of the art. Produced by the Nishi verification stack — researcher (sovereign-fetched competitor evidence), census (disk facts x that evidence, never self-scored), adversary (discipline teeth that forbid a fake pass), critic (verdict + keystone). THIS PAGE IS EMITTED BY THE CENSUS RUN (nx_s21_census) — it cannot drift from disk truth.</p>\n" as *u8 70 var i: i64 = 0 71 while head[i] != (0 as u8) { pg[o]=head[i]; o=o+1; i=i+1 } 72 // pills 73 let pills1: *u8 = "<div class=\"tags\"><span class=\"pill pGAP\">GAP " as *u8 74 i = 0 75 while pills1[i] != (0 as u8) { pg[o]=pills1[i]; o=o+1; i=i+1 } 76 // write numbers via a tiny local emitter 77 let t: *u8 = sys_mmap(24) 78 var m: i64 = tally[1] 79 var k: i64 = 0 80 if m == 0 { pg[o]=48 as u8; o=o+1 } 81 while m > 0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } 82 var j: i64 = k-1 83 while j >= 0 { pg[o]=t[j]; o=o+1; j=j-1 } 84 let pills2: *u8 = "</span><span class=\"pill pPAR\">PARITY " as *u8 85 i = 0 86 while pills2[i] != (0 as u8) { pg[o]=pills2[i]; o=o+1; i=i+1 } 87 m = tally[2]; k = 0 88 if m == 0 { pg[o]=48 as u8; o=o+1 } 89 while m > 0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } 90 j = k-1 91 while j >= 0 { pg[o]=t[j]; o=o+1; j=j-1 } 92 let pills3: *u8 = "</span><span class=\"pill pAH\">AHEAD " as *u8 93 i = 0 94 while pills3[i] != (0 as u8) { pg[o]=pills3[i]; o=o+1; i=i+1 } 95 m = tally[3]; k = 0 96 if m == 0 { pg[o]=48 as u8; o=o+1 } 97 while m > 0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } 98 j = k-1 99 while j >= 0 { pg[o]=t[j]; o=o+1; j=j-1 } 100 let pills4: *u8 = "</span><span class=\"pill pN\">19 attested axes</span></div>\n<div class=\"verdict\"><b>Verdict:</b> the experiential surface is climbing but NOT closed: the keystone that closes ~9 of the remaining GAP axes at once is one unbuilt organ, <code>nx_browser_drive</code> (input drive over our stack). Every PRESENT organ caps at PARITY until a measured head-to-head beats the tool — a self-gate is necessary, not sufficient. The full build-out ladder with per-axis wiring (API + MCP + workstream + agent + RACI) lives at <a href=\"/evidence/experiential-testing\">/evidence/experiential-testing</a>.</div>\n<h2>The census</h2>\n<p class=\"sub\">Each axis: how many of the 8 fetched SOTA-tool READMEs attest the capability (&ge;2 = corroborated), vs whether our implementing organ opens on disk. <code>our=PRESENT</code> caps the verdict at PARITY — AHEAD requires a measured head-to-head gate we have not built.</p>\n<div class=\"scroll\"><table>\n<tr><th>capability axis</th><th>competitor (of 8)</th><th>our organ</th><th>verdict</th></tr>\n" as *u8 101 i = 0 102 while pills4[i] != (0 as u8) { pg[o]=pills4[i]; o=o+1; i=i+1 } 103 // table rows accumulated during axis() calls 104 let hb: *u8 = s21_hb as *u8 105 i = 0 106 while i < s21_ho { pg[o]=hb[i]; o=o+1; i=i+1 } 107 let tail: *u8 = "</table></div>\n<h2>The adversary (why this can't be gamed)</h2>\n<p class=\"sub\">Three discipline teeth run with the census and must all pass, or it fails closed:</p>\n<ul><li>No false parity — an organ that isn't on disk, against a capability the competitors attest, must read GAP.</li>\n<li>No self-gate inflation — an organ that exists but has no measured head-to-head gate reads PARITY, never AHEAD. A gate proving our thing works is necessary, not sufficient; only beating the tool earns AHEAD.</li>\n<li>No phantom capability — a bogus organ path grades ABSENT.</li></ul>\n<h2>The evidence (researcher)</h2>\n<div class=\"prov\">Competitor capability is attested from live, sovereign-fetched sources (our own TLS 1.3, no third-party HTTP client), not from memory: <code>playwright</code> · <code>puppeteer</code> · <code>cypress</code> · <code>selenium</code> · <code>axe-core</code> · <code>lighthouse</code> · <code>backstop.js</code> · <code>browser-use</code> — public READMEs fetched into <code>knowledge/census/*.raw</code>. The census greps these for each capability term; &gt;2 distinct tools = corroborated.</div>\n<h2>The critic (the path forward)</h2>\n<p class=\"sub\">The honest read: the seeing/judging half is landing (screenshots, recordings, visual diff, page verify, UX study findings — all disk-real today), while the DRIVING half is the gap. One organ, <code>nx_browser_drive</code>, closes the drive-rooted axes together. The full ladder — every axis, its status, the number it moves, and its API/MCP/workstream/agent/RACI wiring — is maintained as data at <a href=\"/evidence/experiential-testing\">/evidence/experiential-testing</a>, and the dated proof runs live under <a href=\"/evidence\">/evidence</a>.</p>\n</main></body></html>\n" as *u8 108 i = 0 109 while tail[i] != (0 as u8) { pg[o]=tail[i]; o=o+1; i=i+1 } 110 // write the page 111 let fd: i64 = sys_openat_wr("knowledge/experiential_index.html\x00" as *u8, 420) 112 if fd < 0 { hw("page write failed\n" as *u8); return 0 - 1 } 113 var off: i64 = 0 114 while off < o { 115 let wr: i64 = sys_write(fd, ((pg as i64)+off) as *u8, o - off) 116 if wr <= 0 { sys_close(fd); return 0 - 1 } 117 off = off + wr 118 } 119 sys_close(fd) 120 hw("PAGE EMITTED knowledge/experiential_index.html bytes=" as *u8); pn(o); hw("\n" as *u8) 121 return 0 122} 123 124func main() -> i64 { 125 hw("=== nx_s21_census -- EXPERIENTIAL UX/CX TESTING vs SOTA (disk facts x fetched evidence) ===\n" as *u8) 126 let paths: *i64 = sys_mmap(NRAW * 8) as *i64 127 paths[0] = "knowledge/census/playwright.raw\x00" as *u8 as i64 128 paths[1] = "knowledge/census/puppeteer.raw\x00" as *u8 as i64 129 paths[2] = "knowledge/census/cypress.raw\x00" as *u8 as i64 130 paths[3] = "knowledge/census/selenium.raw\x00" as *u8 as i64 131 paths[4] = "knowledge/census/axecore.raw\x00" as *u8 as i64 132 paths[5] = "knowledge/census/lighthouse.raw\x00" as *u8 as i64 133 paths[6] = "knowledge/census/backstopjs.raw\x00" as *u8 as i64 134 paths[7] = "knowledge/census/browseruse.raw\x00" as *u8 as i64 135 let buf: *u8 = sys_mmap(CAP) 136 let tally: *i64 = sys_mmap(4 * 8) as *i64 137 tally[0]=0; tally[1]=0; tally[2]=0; tally[3]=0 138 139 // h2h exceed-gates do NOT exist yet -> ABSENT for every axis -> our-grade caps at PRESENT. 140 let NOH2H: *u8 = "knowledge/census/_no_such_h2h_gate\x00" as *u8 141 142 // Organ paths PER AXIS (each axis names its TRUE implementing organ, so building the drive keystone 143 // cannot falsely flip network/console/trace/mobile -- those stay GAP until their own organs exist): 144 let DRIVE: *u8 = "runtime/_hdl_build/nx_browser_drive.nx\x00" as *u8 // click/scroll/open/wait drive (v1 REAL) 145 let XBROW: *u8 = "runtime/_hdl_build/nx_xbrowser_oracle.nx\x00" as *u8 // cross-browser oracle driver (absent) 146 let WEBKIT: *u8 = "runtime/_hdl_build/nx_webkit_oracle.nx\x00" as *u8 // WebKit oracle (absent) 147 let MOBILE: *u8 = "runtime/_hdl_build/nx_mobile_emu.nx\x00" as *u8 // viewport/DPR/touch profiles (absent) 148 let NETIC: *u8 = "runtime/_hdl_build/nx_net_intercept.nx\x00" as *u8 // network interception (absent) 149 let CONSC: *u8 = "runtime/_hdl_build/nx_console_capture.nx\x00" as *u8 // console/error capture (absent) 150 let TRACE: *u8 = "runtime/_hdl_build/nx_trace_replay.nx\x00" as *u8 // trace REPLAY (absent; script+log = seed) 151 let A11Y: *u8 = "runtime/_hdl_build/nx_a11y_audit.nx\x00" as *u8 152 let PERF: *u8 = "runtime/_hdl_build/nx_perf_audit.nx\x00" as *u8 153 let PLAY: *u8 = "runtime/_hdl_build/nx_playtest_agent.nx\x00" as *u8 154 let SWEEP: *u8 = "runtime/_hdl_build/nx_experiential_sweep.nx\x00" as *u8 155 let MEDIA: *u8 = "runtime/_hdl_build/nx_media_playtest.nx\x00" as *u8 156 // PRESENT organ paths (really on disk; each named by its TRUE implementing organ): 157 let PVER: *u8 = "runtime/_hdl_build/nx_page_verify.nx\x00" as *u8 158 let UXCX: *u8 = "runtime/nx_uxcx_grade.nx\x00" as *u8 159 let VDIFF: *u8 = "runtime/_hdl_build/nx_visual_diff.nx\x00" as *u8 160 let SHOT: *u8 = "runtime/_hdl_build/nishi_gui.nx\x00" as *u8 // headless shot+recording lane (nxshot) 161 let STUDY: *u8 = "runtime/_hdl_build/nx_ux_study.nx\x00" as *u8 // live-run findings + severity + recs 162 163 hw("axis competitor our verdict\n" as *u8) 164 hw("------------------------------ ----------- -------- -------\n" as *u8) 165 axis(paths, buf, "drive browser (headless control)" as *u8, "headless" as *u8, DRIVE, "nx_browser_drive + nishi_gui drive lane" as *u8, NOH2H, tally) 166 axis(paths, buf, "cross-browser engines" as *u8, "Firefox" as *u8, XBROW, "-" as *u8, NOH2H, tally) 167 axis(paths, buf, "WebKit engine" as *u8, "WebKit" as *u8, WEBKIT, "-" as *u8, NOH2H, tally) 168 axis(paths, buf, "mobile / device emulation" as *u8, "mobile" as *u8, MOBILE, "-" as *u8, NOH2H, tally) 169 axis(paths, buf, "screenshot capture (organ)" as *u8, "screenshot" as *u8, SHOT, "nishi_gui nxshot recording lane" as *u8, NOH2H, tally) 170 axis(paths, buf, "input drive (click / type)" as *u8, "click" as *u8, DRIVE, "nx_browser_drive (click/scroll/open; type queued)" as *u8, NOH2H, tally) 171 axis(paths, buf, "auto-wait / retry" as *u8, "wait" as *u8, DRIVE, "nx_browser_drive wait verb" as *u8, NOH2H, tally) 172 axis(paths, buf, "network interception" as *u8, "network" as *u8, NETIC, "-" as *u8, NOH2H, tally) 173 axis(paths, buf, "console / error capture" as *u8, "console" as *u8, CONSC, "-" as *u8, NOH2H, tally) 174 axis(paths, buf, "trace / replay" as *u8, "trace" as *u8, TRACE, "-" as *u8, NOH2H, tally) 175 axis(paths, buf, "visual diff / regression" as *u8, "regression" as *u8, VDIFF, "nx_visual_diff" as *u8, NOH2H, tally) 176 axis(paths, buf, "accessibility audit (WCAG)" as *u8, "accessibility" as *u8, A11Y, "-" as *u8, NOH2H, tally) 177 axis(paths, buf, "performance audit (web vitals)" as *u8, "performance" as *u8, PERF, "-" as *u8, NOH2H, tally) 178 axis(paths, buf, "agentic goal-directed play" as *u8, "agent" as *u8, PLAY, "-" as *u8, NOH2H, tally) 179 axis(paths, buf, "live-run intelligence / findings" as *u8, "report" as *u8, STUDY, "nx_ux_study" as *u8, NOH2H, tally) 180 axis(paths, buf, "CI / sweep orchestration" as *u8, "workflow" as *u8, SWEEP, "-" as *u8, NOH2H, tally) 181 axis(paths, buf, "video / media playtest" as *u8, "video" as *u8, MEDIA, "-" as *u8, NOH2H, tally) 182 axis(paths, buf, "automated page / asset verify" as *u8, "test" as *u8, PVER, "nx_page_verify" as *u8, NOH2H, tally) 183 axis(paths, buf, "UI / CX quality judging" as *u8, "report" as *u8, UXCX, "nx_uxcx_grade + nx_ux_study" as *u8, NOH2H, tally) 184 185 hw("\nTALLY both-absent=" as *u8); pn(tally[0]) 186 hw(" GAP=" as *u8); pn(tally[1]) 187 hw(" PARITY=" as *u8); pn(tally[2]) 188 hw(" AHEAD=" as *u8); pn(tally[3]); hw("\n" as *u8) 189 190 // ---- ADVERSARY: 3 discipline teeth ---- 191 var fails: i64 = 0 192 // (fixture repointed 2026-07-16: DRIVE became REAL and correctly turned this tooth RED -- the 193 // neg-control needs an organ that is GENUINELY absent; console capture is the next unbuilt one) 194 let t1: i64 = cc_verdict(cc_comp_attest(paths, NRAW, "console" as *u8, buf, CAP), cc_our_grade(CONSC, NOH2H)) 195 if t1 != 1 { fails=fails+1; hw("ADV-T1 FAIL: absent+attested did not read GAP\n" as *u8) } else { hw("ADV-T1 PASS: absent organ + attested competitor => GAP (no false parity)\n" as *u8) } 196 let t2: i64 = cc_verdict(cc_comp_attest(paths, NRAW, "test" as *u8, buf, CAP), cc_our_grade(PVER, NOH2H)) 197 if t2 != 2 { fails=fails+1; hw("ADV-T2 FAIL: present+attested did not read PARITY\n" as *u8) } else { hw("ADV-T2 PASS: present organ, NO h2h gate => PARITY not AHEAD (self-gate != beat-the-tool)\n" as *u8) } 198 let t3g: i64 = cc_our_grade("runtime/_hdl_build/nx_totally_fake_organ.nx\x00" as *u8, NOH2H) 199 if t3g != 0 { fails=fails+1; hw("ADV-T3 FAIL: bogus path graded present\n" as *u8) } else { hw("ADV-T3 PASS: non-existent organ => ABSENT (disk-fact discipline holds)\n" as *u8) } 200 201 // ---- CRITIC ---- 202 hw("\nCRITIC: GAP on " as *u8); pn(tally[1]) 203 hw(" of " as *u8); pn(tally[1]+tally[2]+tally[3]); hw(" attested axes, PARITY on " as *u8); pn(tally[2]) 204 hw(", AHEAD on " as *u8); pn(tally[3]); hw(".\n" as *u8) 205 hw("CRITIC: keystone = nx_browser_drive; ladder with full wiring at /evidence/experiential-testing.\n" as *u8) 206 207 // ---- EMIT THE LIVE PAGE (sync by construction) ---- 208 s21_write_page(tally) 209 210 if fails == 0 { hw("NX-S21-CENSUS GREEN -- evidence-grounded, adversary-disciplined, no fake AHEAD\n" as *u8); sys_exit(0); return 0 } 211 hw("NX-S21-CENSUS RED fails=" as *u8); pn(fails); hw("\n" as *u8) 212 sys_exit(1); return 1 213}