code wiki / _hdl_build / nx_gallery_ux_census.nx
nx_gallery_ux_census.nx source
↩ module page · 86 lines · 7135 B
1// nx_gallery_ux_census.nx -- MEASURED S-class UX census of the Nishi gallery (R7 capstone).
2//
3// Honest scorecard (per feedback-no-wave-measured-exceed): NOT "beats Google everywhere". Each cell is
4// MEASURED against the REAL artifact (greps nx_gallery_serve.nx / nx_gallery_gateway.nx for the capability
5// marker) and graded EXCEEDS / PARITY / BEHIND vs the research-grounded S-class bar (knowledge/fetched/
6// sclass_*.raw). LIAR-KILL: a cell that claims a capability the source does NOT contain (count 0) is an
7// overclaim and is CAUGHT; a NEGATIVE CONTROL (claim a marker known-absent) proves the kill actually fires.
8// expect_exit: 0 (GREEN: neg-control caught + zero real overclaims). license_tier: ORIGINAL
9import "nx_syscalls.nx"
10import "nx_itoa_lib.nx" // shared MSB-first emitter (zero-alloc)
11
12func cn_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
13// MIGRATED to the shared emitter (debt 1785563586). The old body mmapped a scratch buffer
14// per call and never freed it. At PAGE granularity that is 4096B leaked PER CALL -- the
15// defect that took 28.5GB of a 36GB host in nx_ts_lumadiff (2MB input, ~3.66M calls).
16// nxi_* is MSB-first, allocates NOTHING, and emits identical bytes including the sign.
17func cn_putn(v: i64) -> i64 { nxi_out(v); return 0 }
18// count substring occurrences of `needle` in the file at `path` (0 if unreadable).
19func cn_count(path: *u8, needle: *u8) -> i64 {
20 let szp: *i64 = sys_mmap(16) as *i64
21 let b: *u8 = sys_read_file(path, szp)
22 if (b as i64) == 0 { return 0 }
23 let sz: i64 = szp[0]
24 var nl: i64 = 0; while needle[nl] != (0 as u8) { nl = nl + 1 }
25 if nl == 0 { return 0 }
26 var cnt: i64 = 0; var i: i64 = 0
27 while i + nl <= sz {
28 var j: i64 = 0; var ok: i64 = 1
29 while j < nl { if b[i+j] != needle[j] { ok = 0; j = nl } else { j = j + 1 } }
30 if ok == 1 { cnt = cnt + 1; i = i + nl } else { i = i + 1 }
31 }
32 return cnt
33}
34// emit one MEASURED cell. present = the measured count (>0 means the capability marker is really in the source).
35// verdict is asserted by the author; liar-kill returns 1 if the verdict CLAIMS the capability (EXCEEDS/PARITY)
36// but present==0 -> an overclaim. Prints the row with the measured count as evidence.
37func cn_cell(axis: *u8, verdict: *u8, present: i64, bar: *u8) -> i64 {
38 cn_puts(" "); cn_puts(verdict); cn_puts("\t"); cn_puts(axis); cn_puts(" [measured="); cn_putn(present); cn_puts("] vs S-class: "); cn_puts(bar); cn_puts("\n")
39 // claims-capability = verdict is EXCEEDS or PARITY (first char 'E' or 'P'); BEHIND/ABSENT do not claim it.
40 let c0: i64 = verdict[0] as i64
41 if c0 == 69 { if present == 0 { return 1 } } // 'E'XCEEDS with no evidence -> overclaim
42 if c0 == 80 { if present == 0 { return 1 } } // 'P'ARITY with no evidence -> overclaim
43 return 0
44}
45
46func main() -> i64 {
47 let serve: *u8 = "runtime/_hdl_build/nx_gallery_serve.nx" as *u8
48 let gw: *u8 = "runtime/_hdl_build/nx_gallery_gateway.nx" as *u8
49
50 cn_puts("=== NISHI GALLERY UX CENSUS (measured vs S-class; honest narrow exceed) ===\n")
51
52 var overclaims: i64 = 0
53 var nexc: i64 = 0; var npar: i64 = 0; var nbeh: i64 = 0
54
55 // --- PARITY axes: S-class table-stakes the gallery now MATCHES (each marker measured in the real source) ---
56 overclaims = overclaims + cn_cell("responsive-grid (auto-fill minmax + @media mobile)" as *u8, "PARITY " as *u8, cn_count(serve, "@media" as *u8), "RWD baseline (MDN/W3C)" as *u8); npar = npar + 1
57 overclaims = overclaims + cn_cell("offscreen-render skip (content-visibility:auto)" as *u8, "PARITY " as *u8, cn_count(serve, "content-visibility" as *u8), "web.dev measured 7x render" as *u8); npar = npar + 1
58 overclaims = overclaims + cn_cell("native lazy-load (loading=lazy)" as *u8, "PARITY " as *u8, cn_count(serve, "loading=" as *u8), "web.dev native lazy-loading" as *u8); npar = npar + 1
59 overclaims = overclaims + cn_cell("infinite-scroll prefetch (IntersectionObserver)" as *u8, "PARITY " as *u8, cn_count(serve, "IntersectionObserver" as *u8), "MDN IO sentinel" as *u8); npar = npar + 1
60 overclaims = overclaims + cn_cell("thumbnail delivery (/thumb, not full-res grid)" as *u8, "PARITY " as *u8, cn_count(serve, "GET /thumb/" as *u8), "thumbnail pyramids (Google Photos/IIIF); measured 41636B->8174B" as *u8); npar = npar + 1
61 overclaims = overclaims + cn_cell("scroll-at-scale (keyset per-category index)" as *u8, "PARITY " as *u8, cn_count(serve, "gs_catidx_emit" as *u8), "keyset 400x at depth (Shopify)" as *u8); npar = npar + 1
62 overclaims = overclaims + cn_cell("durable session (30-day TTL, no surprise logout)" as *u8, "PARITY " as *u8, cn_count(gw, "GGW_SESSION_TTL" as *u8), "consumer days (Google 14d+)" as *u8); npar = npar + 1
63
64 // --- BEHIND: an honest gap (claimed BEHIND -> not an overclaim; AVIF/WebP not yet emitted) ---
65 cn_cell("modern image format (thumbs are PNG, not AVIF/WebP)" as *u8, "BEHIND " as *u8, cn_count(serve, "image/avif" as *u8), "AVIF ~50% < JPEG (follow-up)" as *u8); nbeh = nbeh + 1
66
67 // --- EXCEEDS: the GENUINE narrow exceed (each measured in the real source) ---
68 overclaims = overclaims + cn_cell("auth security: OPAQUE aPAKE, no pw-equivalent at rest" as *u8, "EXCEEDS" as *u8, cn_count(gw, "olg_ctx_setup_ttl" as *u8), "RFC 9807; nothing offline-crackable w/o oprf_seed" as *u8); nexc = nexc + 1
69 // sovereignty = MEASURED zero third-party script/CDN in the served shell (S-class sites depend on CDNs+3p JS)
70 let p3: i64 = cn_count(serve, "src=http" as *u8) + cn_count(serve, "cdn" as *u8) + cn_count(serve, "googleapis" as *u8) + cn_count(serve, "unpkg" as *u8) + cn_count(serve, "jsdelivr" as *u8)
71 var sov: i64 = 0; if p3 == 0 { sov = 1 } // 1 = zero third-party refs found = sovereign
72 overclaims = overclaims + cn_cell("sovereignty: zero third-party JS/CDN in the shell" as *u8, "EXCEEDS" as *u8, sov, "S-class galleries load CDN/3rd-party JS; ours: self-contained, own TLS" as *u8); nexc = nexc + 1
73
74 // --- NEGATIVE CONTROL: claim a framework the sovereign shell must NOT contain. count 0 -> the liar-kill MUST fire. ---
75 let neg_caught: i64 = cn_cell("NEG-CONTROL: depends on React/jQuery runtime" as *u8, "PARITY " as *u8, cn_count(serve, "react.production" as *u8) + cn_count(serve, "jquery" as *u8), "(must be CAUGHT: a sovereign shell has neither)" as *u8)
76
77 cn_puts("--- verdict ---\n")
78 cn_puts("EXCEEDS="); cn_putn(nexc); cn_puts(" PARITY="); cn_putn(npar); cn_puts(" BEHIND="); cn_putn(nbeh)
79 cn_puts(" real_overclaims="); cn_putn(overclaims); cn_puts(" neg_control_caught="); cn_putn(neg_caught); cn_puts("\n")
80 if neg_caught == 1 { if overclaims == 0 {
81 cn_puts("CENSUS GREEN: liar-kill armed (neg-control caught) + ZERO real overclaims. Honest exceed = 2 narrow axes (OPAQUE auth + sovereignty); parity on S-class table-stakes; 1 honest gap (AVIF).\n")
82 sys_exit(0); return 0
83 } }
84 cn_puts("CENSUS RED: liar-kill failed to fire OR a real cell overclaimed (a verdict marker measured 0 in the source).\n")
85 sys_exit(1); return 1
86}