code wiki / (root) / nx_swcompare_evidence_sota_lib_t138.nx

nx_swcompare_evidence_sota_lib_t138.nx source

↩ module page · 533 lines · 33986 B

1// nx_swcompare_sota_lib.nx -- THE SOTA FIELD AS ONE LIB PASS (2026-09-02, operator: "all the /compare on the same 2// emitted output, not random; if a previous compare had more capabilities bring it into the emitter"). 3// 4// WHY. Two generators emitted the /compare surface and their pages had drifted to two SHAPES: the ten sota-class 5// domains (any domain with a knowledge/compare/<dom>.sota) rendered the N-peer grade grid plus the shared passes, 6// and LACKED the Evidence profile, Do this next, Critical path and Capability matrix sections every matrix-class 7// page carries; the matrix-class pages lacked the grade grid. Measured on the live pages 2026-09-02 (lang vs 8// graphics). Since the grade grid, its measured bindings and its census were the ONLY capability the sota 9// generator had that the matrix generator did not, they move HERE as a pass the matrix generator composes when a 10// .sota exists -- absent file = byte-identical emit, the refs/gallery/bench precedent -- and every domain then 11// renders through ONE assembler. nx_swcompare_sota's page path becomes redundant by construction. 12// 13// EVERYTHING THAT WAS MEASURED STAYS MEASURED, WITH THE SAME WORDS: the binding classes (CONSISTENT / STALE-UNDER / 14// UNBACKED refuses / UNRESOLVED / UNREADABLE), the `BIND:` census line, the per-row drift lines, the html badge 15// strings and the api.json field names are carried verbatim, because nx_sota_drift_gate asserts on those exact 16// bytes (it drives the promoted generator on a /tmp fixture tree) and a gate that has to be re-taught its subject's 17// vocabulary on every refactor is a gate that gets loosened. 18// 19// THE DATA (unchanged): knowledge/compare/<dom>.sota 20// @title / @sub / @verdict / @cols Nishi|<c1>|..|<cM> / @cat <category> 21// <axis>|<kind num|g>|<v0>|..|<v(M-1)>[|=<symbol> or =<organ>:<symbol>]|<note> 22// 23// API. sl_new() allocates the state; sl_load(domain, st) parses and measures (1 loaded . 0 no .sota . -1 empty); 24// sl_css(fd) the grid's type rules; sl_html(st, domain, fd) the section; sl_json(st, domain, fd) a `,"sota":{..}` 25// fragment (leading comma, caller places it before the ppp key); sl_census(st, domain, fd) the plain-mode lines, 26// returning 1 when the liar-kill passes and 0 when it refuses (the caller folds that into its own verdict). 27// license_tier: ORIGINAL Read-only. No hw writes (Rule 26). 28import "nx_syscalls.nx" 29import "nx_swcompare_evidence_lib_t138.nx" 30 31const SL_HASH_SEED: i64 = 5381 32const SL_CAP: i64 = 262144 33const SL_MAXR: i64 = 96 34const SL_MAXF: i64 = 24 35const SL_STATE_BYTES: i64 = 1024 // SotaState is 36 words = 288 B; 1024 leaves room for fields added later 36const SL_PATH: i64 = 512 37const SL_LIAR_COLS: i64 = 8 // the generator's liar-kill floors, unchanged: cols>=8 rows>=20 quantitative>=3 38const SL_LIAR_ROWS: i64 = 20 39const SL_LIAR_NUM: i64 = 3 40const SL_DRIFT_NONE: i64 = 0 41const SL_DRIFT_CONSISTENT: i64 = 1 42const SL_DRIFT_STALE_UNDER: i64 = 2 43const SL_DRIFT_UNBACKED: i64 = 3 44const SL_DRIFT_UNRESOLVED: i64 = 4 45const SL_DRIFT_UNREADABLE: i64 = 5 46// CE4 (2026-09-05): claim Yes/Best/Part, symbol PRESENT in source, organ binary NOT on the serving surface -- built 47// nowhere. SYMBOL PRESENCE CANNOT SEE A PROMOTE (the McCabe row read SHIPPED while nx_catalog read it SOURCE-ONLY), 48// so a shipped claim is re-read against the served twin by nx_symdecl_lib cb_serve_state_cwd. The verdict CONTRADICTS 49// the claim: published WITH the badge, counted, named by the gate -- never refused (REFUSE stays the ABSENT-organ class). 50const SL_DRIFT_UNSERVED: i64 = 6 51const SL_MEAS_UNRESOLVED: i64 = 0 - 2 52 53struct SotaState { 54 loaded: i64, 55 buf: *u8, 56 n: i64, 57 cf: *i64, 58 rf: *i64, 59 rcat: *i64, 60 rnf: *i64, 61 rbind: *i64, 62 rmeas: *i64, 63 rdrift: *i64, 64 rrule: *i64, 65 rorgan: *i64, 66 rsym: *i64, 67 ncol: i64, 68 title: *u8, 69 sub: *u8, 70 verdict: *u8, 71 rown: i64, 72 b_bound: i64, 73 b_consistent: i64, 74 b_stale: i64, 75 b_unbacked: i64, 76 b_unresolved: i64, 77 b_unreadable: i64, 78 g_axes: i64, 79 nishi_best: i64, 80 nishi_no: i64, 81 num_axes: i64, 82 best_unevidenced: i64, 83 src_hash: i64, 84 src_base: *u8, 85 b_unserved: i64, // CE4: appended LAST so no earlier field moves; the 1024 B allocation has room by design 86} 87 88func sl_src_hash(b: *u8, n: i64) -> i64 { 89 var h: i64 = SL_HASH_SEED 90 var i: i64 = 0 91 while i < n { h = h * 33 + (b[i] as i64); i = i + 1 } 92 if h < 0 { h = 0 - h } 93 return h & 0xFFFFFFFFFFFF 94} 95func sl_has(h: *u8, needle: *u8) -> i64 { 96 var m: i64 = 0 97 while needle[m] != (0 as u8) { m = m + 1 } 98 if m == 0 { return 1 } 99 var i: i64 = 0 100 while h[i] != (0 as u8) { 101 var j: i64 = 0 102 var ok: i64 = 1 103 while j < m { 104 if ok == 1 { if h[i+j] != needle[j] { ok = 0 } } 105 j = j + 1 106 } 107 if ok == 1 { return 1 } 108 i = i + 1 109 } 110 return 0 111} 112func sl_lc(c: i64) -> i64 { if c >= 65 { if c <= 90 { return c + 32 } } return c } 113func sl_has_ci(hay: *u8, needle_lc: *u8) -> i64 { 114 var nl: i64 = 0 115 while needle_lc[nl] != (0 as u8) { nl = nl + 1 } 116 if nl == 0 { return 1 } 117 var i: i64 = 0 118 while hay[i] != (0 as u8) { 119 var k: i64 = 0 120 var ok: i64 = 1 121 while k < nl { 122 let hc: i64 = sl_lc(hay[i + k] as i64) 123 if hc == 0 { ok = 0; k = nl } else { 124 if hc != (needle_lc[k] as i64) { ok = 0; k = nl } else { k = k + 1 } 125 } 126 } 127 if ok == 1 { return 1 } 128 i = i + 1 129 } 130 return 0 131} 132// DOES A CLAIM CARRY ITS PROOF? One token per concept, case-folded (a ruler whose verdict turns on capitalisation 133// teaches authors to write for the checker); dates stay on the exact matcher. 134func sl_note_has_evidence(note: *u8) -> i64 { 135 if sl_has_ci(note, "gate" as *u8) == 1 { return 1 } 136 if sl_has_ci(note, "measured" as *u8) == 1 { return 1 } 137 if sl_has_ci(note, "proven" as *u8) == 1 { return 1 } 138 if sl_has_ci(note, "witness" as *u8) == 1 { return 1 } 139 if sl_has(note, "2026-" as *u8) == 1 { return 1 } 140 if sl_has(note, "2025-" as *u8) == 1 { return 1 } 141 return 0 142} 143func sl_drift_name(d: i64) -> *u8 { 144 if d == SL_DRIFT_CONSISTENT { return "CONSISTENT" as *u8 } 145 if d == SL_DRIFT_STALE_UNDER { return "STALE-UNDER" as *u8 } 146 if d == SL_DRIFT_UNBACKED { return "UNBACKED" as *u8 } 147 if d == SL_DRIFT_UNRESOLVED { return "UNRESOLVED" as *u8 } 148 if d == SL_DRIFT_UNREADABLE { return "UNREADABLE" as *u8 } 149 if d == SL_DRIFT_UNSERVED { return "UNSERVED" as *u8 } 150 return "UNBOUND" as *u8 151} 152func sl_drift_class(d: i64) -> *u8 { 153 if d == SL_DRIFT_CONSISTENT { return "me" as *u8 } 154 if d == SL_DRIFT_STALE_UNDER { return "pa" as *u8 } 155 if d == SL_DRIFT_UNBACKED { return "dr" as *u8 } 156 if d == SL_DRIFT_UNSERVED { return "pa" as *u8 } 157 return "ab" as *u8 158} 159func sl_meas_name(m: i64) -> *u8 { 160 if m == 1 { return "PRESENT" as *u8 } 161 if m == 0 { return "ABSENT" as *u8 } 162 if m == SL_MEAS_UNRESOLVED { return "UNRESOLVED" as *u8 } 163 return "UNREADABLE" as *u8 164} 165 166func sl_new() -> *SotaState { 167 let st: *SotaState = sys_mmap(SL_STATE_BYTES) as *SotaState 168 st.loaded = 0 169 st.rown = 0 170 st.ncol = 0 171 return st 172} 173 174// Parse knowledge/compare/<domain>.sota and measure every binding ONCE. 1 loaded . 0 no such file . -1 empty file. 175func sl_load(domain: *u8, st: *SotaState) -> i64 { 176 let path: *u8 = sys_mmap(SL_PATH) 177 var o: i64 = scopy(path, 0, "knowledge/compare/" as *u8); o = scopy(path, o, domain); o = scopy(path, o, ".sota" as *u8); path[o] = 0 as u8 178 let pfd: i64 = sys_openat_rd(path) 179 if pfd < 0 { st.loaded = 0; return 0 } 180 sys_close(pfd) 181 let buf: *u8 = sys_mmap(SL_CAP) 182 let n: i64 = c_read(path, buf, SL_CAP) 183 if n <= 0 { st.loaded = 0; return 0 - 1 } 184 // HASH BEFORE THE PARSER TOUCHES IT -- the row loop NULs each line and splitpipe NULs each field, so at emit time 185 // buf is not the file; a hash taken there was one no consumer could reproduce from disk (measured 2026-08-07). 186 st.src_hash = sl_src_hash(buf, n) 187 let src_base: *u8 = sys_mmap(256) 188 var sbo: i64 = scopy(src_base, 0, domain); sbo = scopy(src_base, sbo, ".sota" as *u8); src_base[sbo] = 0 as u8 189 st.src_base = src_base 190 st.buf = buf; st.n = n 191 let cf: *i64 = sys_mmap(SL_MAXF * 8) as *i64 192 let rf: *i64 = sys_mmap(SL_MAXR * SL_MAXF * 8) as *i64 193 let rcat: *i64 = sys_mmap(SL_MAXR * 8) as *i64 194 let rnf: *i64 = sys_mmap(SL_MAXR * 8) as *i64 195 let rbind: *i64 = sys_mmap(SL_MAXR * 8) as *i64 196 let rmeas: *i64 = sys_mmap(SL_MAXR * 8) as *i64 197 let rdrift: *i64 = sys_mmap(SL_MAXR * 8) as *i64 198 let rrule: *i64 = sys_mmap(SL_MAXR * 8) as *i64 199 let rorgan: *i64 = sys_mmap(SL_MAXR * 8) as *i64 200 let rsym: *i64 = sys_mmap(SL_MAXR * 8) as *i64 201 let fld: *i64 = sys_mmap(SL_MAXF * 8) as *i64 202 var ncol: i64 = 0 203 var title: *u8 = "Comparison" as *u8 204 var sub: *u8 = 0 as *u8 205 var verdict: *u8 = 0 as *u8 206 var curcat: *u8 = "General" as *u8 207 var rown: i64 = 0 208 209 var p: i64 = 0 210 while p < n { 211 var e: i64 = p 212 while e < n { if buf[e] == (10 as u8) { break } e = e + 1 } 213 buf[e] = 0 as u8 214 let line: *u8 = (buf as i64 + p) as *u8 215 p = e + 1 216 if line[0] == (0 as u8) { } else { if line[0] == (35 as u8) { } else { 217 if line[0] == (64 as u8) { 218 if starts(line, "@title " as *u8) == 1 { title = (line as i64 + 7) as *u8 } else { 219 if starts(line, "@sub " as *u8) == 1 { sub = (line as i64 + 5) as *u8 } else { 220 if starts(line, "@verdict " as *u8) == 1 { verdict = (line as i64 + 9) as *u8 } else { 221 if starts(line, "@cols " as *u8) == 1 { ncol = splitpipe((line as i64 + 6) as *u8, cf, SL_MAXF) } else { 222 if starts(line, "@cat " as *u8) == 1 { curcat = (line as i64 + 5) as *u8 } } } } } 223 } else { 224 let cnt: i64 = splitpipe(line, fld, SL_MAXF) 225 if cnt >= (3 + ncol) { if rown < SL_MAXR { 226 var k: i64 = 0 227 while k < cnt { rf[rown*SL_MAXF + k] = fld[k]; k = k + 1 } 228 rnf[rown] = cnt; rcat[rown] = curcat as i64 229 rbind[rown] = 0 230 if cnt >= (4 + ncol) { let bf: *u8 = fld[2 + ncol] as *u8; if bf[0] == (61 as u8) { rbind[rown] = (bf as i64) + 1 } } 231 rown = rown + 1 232 } } 233 } } } 234 } 235 236 // ---- measure every binding ONCE, before the tally, so every emitter reads the same answer ---- 237 var b_bound: i64 = 0; var b_consistent: i64 = 0; var b_stale: i64 = 0; var b_unbacked: i64 = 0; var b_unresolved: i64 = 0; var b_unreadable: i64 = 0 238 var b_unserved: i64 = 0 // CE4: shipped claims whose organ binary is not on the serving surface 239 let mxpath: *u8 = sys_mmap(SL_PATH) 240 var mxo: i64 = scopy(mxpath, 0, "knowledge/compare/" as *u8); mxo = scopy(mxpath, mxo, domain); mxo = scopy(mxpath, mxo, ".matrix" as *u8); mxpath[mxo] = 0 as u8 241 let mxl: *i64 = sys_mmap(16) as *i64 242 var mxb: *u8 = 0 as *u8 243 var mxn: i64 = 0 244 var mxtried: i64 = 0 245 let ospan: *i64 = sys_mmap(16) as *i64 246 let rl2: *i64 = sys_mmap(16) as *i64 247 var br0: i64 = 0 248 while br0 < rown { 249 rmeas[br0] = SL_MEAS_UNRESOLVED; rdrift[br0] = SL_DRIFT_NONE; rrule[br0] = 0 250 rorgan[br0] = ("" as *u8) as i64; rsym[br0] = ("" as *u8) as i64 251 if rbind[br0] != 0 { 252 b_bound = b_bound + 1 253 let bind: *u8 = rbind[br0] as *u8 254 var organ: *u8 = 0 as *u8 255 var sym: *u8 = bind 256 var ci: i64 = 0 257 while bind[ci] != (0 as u8) { if bind[ci] == (58 as u8) { break } ci = ci + 1 } 258 if bind[ci] == (58 as u8) { bind[ci] = 0 as u8; organ = bind; sym = (bind as i64 + ci + 1) as *u8 } else { 259 if mxtried == 0 { mxtried = 1; mxb = sys_read_file(mxpath, mxl); if (mxb as i64) != 0 { mxn = mxl[0] } } 260 if (mxb as i64) != 0 { if ml_find_matrix_organ(mxb, mxn, sym, 0, sd_slen(sym), ospan) == 1 { 261 let oc: *u8 = sys_mmap(ospan[1] + 8) 262 ml_span_cstr(mxb, ospan[0], ospan[1], oc, ospan[1] + 8) 263 organ = oc 264 } } 265 } 266 rsym[br0] = sym as i64 267 if (organ as i64) == 0 { b_unresolved = b_unresolved + 1; rdrift[br0] = SL_DRIFT_UNRESOLVED } else { 268 rorgan[br0] = organ as i64 269 let m: i64 = sd_present(organ, sym, rl2) 270 rmeas[br0] = m; rrule[br0] = rl2[0] 271 let g: *u8 = rf[br0*SL_MAXF + 2] as *u8 272 var claims: i64 = 0 273 if g[0] == (66 as u8) { claims = 1 } 274 if g[0] == (89 as u8) { claims = 1 } 275 if g[0] == (126 as u8) { claims = 1 } 276 if m < 0 { b_unreadable = b_unreadable + 1; rdrift[br0] = SL_DRIFT_UNREADABLE } else { 277 if m == 1 { if claims == 1 { 278 // CE4 (2026-09-05): the symbol is in SOURCE, but a shipped claim must also be on the SERVING 279 // surface -- SYMBOL PRESENCE CANNOT SEE A PROMOTE (the McCabe row read SHIPPED while its binary 280 // was SOURCE-ONLY). cb_serve_state_cwd resolves the served twin the way sd_present resolved the 281 // source: CWD-relative, from the two CWDs the generators run under. A served organ stays 282 // CONSISTENT (byte-identical to before); a source-only one reads UNSERVED -- announced with the 283 // badge and counted, never refused: the verdict CONTRADICTS the claim, it does not deny it. 284 let sv: i64 = cb_serve_state_cwd(organ) 285 if sv == CB_SERVED { b_consistent = b_consistent + 1; rdrift[br0] = SL_DRIFT_CONSISTENT } else { b_unserved = b_unserved + 1; rdrift[br0] = SL_DRIFT_UNSERVED } 286 } else { b_stale = b_stale + 1; rdrift[br0] = SL_DRIFT_STALE_UNDER } } 287 else { if claims == 1 { b_unbacked = b_unbacked + 1; rdrift[br0] = SL_DRIFT_UNBACKED } else { b_consistent = b_consistent + 1; rdrift[br0] = SL_DRIFT_CONSISTENT } } 288 } 289 } 290 } 291 br0 = br0 + 1 292 } 293 294 // tally over the GRADE axes: Nishi standing (col 0); numeric axes counted separately; every Best must cite 295 var g_axes: i64 = 0; var nishi_best: i64 = 0; var nishi_no: i64 = 0; var num_axes: i64 = 0 296 var best_unevidenced: i64 = 0 297 var r: i64 = 0 298 while r < rown { 299 let kind: *u8 = rf[r*SL_MAXF + 1] as *u8 300 if streq(kind, "num" as *u8) == 1 { num_axes = num_axes + 1 } else { 301 g_axes = g_axes + 1 302 let nv: *u8 = rf[r*SL_MAXF + 2] as *u8 303 if nv[0] == (66 as u8) { 304 nishi_best = nishi_best + 1 305 let nnote: *u8 = rf[r*SL_MAXF + (rnf[r]-1)] as *u8 306 if sl_note_has_evidence(nnote) == 0 { best_unevidenced = best_unevidenced + 1 } 307 } 308 if nv[0] == (110 as u8) { nishi_no = nishi_no + 1 } 309 } 310 r = r + 1 311 } 312 313 st.cf = cf; st.rf = rf; st.rcat = rcat; st.rnf = rnf; st.rbind = rbind; st.rmeas = rmeas; st.rdrift = rdrift 314 st.rrule = rrule; st.rorgan = rorgan; st.rsym = rsym 315 st.ncol = ncol; st.title = title; st.sub = sub; st.verdict = verdict; st.rown = rown 316 st.b_bound = b_bound; st.b_consistent = b_consistent; st.b_stale = b_stale; st.b_unbacked = b_unbacked 317 st.b_unresolved = b_unresolved; st.b_unreadable = b_unreadable; st.b_unserved = b_unserved 318 st.g_axes = g_axes; st.nishi_best = nishi_best; st.nishi_no = nishi_no; st.num_axes = num_axes 319 st.best_unevidenced = best_unevidenced 320 st.loaded = 1 321 return 1 322} 323 324// The grid's TYPE rules only: the card grid, box, border, .capside and .rw alignment are owned by sc_layout_pass, 325// which every generator already emits (re-stating them here would override the container query -- measured on 326// the sota page 2026-08-31). Emitted only when a .sota exists, so a matrix-only page is byte-identical. 327func sl_css(fd: i64) -> i64 { 328 w(fd, ".sotafield .legend{display:flex;gap:12px;flex-wrap:wrap;font-size:.78rem;color:var(--mut);margin:12px 0 2px;align-items:center}.sotafield .legend .k{display:inline-flex;gap:6px;align-items:center}\n" as *u8) 329 w(fd, ".dot{display:inline-block;width:13px;height:13px;border-radius:4px;background:rgb(52,62,88)}.dot.ex{background:var(--ex)}.dot.y{background:var(--y)}.dot.p{background:var(--p)}.dot.n{background:rgb(52,62,88)}\n" as *u8) 330 w(fd, ".cap-name{font-weight:600;color:var(--fg);font-size:.98rem;line-height:1.35;text-wrap:balance}.cap-note{color:var(--mut);font-size:.86rem;margin:3px 0 0;line-height:1.55}\n" as *u8) 331 w(fd, ".fieldnums{color:var(--mut);font-size:.78rem;margin:8px 0 0;font-family:ui-monospace,Consolas,monospace;line-height:1.9}.fn{margin-right:14px;white-space:nowrap}.fn b{color:var(--fg);font-weight:600}\n" as *u8) 332 w(fd, ".st{font-size:.68rem;letter-spacing:.08em;text-transform:uppercase;font-weight:650;padding:4px 10px;border-radius:8px;display:inline-block;white-space:nowrap}.st.me{color:var(--y);background:var(--tint)}.st.ex{color:var(--ex);background:var(--tint)}.st.pa{color:var(--p);background:var(--tint)}.st.ab{color:var(--mut);background:var(--soft)}\n" as *u8) 333 w(fd, ".bind{font-size:.76rem;color:var(--mut);margin:6px 0 0;font-family:ui-monospace,Consolas,monospace;line-height:1.5}.bind code{font-family:inherit;background:var(--soft);padding:1px 5px;border-radius:4px}.bind.dr b{color:var(--n)}.bind.pa b{color:var(--p)}.bind.me b{color:var(--y)}\n" as *u8) 334 w(fd, ".nnum{font-size:1.35rem;font-weight:650;font-variant-numeric:tabular-nums;color:var(--fg)}.nl{font-size:.68rem;letter-spacing:.1em;text-transform:uppercase;color:var(--mut)}\n" as *u8) 335 w(fd, ".tally{margin:18px 0;font-size:.9rem}.badge{display:inline-block;padding:4px 12px;border-radius:999px;background:var(--panel);border:1px solid var(--line);margin-right:6px;font-size:.82rem;color:var(--mut)}\n" as *u8) 336 return 0 337} 338 339// THE SECTION: the N-peer grade grid with its measured bindings, tally and the field verdict. The heading is the 340// declared shape's `SOTA field` prefix (knowledge/compare/sections.required); category heads are h3 so they never 341// read as page sections to the census. 342func sl_html(st: *SotaState, domain: *u8, fd: i64) -> i64 { return sl_html_heading(st, domain, fd, 2) } 343func sl_html_heading(st: *SotaState, domain: *u8, fd: i64, heading_level: i64) -> i64 { 344 if st.loaded != 1 { return 0 } 345 let cf: *i64 = st.cf; let rf: *i64 = st.rf; let rcat: *i64 = st.rcat; let rnf: *i64 = st.rnf 346 let rbind: *i64 = st.rbind; let rmeas: *i64 = st.rmeas; let rdrift: *i64 = st.rdrift; let rrule: *i64 = st.rrule 347 let rorgan: *i64 = st.rorgan; let rsym: *i64 = st.rsym 348 let ncol: i64 = st.ncol; let rown: i64 = st.rown 349 w(fd, "<section class='sotafield' id='sotafield'>\n" as *u8); sc_heading_open(fd, heading_level, "" as *u8); w(fd, "SOTA field &mdash; " as *u8); wn(fd, ncol - 1); w(fd, " peers, " as *u8); wn(fd, rown); w(fd, " axes, measured bindings" as *u8); sc_heading_close(fd, heading_level); w(fd, "\n" as *u8) 350 if (st.sub as i64) != 0 { w(fd, "<p class='sub' style='font-size:.9rem'>" as *u8); w(fd, st.sub); w(fd, "</p>\n" as *u8) } 351 w(fd, "<div class='meth'><b>How the field is scored.</b> A state-of-the-art comparison across the FULL competitor field: <b>quantitative</b> axes carry measured or published numbers (Nishi&rsquo;s column is measured on this estate, competitor columns are researcher-sourced and cited in the note); <b>grade</b> axes carry Best / Yes / Part / No for every peer. A Nishi grade may be <b>bound</b> to an organ and a symbol and is then re-measured on every publish by the one symbol ruler the capability matrix above uses; an over-claim refuses to publish.</div>\n" as *u8) 352 w(fd, "<div class='legend'><span class='k'>field, strip order:</span>" as *u8) 353 var hc: i64 = 1 354 while hc < ncol { 355 let lcn: *u8 = cf[hc] as *u8 356 w(fd, "<span class='k'><span class='dot'></span>" as *u8); w(fd, lcn); w(fd, "</span>" as *u8) 357 hc = hc + 1 358 } 359 w(fd, "<span class='k'>&middot;</span><span class='k'><span class='dot ex'></span>Best</span><span class='k'><span class='dot y'></span>Yes</span><span class='k'><span class='dot p'></span>Part</span><span class='k'><span class='dot n'></span>No</span></div>\n" as *u8) 360 if st.b_bound > 0 { 361 w(fd, "<div class='meth'><b>Measured bindings.</b> " as *u8); wn(fd, st.b_bound); w(fd, " of the Nishi grades on this page are bound to an organ and a symbol and re-measured on every publish by the one symbol ruler: consistent " as *u8); wn(fd, st.b_consistent) 362 w(fd, ", stale-under " as *u8); wn(fd, st.b_stale); w(fd, " (the grade says No while the organ carries the symbol -- published with the badge, named by the gate until raised), unbacked " as *u8); wn(fd, st.b_unbacked) 363 w(fd, " (a claim over an absent symbol refuses to publish), unresolved " as *u8); wn(fd, st.b_unresolved); w(fd, ", unreadable " as *u8); wn(fd, st.b_unreadable); w(fd, ", unserved " as *u8); wn(fd, st.b_unserved); w(fd, " (a claim over a symbol its organ carries in SOURCE while the organ binary is not on the serving surface -- built nowhere, the class symbol presence cannot see; published with the badge, never refused).</div>\n" as *u8) 364 } 365 w(fd, "<div class='caps'>\n" as *u8) 366 var lastcat: *u8 = 0 as *u8 367 var rr: i64 = 0 368 while rr < rown { 369 let cat: *u8 = rcat[rr] as *u8 370 var newcat: i64 = 0 371 if (lastcat as i64) == 0 { newcat = 1 } else { if streq(cat, lastcat) == 0 { newcat = 1 } } 372 if newcat == 1 { sc_heading_open(fd, heading_level+1, " class='ghead'" as *u8); w(fd, cat); sc_heading_close(fd, heading_level+1); w(fd, "\n" as *u8); lastcat = cat } 373 let kind: *u8 = rf[rr*SL_MAXF + 1] as *u8 374 let isnum: i64 = streq(kind, "num" as *u8) 375 w(fd, "<div class='cap'><div class='capmain'><div class='cap-name'>" as *u8); w(fd, rf[rr*SL_MAXF + 0] as *u8) 376 w(fd, "</div><p class='cap-note'>" as *u8); wnote(fd, rf[rr*SL_MAXF + (rnf[rr]-1)] as *u8); w(fd, "</p>" as *u8) 377 if rbind[rr] != 0 { 378 w(fd, "<p class='bind " as *u8); w(fd, sl_drift_class(rdrift[rr])); w(fd, "'>bound to <code>" as *u8); w(fd, rorgan[rr] as *u8); w(fd, ":" as *u8); w(fd, rsym[rr] as *u8) 379 w(fd, "</code> &middot; measured " as *u8); w(fd, sl_meas_name(rmeas[rr])) 380 if rrule[rr] > 0 { w(fd, " (" as *u8); w(fd, sd_rule_name(rrule[rr])); w(fd, ")" as *u8) } 381 w(fd, " &middot; <b>" as *u8); w(fd, sl_drift_name(rdrift[rr])); w(fd, "</b>" as *u8) 382 if rdrift[rr] == SL_DRIFT_STALE_UNDER { w(fd, " &mdash; the hand grade says No while the organ carries the symbol: this cell under-reports and stays flagged until the grade is raised" as *u8) } 383 if rdrift[rr] == SL_DRIFT_UNBACKED { w(fd, " &mdash; the hand grade claims the capability while its organ does not carry the symbol: an unbacked claim" as *u8) } 384 if rdrift[rr] == SL_DRIFT_UNSERVED { w(fd, " &mdash; the hand grade claims the capability and the organ carries the symbol in SOURCE, but its binary is not on the serving surface: built nowhere -- this cell over-reports what RUNS and stays flagged until the organ is promoted" as *u8) } 385 w(fd, "</p>" as *u8) 386 } 387 if isnum == 1 { 388 w(fd, "<p class='fieldnums'>" as *u8) 389 var vc: i64 = 1 390 while vc < ncol { 391 let fcn: *u8 = cf[vc] as *u8 392 w(fd, "<span class='fn'><b>" as *u8); w(fd, fcn); w(fd, "</b> " as *u8); w(fd, rf[rr*SL_MAXF + 2 + vc] as *u8); w(fd, "</span>" as *u8) 393 vc = vc + 1 394 } 395 w(fd, "</p>" as *u8) 396 } 397 w(fd, "</div><div class='capside'>" as *u8) 398 if isnum == 1 { 399 w(fd, "<div class='nnum'>" as *u8); w(fd, rf[rr*SL_MAXF + 2] as *u8); w(fd, "</div><div class='nl'>Nishi, measured</div>" as *u8) 400 } else { 401 let nv: *u8 = rf[rr*SL_MAXF + 2] as *u8 402 if nv[0] == (66 as u8) { w(fd, "<span class='st ex'>BEST</span>" as *u8) } else { 403 if nv[0] == (89 as u8) { w(fd, "<span class='st me'>YES</span>" as *u8) } else { 404 if nv[0] == (126 as u8) { w(fd, "<span class='st pa'>PART</span>" as *u8) } else { 405 w(fd, "<span class='st ab'>NO</span>" as *u8) } } } 406 w(fd, "<div class='rw'>" as *u8) 407 var vc2: i64 = 1 408 while vc2 < ncol { 409 let cv: *u8 = rf[rr*SL_MAXF + 2 + vc2] as *u8 410 let dcn: *u8 = cf[vc2] as *u8 411 w(fd, "<span class='dot" as *u8) 412 if cv[0] == (66 as u8) { w(fd, " ex" as *u8) } else { if cv[0] == (89 as u8) { w(fd, " y" as *u8) } else { if cv[0] == (126 as u8) { w(fd, " p" as *u8) } else { w(fd, " n" as *u8) } } } 413 w(fd, "' title='" as *u8); w(fd, dcn); w(fd, ": " as *u8) 414 if cv[0] == (66 as u8) { w(fd, "Best" as *u8) } else { if cv[0] == (89 as u8) { w(fd, "Yes" as *u8) } else { if cv[0] == (126 as u8) { w(fd, "Part" as *u8) } else { w(fd, "No" as *u8) } } } 415 w(fd, "'></span>" as *u8) 416 vc2 = vc2 + 1 417 } 418 w(fd, "</div>" as *u8) 419 } 420 w(fd, "</div></div>\n" as *u8) 421 rr = rr + 1 422 } 423 w(fd, "</div>\n" as *u8) 424 w(fd, "<div class='tally'><span class='badge'>" as *u8); wn(fd, ncol - 1); w(fd, " competitors</span><span class='badge'>" as *u8); wn(fd, rown); w(fd, " axes</span><span class='badge'>" as *u8); wn(fd, st.num_axes); w(fd, " quantitative</span><span class='badge'>Nishi best " as *u8); wn(fd, st.nishi_best); w(fd, " &middot; absent " as *u8); wn(fd, st.nishi_no); w(fd, "</span>" as *u8) 425 if st.b_bound > 0 { w(fd, "<span class='badge'>bound " as *u8); wn(fd, st.b_bound); w(fd, " &middot; stale-under " as *u8); wn(fd, st.b_stale); w(fd, " &middot; unbacked " as *u8); wn(fd, st.b_unbacked); w(fd, " &middot; unserved " as *u8); wn(fd, st.b_unserved); w(fd, "</span>" as *u8) } 426 w(fd, "</div>\n" as *u8) 427 if (st.verdict as i64) != 0 { w(fd, "<div class='verdict'>" as *u8); w(fd, st.verdict); w(fd, "</div>\n" as *u8) } else { 428 w(fd, "<div class='verdict'><b>Honest verdict.</b> Measured across the full field. Where Nishi is under SOTA, that is <b>filed work with an owner, never &lsquo;by design&rsquo;</b> (operator law: less-than-SOTA is never design).</div>\n" as *u8) 429 } 430 w(fd, "</section>\n" as *u8) 431 return 0 432} 433 434// api.json fragment: `,"sota":{...}` -- the field names the drift gate and the hub read, unchanged 435// (columns, axes[].category/label/kind/cells/note[/bind_organ/bind_symbol/measured/rule/drift], summary). 436func sl_json(st: *SotaState, domain: *u8, fd: i64) -> i64 { 437 if st.loaded != 1 { return 0 } 438 let cf: *i64 = st.cf; let rf: *i64 = st.rf; let rcat: *i64 = st.rcat; let rnf: *i64 = st.rnf 439 let rbind: *i64 = st.rbind; let rmeas: *i64 = st.rmeas; let rdrift: *i64 = st.rdrift; let rrule: *i64 = st.rrule 440 let rorgan: *i64 = st.rorgan; let rsym: *i64 = st.rsym 441 let ncol: i64 = st.ncol; let rown: i64 = st.rown 442 wc(fd, 44); wq(fd); w(fd, "sota" as *u8); wq(fd); wc(fd, 58); wc(fd, 123) 443 kv_s(fd, "kind" as *u8, "sota" as *u8); wc(fd, 44) 444 kv_s(fd, "title" as *u8, st.title); wc(fd, 44) 445 kv_s(fd, "source_file" as *u8, st.src_base); wc(fd, 44); kv_n(fd, "source_hash" as *u8, st.src_hash); wc(fd, 44) 446 wq(fd); w(fd, "columns" as *u8); wq(fd); wc(fd, 58); wc(fd, 91) 447 var cj: i64 = 0 448 while cj < ncol { if cj > 0 { wc(fd, 44) } wq(fd); wj(fd, cf[cj] as *u8); wq(fd); cj = cj + 1 } 449 wc(fd, 93); wc(fd, 44) 450 wq(fd); w(fd, "axes" as *u8); wq(fd); wc(fd, 58); wc(fd, 91) 451 var rj: i64 = 0 452 while rj < rown { 453 if rj > 0 { wc(fd, 44) } 454 wc(fd, 123) 455 kv_s(fd, "category" as *u8, rcat[rj] as *u8); wc(fd, 44) 456 kv_s(fd, "label" as *u8, rf[rj*SL_MAXF + 0] as *u8); wc(fd, 44) 457 kv_s(fd, "kind" as *u8, rf[rj*SL_MAXF + 1] as *u8); wc(fd, 44) 458 wq(fd); w(fd, "cells" as *u8); wq(fd); wc(fd, 58); wc(fd, 91) 459 var ci: i64 = 0 460 while ci < ncol { if ci > 0 { wc(fd, 44) } wq(fd); wj(fd, rf[rj*SL_MAXF + 2 + ci] as *u8); wq(fd); ci = ci + 1 } 461 wc(fd, 93); wc(fd, 44) 462 kv_s(fd, "note" as *u8, rf[rj*SL_MAXF + (rnf[rj]-1)] as *u8) 463 if rbind[rj] != 0 { 464 wc(fd, 44); kv_s(fd, "bind_organ" as *u8, rorgan[rj] as *u8); wc(fd, 44); kv_s(fd, "bind_symbol" as *u8, rsym[rj] as *u8) 465 wc(fd, 44); kv_s(fd, "measured" as *u8, sl_meas_name(rmeas[rj])); wc(fd, 44); kv_s(fd, "rule" as *u8, sd_rule_name(rrule[rj])) 466 wc(fd, 44); kv_s(fd, "drift" as *u8, sl_drift_name(rdrift[rj])) 467 } 468 wc(fd, 125) 469 rj = rj + 1 470 } 471 wc(fd, 93); wc(fd, 44) 472 wq(fd); w(fd, "summary" as *u8); wq(fd); wc(fd, 58); wc(fd, 123) 473 kv_n(fd, "competitors" as *u8, ncol - 1); wc(fd, 44); kv_n(fd, "axes" as *u8, rown); wc(fd, 44) 474 kv_n(fd, "quantitative_axes" as *u8, st.num_axes); wc(fd, 44); kv_n(fd, "nishi_best" as *u8, st.nishi_best); wc(fd, 44); kv_n(fd, "nishi_absent" as *u8, st.nishi_no) 475 wc(fd, 44); kv_n(fd, "bound" as *u8, st.b_bound); wc(fd, 44); kv_n(fd, "consistent" as *u8, st.b_consistent); wc(fd, 44); kv_n(fd, "stale_under" as *u8, st.b_stale) 476 wc(fd, 44); kv_n(fd, "unbacked" as *u8, st.b_unbacked); wc(fd, 44); kv_n(fd, "unresolved" as *u8, st.b_unresolved); wc(fd, 44); kv_n(fd, "unreadable" as *u8, st.b_unreadable); wc(fd, 44); kv_n(fd, "unserved" as *u8, st.b_unserved) 477 wc(fd, 125); wc(fd, 44) 478 kv_s(fd, "measurement" as *u8, "quantitative axes = measured/published numbers (Nishi col measured, competitors researcher-sourced); grade axes B=Best Y=Yes ~=Part n=No; a bound grade is re-measured on every publish and its drift class is named" as *u8) 479 wc(fd, 125) 480 return 0 481} 482 483// The plain-mode census: the liar-kill (cols, rows, quantitative, evidenced Bests, no UNBACKED binding), every 484// offender named, the BIND line and the per-row drift lines -- exactly the lines nx_sota_drift_gate reads. 485// Returns 1 when the field passes, 0 when it refuses; the caller prints the verdict line LAST. 486func sl_census(st: *SotaState, domain: *u8, fd: i64) -> i64 { 487 if st.loaded != 1 { return 1 } 488 let rf: *i64 = st.rf; let rnf: *i64 = st.rnf; let rbind: *i64 = st.rbind; let rmeas: *i64 = st.rmeas 489 let rdrift: *i64 = st.rdrift; let rorgan: *i64 = st.rorgan; let rsym: *i64 = st.rsym 490 let ncol: i64 = st.ncol; let rown: i64 = st.rown 491 w(fd, "=== NX-SWCOMPARE-SOTA domain=" as *u8); w(fd, domain); w(fd, " (field pass) ===\n" as *u8) 492 w(fd, " title=" as *u8); w(fd, st.title); w(fd, " competitors=" as *u8); wn(fd, ncol - 1); w(fd, " (+Nishi) axes=" as *u8); wn(fd, rown); w(fd, " quantitative=" as *u8); wn(fd, st.num_axes); w(fd, "\n" as *u8) 493 w(fd, " grade-axes=" as *u8); wn(fd, st.g_axes); w(fd, " Nishi-Best=" as *u8); wn(fd, st.nishi_best); w(fd, " Nishi-No=" as *u8); wn(fd, st.nishi_no); w(fd, "\n" as *u8) 494 var liar_cols: i64 = 0 495 if ncol >= SL_LIAR_COLS { liar_cols = 1 } 496 var liar_rows: i64 = 0 497 if rown >= SL_LIAR_ROWS { liar_rows = 1 } 498 var liar_num: i64 = 0 499 if st.num_axes >= SL_LIAR_NUM { liar_num = 1 } 500 var liar_honest: i64 = 0 501 if st.best_unevidenced == 0 { liar_honest = 1 } 502 w(fd, " LIAR-KILL: cols>=8=" as *u8); wn(fd, liar_cols); w(fd, " rows>=20=" as *u8); wn(fd, liar_rows); w(fd, " quantitative>=3=" as *u8); wn(fd, liar_num); w(fd, " honest(every Best cites evidence)=" as *u8); wn(fd, liar_honest) 503 w(fd, " BESTS: total=" as *u8); wn(fd, st.nishi_best); w(fd, " unevidenced=" as *u8); wn(fd, st.best_unevidenced); w(fd, " absents=" as *u8); wn(fd, st.nishi_no); w(fd, " (an unevidenced Best is the liar; the count of wins is not)\n" as *u8) 504 if st.best_unevidenced > 0 { 505 w(fd, " UNEVIDENCED-BEST ROWS -- cite a gate, a dated measurement, a proof or a witness, or lower the grade:\n" as *u8) 506 var ur: i64 = 0 507 while ur < rown { 508 let ukind: *u8 = rf[ur*SL_MAXF + 1] as *u8 509 if streq(ukind, "num" as *u8) == 1 { } else { 510 let unv: *u8 = rf[ur*SL_MAXF + 2] as *u8 511 if unv[0] == (66 as u8) { 512 let unote: *u8 = rf[ur*SL_MAXF + (rnf[ur]-1)] as *u8 513 if sl_note_has_evidence(unote) == 0 { w(fd, " - " as *u8); w(fd, rf[ur*SL_MAXF + 0] as *u8); w(fd, "\n" as *u8) } 514 } 515 } 516 ur = ur + 1 517 } 518 } 519 w(fd, " BIND: bound=" as *u8); wn(fd, st.b_bound); w(fd, " consistent=" as *u8); wn(fd, st.b_consistent); w(fd, " stale_under=" as *u8); wn(fd, st.b_stale); w(fd, " unbacked=" as *u8); wn(fd, st.b_unbacked); w(fd, " unresolved=" as *u8); wn(fd, st.b_unresolved); w(fd, " unreadable=" as *u8); wn(fd, st.b_unreadable); w(fd, " unserved=" as *u8); wn(fd, st.b_unserved); w(fd, "\n" as *u8) 520 var bo2: i64 = 0 521 while bo2 < rown { 522 if rbind[bo2] != 0 { if rdrift[bo2] != SL_DRIFT_CONSISTENT { 523 w(fd, " - " as *u8); w(fd, rf[bo2*SL_MAXF + 0] as *u8); w(fd, " [" as *u8); w(fd, sl_drift_name(rdrift[bo2])); w(fd, "] organ=" as *u8); w(fd, rorgan[bo2] as *u8); w(fd, " sym=" as *u8); w(fd, rsym[bo2] as *u8); w(fd, " measured=" as *u8); w(fd, sl_meas_name(rmeas[bo2])); w(fd, "\n" as *u8) 524 } } 525 bo2 = bo2 + 1 526 } 527 var liar_bound: i64 = 1 528 if st.b_unbacked > 0 { liar_bound = 0 } 529 let ok: i64 = liar_cols & liar_rows & liar_num & liar_honest & liar_bound 530 w(fd, " FIELD: " as *u8) 531 if ok == 1 { w(fd, "MEASURED-HONEST (SOTA-scale, liar-killed)\n" as *u8) } else { w(fd, "RED (too few competitors/axes, an unevidenced Best, or an UNBACKED bound grade -- see BIND above)\n" as *u8) } 532 return ok 533}