code wiki / _hdl_build / nx_stackaudit_lib.nx

nx_stackaudit_lib.nx source

↩ module page · 442 lines · 21486 B

1// nx_stackaudit_lib.nx -- shared core for the FULL-STACK LADDER CENSUS (the sovereign auditor). 2// Operator 2026-07-02: "did you build the auditors capabilities into the nishi family and ecosystems" 3// -> this organ family regenerates the rung-by-rung stack audit (R0 silicon .. R12 team/autonomy) 4// from REAL evidence logs in knowledge/status/ on every run: no Claude in the loop, no self-report, 5// measured never asserted. Composes the proven ecomat evidence readers (el_last_after/el_last_green). 6// STATUSES per rung: GREEN/RED (gate-liveness, LAST verdict wins) | MEASURED permil (permil-derive) 7// | UNKNOWN (no source, or source missing). ANTI-ROT LIAR-KILL: a rung that EXPECTS evidence whose 8// log is missing/unparseable => conflict => census verdict RED (a renamed/deleted log screams, never 9// silently greens). Rung REDs (e.g. funcheck) do NOT redden the census -- honest readings are the job. 10// Tables: t=0 REAL (13 rungs) | t=1 gate RED-path fixture | t=2 gate GREEN-path fixture. 11// license_tier: ORIGINAL 12import "nx_ecomat_lib.nx" 13const SAX_MAGIC_262144: i64 = 262144 14 15const SAX_LOG: *u8 = "knowledge/status/stack_census.log" 16const SAX_PAGE: *u8 = "web_assets/stack_audit.html" 17 18func sax_n(t: i64) -> i64 { if t == 0 { return 13 } if t == 3 { return 1 } return 3 } 19 20func sax_id(t: i64, i: i64) -> *u8 { 21 if t != 0 { 22 if i == 0 { return "T0" as *u8 } 23 if i == 1 { return "T1" as *u8 } 24 return "T2" as *u8 25 } 26 if i == 0 { return "R0" as *u8 } 27 if i == 1 { return "R1" as *u8 } 28 if i == 2 { return "R2" as *u8 } 29 if i == 3 { return "R3" as *u8 } 30 if i == 4 { return "R4" as *u8 } 31 if i == 5 { return "R5" as *u8 } 32 if i == 6 { return "R6" as *u8 } 33 if i == 7 { return "R7" as *u8 } 34 if i == 8 { return "R8" as *u8 } 35 if i == 9 { return "R9" as *u8 } 36 if i == 10 { return "R10" as *u8 } 37 if i == 11 { return "R11" as *u8 } 38 return "R12" as *u8 39} 40 41func sax_name(t: i64, i: i64) -> *u8 { 42 if t != 0 { 43 if i == 0 { return "fixture-gate" as *u8 } 44 if i == 1 { return "fixture-permil" as *u8 } 45 return "fixture-tail" as *u8 46 } 47 if i == 0 { return "silicon" as *u8 } 48 if i == 1 { return "boot-firmware" as *u8 } 49 if i == 2 { return "kernel-os" as *u8 } 50 if i == 3 { return "gpu" as *u8 } 51 if i == 4 { return "language" as *u8 } 52 if i == 5 { return "runtime-organs" as *u8 } 53 if i == 6 { return "data" as *u8 } 54 if i == 7 { return "network-edge" as *u8 } 55 if i == 8 { return "apis" as *u8 } 56 if i == 9 { return "intelligence" as *u8 } 57 if i == 10 { return "apps-media" as *u8 } 58 if i == 11 { return "clients-mobile" as *u8 } 59 return "team-autonomy" as *u8 60} 61 62// evkind: 0=none 1=permil-derive 2=gate-liveness (mirrors ecomat semantics) 63func sax_kind(t: i64, i: i64) -> i64 { 64 if t != 0 { 65 if i == 0 { return 2 } 66 if i == 1 { return 1 } 67 return 2 68 } 69 if i == 0 { return 2 } 70 if i == 1 { return 2 } 71 if i == 2 { return 1 } 72 if i == 3 { return 2 } 73 if i == 4 { return 1 } 74 if i == 5 { return 1 } 75 if i == 6 { return 2 } 76 if i == 7 { return 2 } 77 if i == 8 { return 1 } 78 if i == 9 { return 2 } 79 if i == 10 { return 2 } 80 if i == 11 { return 1 } 81 return 1 82} 83 84func sax_log(t: i64, i: i64) -> *u8 { 85 if t == 1 { 86 if i == 0 { return "/tmp/sa_fx_g.log" as *u8 } 87 if i == 1 { return "/tmp/sa_fx_p.log" as *u8 } 88 return "/tmp/sa_fx_never.log" as *u8 89 } 90 if t == 2 { 91 if i == 0 { return "/tmp/sa_fx_g.log" as *u8 } 92 if i == 1 { return "/tmp/sa_fx_p.log" as *u8 } 93 return "/tmp/sa_fx_g2.log" as *u8 94 } 95 if t == 3 { return "/tmp/sa_fx_g.log" as *u8 } 96 if i == 0 { return "knowledge/status/synth_matrix.log" as *u8 } 97 if i == 1 { return "knowledge/status/boot_stub.log" as *u8 } 98 if i == 2 { return "knowledge/status/kernel_census.log" as *u8 } 99 if i == 3 { return "knowledge/status/gpu_dxg.log" as *u8 } 100 if i == 4 { return "knowledge/status/lang_maturity.log" as *u8 } 101 if i == 5 { return "knowledge/status/sovereignty_audit.log" as *u8 } 102 if i == 6 { return "knowledge/status/ws_crash_gate.log" as *u8 } 103 if i == 7 { return "knowledge/status/funcheck.log" as *u8 } 104 if i == 8 { return "knowledge/status/mgmt_census.log" as *u8 } 105 if i == 9 { return "knowledge/status/llm_capability.log" as *u8 } 106 if i == 10 { return "knowledge/status/media_census.log" as *u8 } 107 if i == 11 { return "knowledge/status/mobile_census.log" as *u8 } 108 return "knowledge/status/autonomy_meter.log" as *u8 109} 110 111func sax_pat(t: i64, i: i64) -> *u8 { 112 if t != 0 { 113 if i == 1 { return "permil=" as *u8 } 114 return "verdict=" as *u8 115 } 116 if i == 2 { return "our_coverage_permil=" as *u8 } 117 if i == 4 { return "maturity_permil=" as *u8 } 118 if i == 5 { return "product_purity_permil=" as *u8 } 119 if i == 8 { return "permil=" as *u8 } 120 if i == 11 { return "our_coverage_permil=" as *u8 } 121 if i == 12 { return "permil=" as *u8 } 122 return "verdict=" as *u8 123} 124 125// expect=1 -> evidence MUST exist (missing/unparseable = anti-rot conflict). R11 clients-mobile 126// WAS the audit's named honest hole (no source, UNKNOWN by design); 2026-07-02 nx_mobile_census 127// landed (12 real web_assets cells, in-line pos/neg controls) and R11 is now MEASURED like the rest. 128func sax_expect(t: i64, i: i64) -> i64 { 129 return 1 130} 131 132// ---- TRIANGULATION (anti-self-validation): a SECOND, INDEPENDENT witness per rung where a clean one 133// exists. Verified 2026-07-02: R0 silicon <- rv64_runproof_gate (independent of synth_matrix), 134// R6 data <- infomgmt_gate (independent of ws_crash_gate), R10 apps <- cms_census (independent of 135// media_census). Agreement (both healthy or both broken) = triangulated; disagreement = CONFLICT -> 136// census RED (inconsistent evidence is untrustworthy evidence, like anti-rot). A declared-but-absent 137// 2nd source degrades to single-source, NEVER a fabricated conflict. Mirrors nx_ecomat_lib convergence. 138const SAX_HEALTH_FLOOR: i64 = 500 139 140func sax_kind2(t: i64, i: i64) -> i64 { 141 if t == 1 { return 0 } 142 if t == 2 { if i == 0 { return 2 } return 0 } 143 if t == 3 { return 2 } 144 if i == 0 { return 2 } 145 if i == 4 { return 2 } 146 if i == 6 { return 2 } 147 if i == 8 { return 2 } 148 if i == 10 { return 2 } 149 return 0 150} 151func sax_log2(t: i64, i: i64) -> *u8 { 152 if t == 2 { return "/tmp/sa_fx_g2.log" as *u8 } 153 if t == 3 { return "/tmp/sa_fx_r.log" as *u8 } 154 if i == 0 { return "knowledge/status/rv64_runproof_gate.log" as *u8 } 155 if i == 4 { return "knowledge/status/spirv_khronos_crosscheck.log" as *u8 } 156 if i == 6 { return "knowledge/status/infomgmt_gate.log" as *u8 } 157 if i == 8 { return "knowledge/status/mgmt_api_gate.log" as *u8 } 158 if i == 10 { return "knowledge/status/cms_census.log" as *u8 } 159 return "" as *u8 160} 161func sax_pat2(t: i64, i: i64) -> *u8 { 162 return "verdict=" as *u8 163} 164 165// map ONE witness to a health bit: 1 healthy / 0 broken / -1 no-witness. 166// permil-derive -> healthy iff permil >= FLOOR (FUNCTIONAL+); gate-liveness -> healthy iff GREEN. 167func sax_healthy(kind: i64, status: i64, permil: i64) -> i64 { 168 if kind == 1 { if permil >= SAX_HEALTH_FLOOR { return 1 } return 0 } 169 if kind == 2 { if status == 1 { return 1 } return 0 } 170 return 0 - 1 171} 172// triangulation status from the primary health h1 and the 2nd source: 1 single / 2 triangulated / 3 CONFLICT. 173func sax_tri_status(h1: i64, kind2: i64, missing2: i64, h2: i64) -> i64 { 174 if kind2 == 0 { return 1 } 175 if missing2 == 1 { return 1 } 176 if h1 == h2 { return 2 } 177 return 3 178} 179 180// evaluate ONE rung's evidence. ev[0]=status 0 UNKNOWN / 1 GREEN / 2 RED / 3 MEASURED 181// ev[1]=permil (or -1) ; ev[2]=missing (1 = no file / empty / pattern absent). 182func sax_eval(kind: i64, logp: *u8, pat: *u8, ev: *i64) -> i64 { 183 ev[0] = 0 184 ev[1] = 0 - 1 185 ev[2] = 0 186 if kind == 0 { return 0 } 187 let szp: *i64 = sys_mmap(16) as *i64 188 let b: *u8 = ss_readall(logp, szp) 189 var n: i64 = szp[0] 190 if n <= 0 { ev[2] = 1; return 0 } 191 if kind == 1 { 192 let p: i64 = el_last_after(b, n, pat) 193 if p >= 0 { ev[0] = 3; ev[1] = p; return 0 } 194 ev[2] = 1 195 return 0 196 } 197 if el_contains(b, n, pat) == 0 { ev[2] = 1; return 0 } 198 let g: i64 = el_last_green(b, n, pat) 199 if g == 1 { ev[0] = 1 } else { ev[0] = 2 } 200 return 0 201} 202 203func sax_status_label(status: i64, kind: i64, missing: i64) -> *u8 { 204 if kind == 0 { return "UNKNOWN(no-source)" as *u8 } 205 if missing == 1 { return "UNKNOWN(missing)" as *u8 } 206 if status == 1 { return "GREEN" as *u8 } 207 if status == 2 { return "RED" as *u8 } 208 if status == 3 { return "MEASURED" as *u8 } 209 return "UNKNOWN" as *u8 210} 211 212// the census core -- ONE implementation exercised by BOTH the real run (t=0) and the gate fixtures 213// (t=1 red-path, t=2 green-path) so the gate proves the exact production code path. 214// out[0]=rungs [1]=green [2]=red [3]=measured [4]=unknown [5]=conflicts [6]=avg_permil(-1 if none) 215// [7]=permil_n ; returns 0 GREEN / 1 RED (RED iff conflicts>0 = expected evidence missing). 216func sax_census(t: i64, verbose: i64, out: *i64) -> i64 { 217 let ev: *i64 = sys_mmap(32) as *i64 218 let ev2: *i64 = sys_mmap(32) as *i64 219 let n: i64 = sax_n(t) 220 var green: i64 = 0 221 var red: i64 = 0 222 var measured: i64 = 0 223 var unknown: i64 = 0 224 var conflicts: i64 = 0 225 var triangulated: i64 = 0 226 var tri_conflict: i64 = 0 227 var single_src: i64 = 0 228 var psum: i64 = 0 229 var pn: i64 = 0 230 var i: i64 = 0 231 while i < n { 232 let kind: i64 = sax_kind(t, i) 233 let logp: *u8 = sax_log(t, i) 234 let pat: *u8 = sax_pat(t, i) 235 let exp: i64 = sax_expect(t, i) 236 sax_eval(kind, logp, pat, ev) 237 let status: i64 = ev[0] 238 let permil: i64 = ev[1] 239 let missing: i64 = ev[2] 240 var conflict_row: i64 = 0 241 var tstat: i64 = 0 242 if kind == 0 { unknown = unknown + 1 } 243 if kind != 0 { 244 if missing == 1 { 245 unknown = unknown + 1 246 if exp == 1 { conflicts = conflicts + 1; conflict_row = 1 } 247 } 248 if missing == 0 { 249 if status == 1 { green = green + 1 } 250 if status == 2 { red = red + 1 } 251 if status == 3 { measured = measured + 1; psum = psum + permil; pn = pn + 1 } 252 // TRIANGULATION: check a second independent witness for this rung (present-primary only) 253 let kind2: i64 = sax_kind2(t, i) 254 let h1: i64 = sax_healthy(kind, status, permil) 255 if kind2 == 0 { 256 single_src = single_src + 1 257 tstat = 1 258 } else { 259 sax_eval(kind2, sax_log2(t, i), sax_pat2(t, i), ev2) 260 let h2: i64 = sax_healthy(kind2, ev2[0], ev2[1]) 261 tstat = sax_tri_status(h1, kind2, ev2[2], h2) 262 if tstat == 1 { single_src = single_src + 1 } 263 if tstat == 2 { triangulated = triangulated + 1 } 264 if tstat == 3 { tri_conflict = tri_conflict + 1 } 265 } 266 } 267 } 268 if verbose == 1 { 269 _p("STACKROW rung=" as *u8); _p(sax_id(t, i)) 270 _p(" name=" as *u8); _p(sax_name(t, i)) 271 _p(" status=" as *u8); _p(sax_status_label(status, kind, missing)) 272 if status == 3 { _p(" permil=" as *u8); _fn(1, permil) } 273 if kind != 0 { _p(" src=" as *u8); _p(logp) } 274 if tstat == 2 { _p(" [triangulated:" as *u8); _p(sax_log2(t, i)); _p("]" as *u8) } 275 if tstat == 3 { _p(" <== TRIANGULATION CONFLICT vs " as *u8); _p(sax_log2(t, i)) } 276 if conflict_row == 1 { _p(" <== EXPECTED-EVIDENCE-MISSING (anti-rot liar-kill)" as *u8) } 277 _p("\n" as *u8) 278 } 279 i = i + 1 280 } 281 out[0] = n; out[1] = green; out[2] = red; out[3] = measured 282 out[4] = unknown; out[5] = conflicts 283 if pn > 0 { out[6] = psum / pn } else { out[6] = 0 - 1 } 284 out[7] = pn 285 out[8] = triangulated; out[9] = tri_conflict; out[10] = single_src 286 if conflicts > 0 { return 1 } 287 if tri_conflict > 0 { return 1 } 288 return 0 289} 290 291// ---- TARGET EMIT (the loop-closer): an unhealthy rung BECOMES ranked work for the autonomous loop. 292// Mirrors nx_ecomat_lib::et_emit_targets_core -- idempotent (skip ids already in the queue), one TODO 293// per RED/below-FLOOR rung, weighted by leverage, with a ||MARK that auto-closes when the rung goes 294// healthy (the emitter writes STACK-DONE rung=<name> to stack_targets.log for healthy rungs, exactly 295// as ecomat writes ECOMAT-DONE; nx_reconcile flips the row on that marker). NO fabricated work: a rung 296// with no readable evidence is skipped, never targeted blindly. 297func sax_weight(i: i64) -> i64 { 298 if i == 0 { return 5 } 299 if i == 1 { return 5 } 300 if i == 2 { return 6 } 301 if i == 3 { return 6 } 302 if i == 4 { return 7 } 303 if i == 5 { return 6 } 304 if i == 6 { return 7 } 305 if i == 7 { return 8 } 306 if i == 8 { return 8 } 307 if i == 9 { return 9 } 308 if i == 10 { return 7 } 309 if i == 11 { return 8 } 310 return 9 311} 312func sax_next(i: i64) -> *u8 { 313 if i == 0 { return "PnR+bitstream onto one ECP5 board" as *u8 } 314 if i == 1 { return "boot one commodity box (never-brick intact)" as *u8 } 315 if i == 2 { return "MMU/SV39 + user-mode + seg_store-backed FS" as *u8 } 316 if i == 3 { return "cuLaunchKernel-on-own-PTX then SPIR-V dispatch" as *u8 } 317 if i == 4 { return "cast-index fix in codegen + sovereign equiv-prover + spec" as *u8 } 318 if i == 5 { return "route dev_api off-port behind mgmt-auth (retire WSL)" as *u8 } 319 if i == 6 { return "schedule ss_compact + DR the media to a 2nd location" as *u8 } 320 if i == 7 { return "fix andelinwest TLS + ship the FEC browser shim" as *u8 } 321 if i == 8 { return "cap-secret fail-closed (kill baked placeholder) + version negotiation" as *u8 } 322 if i == 9 { return "the Qwen forward numerical cross-check (unlocks brain+imagegen+synth)" as *u8 } 323 if i == 10 { return "serve the reader + one-call site publish/auto-revert" as *u8 } 324 if i == 11 { return "register the service worker (PWA installability) + reader as first app" as *u8 } 325 return "green the pulse (7 red monitors) + graders owned in the loop" as *u8 326} 327func sax_mkid(name: *u8, out: *u8) -> i64 { 328 let pre: *u8 = "STACK-" as *u8 329 var o: i64 = 0 330 var j: i64 = 0 331 while pre[j] != (0 as u8) { out[o]=pre[j]; o=o+1; j=j+1 } 332 j = 0 333 while name[j] != (0 as u8) { out[o]=name[j]; o=o+1; j=j+1 } 334 out[o] = 0 as u8 335 return o 336} 337func sax_should_emit(name: *u8, unhealthy: i64, qb: *u8, qn: i64) -> i64 { 338 if unhealthy == 0 { return 0 } 339 let idp: *u8 = sys_mmap(96) 340 sax_mkid(name, idp) 341 if el_contains(qb, qn, idp) == 1 { return 0 } 342 return 1 343} 344// out[0]=emitted out[1]=done_marks. qf=queue append fd, lf=targets-log append fd (or -1). 345func sax_emit_targets_core(qb: *u8, qn: i64, qf: i64, lf: i64, out: *i64) -> i64 { 346 let ev: *i64 = sys_mmap(32) as *i64 347 let idp: *u8 = sys_mmap(96) 348 var emitted: i64 = 0 349 var done_marks: i64 = 0 350 var i: i64 = 0 351 while i < 13 { 352 let kind: i64 = sax_kind(0, i) 353 sax_eval(kind, sax_log(0, i), sax_pat(0, i), ev) 354 let missing: i64 = ev[2] 355 if missing == 0 { 356 let name: *u8 = sax_name(0, i) 357 let h1: i64 = sax_healthy(kind, ev[0], ev[1]) 358 if h1 == 1 { 359 if lf >= 0 { _fp(lf, "STACK-DONE rung=" as *u8); _fp(lf, name); _fp(lf, " healthy epoch=" as *u8); _fn(lf, sys_now_realtime_sec()); _fp(lf, "\n" as *u8) } 360 done_marks = done_marks + 1 361 } else { 362 let se: i64 = sax_should_emit(name, 1, qb, qn) 363 if se == 1 { 364 let w: i64 = sax_weight(i) 365 sax_mkid(name, idp) 366 _fp(qf, idp); _fp(qf, "\tSTK\t" as *u8); _fn(qf, w) 367 _fp(qf, "\tM\tPM\tTODO\t-\tstack-" as *u8); _fp(qf, name) 368 _fp(qf, "-healthy||MARK=knowledge/status/stack_targets.log::STACK-DONE rung=" as *u8); _fp(qf, name) 369 _fp(qf, "\tstack audit target: raise " as *u8); _fp(qf, name) 370 _fp(qf, " to healthy -- " as *u8); _fp(qf, sax_next(i)) 371 _fp(qf, " (autogenerated w=" as *u8); _fn(qf, w); _fp(qf, "; auto-closes when the rung reads healthy)\n" as *u8) 372 if lf >= 0 { _fp(lf, "STACK-TARGET id=" as *u8); _fp(lf, idp); _fp(lf, " w=" as *u8); _fn(lf, w); _fp(lf, "\n" as *u8) } 373 emitted = emitted + 1 374 } 375 } 376 } 377 i = i + 1 378 } 379 out[0] = emitted 380 out[1] = done_marks 381 return 0 382} 383 384// emit the stack-audit dashboard as HTML (organ-authored last-mile render, NO JS, no hardcoded 385// numbers -- every row re-derived from the same sax_eval the census uses, so they cannot diverge). 386func sax_emit_page(t: i64, outhtml: *u8) -> i64 { 387 let out: *i64 = sys_mmap(128) as *i64 388 let verdict: i64 = sax_census(t, 0, out) 389 let ev: *i64 = sys_mmap(32) as *i64 390 let buf: *u8 = sys_mmap(SAX_MAGIC_262144) 391 var o: i64 = 0 392 o = ss_cat(buf, o, "<!doctype html><html lang=en><head><meta charset=utf-8><meta name=viewport content='width=device-width,initial-scale=1'><title>Nishi Stack Audit</title><style>" as *u8) 393 o = ss_cat(buf, o, "body{margin:0;font:15px/1.5 -apple-system,Segoe UI,Roboto,sans-serif;background:#0a0e15;color:#d8dee9}" as *u8) 394 o = ss_cat(buf, o, "header{padding:30px 24px;border-bottom:1px solid #1e2736}h1{margin:0 0 6px;font-size:21px;font-family:Consolas,monospace}" as *u8) 395 o = ss_cat(buf, o, ".sub{color:#8b94a7;font-size:13px}table{border-collapse:collapse;margin:18px 24px;max-width:900px;width:calc(100% - 48px)}" as *u8) 396 o = ss_cat(buf, o, "td,th{padding:8px 10px;border-bottom:1px solid #1e2736;text-align:left;font-size:14px}th{color:#8b94a7;font-size:11px;text-transform:uppercase;letter-spacing:.08em}" as *u8) 397 o = ss_cat(buf, o, ".rid{font-family:Consolas,monospace;color:#e8a33d;font-weight:700}.src{color:#6b7488;font-size:12px;font-family:Consolas,monospace}" as *u8) 398 o = ss_cat(buf, o, ".b{display:inline-block;padding:2px 9px;border-radius:2px;font-size:12px;font-weight:600;font-family:Consolas,monospace}" as *u8) 399 o = ss_cat(buf, o, ".sg{background:#0d4429;color:#3fb950}.sr{background:#490202;color:#ff7b72}.sm{background:#5c4302;color:#e3b341}.su{background:#21262d;color:#8b94a7}" as *u8) 400 o = ss_cat(buf, o, "footer{padding:18px 24px;color:#6b7488;font-size:12px;border-top:1px solid #1e2736}" as *u8) 401 o = ss_cat(buf, o, "</style></head><body><header><h1>Nishi Stack Audit &mdash; 1s and 0s up</h1><div class=sub>rungs " as *u8) 402 o = ss_catn(buf, o, out[0]) 403 o = ss_cat(buf, o, " &middot; green " as *u8); o = ss_catn(buf, o, out[1]) 404 o = ss_cat(buf, o, " &middot; red " as *u8); o = ss_catn(buf, o, out[2]) 405 o = ss_cat(buf, o, " &middot; measured " as *u8); o = ss_catn(buf, o, out[3]) 406 o = ss_cat(buf, o, " &middot; unknown " as *u8); o = ss_catn(buf, o, out[4]) 407 o = ss_cat(buf, o, " &middot; anti-rot-conflicts " as *u8); o = ss_catn(buf, o, out[5]) 408 o = ss_cat(buf, o, " &middot; avg-permil " as *u8); o = ss_catn(buf, o, out[6]) 409 o = ss_cat(buf, o, "</div><div class=sub>triangulated " as *u8); o = ss_catn(buf, o, out[8]) 410 o = ss_cat(buf, o, " (2nd independent witness) &middot; single-source " as *u8); o = ss_catn(buf, o, out[10]) 411 o = ss_cat(buf, o, " &middot; triangulation-conflicts " as *u8); o = ss_catn(buf, o, out[9]) 412 o = ss_cat(buf, o, "</div></header><table><tr><th>rung</th><th>layer</th><th>status</th><th>permil</th><th>evidence</th></tr>\n" as *u8) 413 let n: i64 = sax_n(t) 414 var i: i64 = 0 415 while i < n { 416 let kind: i64 = sax_kind(t, i) 417 sax_eval(kind, sax_log(t, i), sax_pat(t, i), ev) 418 let status: i64 = ev[0] 419 let missing: i64 = ev[2] 420 o = ss_cat(buf, o, "<tr><td class=rid>" as *u8); o = ss_cat(buf, o, sax_id(t, i)) 421 o = ss_cat(buf, o, "</td><td>" as *u8); o = ss_cat(buf, o, sax_name(t, i)) 422 o = ss_cat(buf, o, "</td><td><span class='b " as *u8) 423 var cls: *u8 = "su" as *u8 424 if missing == 0 { if status == 1 { cls = "sg" as *u8 } } 425 if missing == 0 { if status == 2 { cls = "sr" as *u8 } } 426 if missing == 0 { if status == 3 { cls = "sm" as *u8 } } 427 o = ss_cat(buf, o, cls) 428 o = ss_cat(buf, o, "'>" as *u8); o = ss_cat(buf, o, sax_status_label(status, kind, missing)) 429 o = ss_cat(buf, o, "</span></td><td>" as *u8) 430 if status == 3 { o = ss_catn(buf, o, ev[1]) } else { o = ss_cat(buf, o, "&mdash;" as *u8) } 431 o = ss_cat(buf, o, "</td><td class=src>" as *u8) 432 if kind != 0 { o = ss_cat(buf, o, sax_log(t, i)) } else { o = ss_cat(buf, o, "(no source yet -- honest hole)" as *u8) } 433 o = ss_cat(buf, o, "</td></tr>\n" as *u8) 434 i = i + 1 435 } 436 o = ss_cat(buf, o, "</table><footer>regenerated from knowledge/status/ evidence logs by nx_stackaudit_census &middot; statuses derived, never asserted &middot; epoch " as *u8) 437 o = ss_catn(buf, o, sys_now_realtime_sec()) 438 if verdict != 0 { o = ss_cat(buf, o, " &middot; <b style=color:#ff7b72>ANTI-ROT LIAR-KILL FIRED (expected evidence missing)</b>" as *u8) } 439 o = ss_cat(buf, o, "</footer></body></html>\n" as *u8) 440 ss_writefile(outhtml, buf, o) 441 return verdict 442}