nx_swcompare_matrix.nx source
↩ module page · 1681 lines · 135648 B
1// nx_swcompare_matrix.nx -- GENERIC, data-driven, liar-killed SoftwareCompare MATRIX generator. Reads
2// knowledge/compare/<domain>.matrix (label|organ|symbol|exceed|ONE CELL PER @cols ENTRY|note + @title/@sub/@cols directives),
3// MEASURES each Nishi cell by requiring the implementing symbol to EXIST in the real organ source on disk (no
4// self-grading), and emits a head-to-head SoftwareCompare page (Nishi + N named competitors, N = the @cols count, bounded only by SWC_ROW_STRIDE). Retires the
5// per-domain bespoke nx_swcompare_<domain> matrix organs: a new comparison = one .matrix data file, ZERO code.
6// Two modes: no html arg = console census + liar-kill gate (exit 0/1); "html" = emit the page to stdout.
7// NOTE: no '#' or '!' in string literals (nx_cc lexer trap) -> rgb() colors + DOCTYPE '!' emitted as a byte.
8// license_tier: ORIGINAL expect_exit: 0
9import "nx_syscalls.nx"
10import "nx_tool_run.nx"
11// CT-ADOPT (2026-09-04): the compare data tree is RESOLVED, never assumed. A bare
12// "knowledge/compare/" literal is CWD-RELATIVE, so this generator rendered only when its caller
13// had already chdir'd into buildroot and refused "MATRIX FILE MISSING" under every other launcher.
14// MEASURED that day: forking the PROMOTED elf from the serving root with ["procgen","html"] returned
15// MATRIX FILE MISSING for a domain whose .matrix is 45,033 bytes -- present, just in the other tree.
16// This is the estate's FIFTH rediscovery of that class; nx_comparetree_lib exists to end it.
17//
18// SCOPE DECLARED, BECAUSE THE HALF-FIX IS THE DANGEROUS ONE. Only the .matrix READ is resolved here.
19// FIVE sibling sites still carry the bare literal (.rank, .refs, .gallery, .plan, .gates) and each
20// treats absence as a byte-identical emit, so from a NON-buildroot CWD this generator now renders a
21// page that is missing those sections instead of refusing outright. A LOUD FATAL TURNED INTO A QUIET
22// DEGRADATION IS WORSE THAN THE FATAL, so it is fenced by declaration rather than left implicit:
23// ==> A RENDER PRODUCED FROM ANY CWD OTHER THAN buildroot IS A DIAGNOSTIC ARTIFACT AND MUST NOT BE
24// PUBLISHED. The publishing path is nx_compare_regen, which chdirs to buildroot first.
25// UNDER THAT PRODUCTION PATH THIS CHANGE IS A PROVABLE NO-OP: probe 1 is buildroot/buildroot/... which
26// can never resolve, and probe 2 is exactly the file the old bare literal read. One extra failed
27// openat per domain buys the CWD independence.
28// KNOWN BEHAVIOUR CHANGE, NOT HIDDEN: from CWD=nishihost the ~45 domains whose .matrix exists in BOTH
29// trees now grade the buildroot twin rather than the nishihost one. That is the correct direction --
30// .matrix is buildroot-owned -- but the twins differ (lang.matrix measured 9,532 B knowledge vs
31// 58,330 B buildroot, a superseded generation), so it is a different document, not the same one.
32// OWED: the five sibling sites, and .gates in particular CANNOT use this resolver -- its authored
33// order probes knowledge/ then buildroot/knowledge/, and from CWD=buildroot neither reaches
34// nishihost/knowledge/compare/ where the 54 .gates files actually live. That one needs da_read_2dir.
35import "nx_comparetree_lib.nx"
36const K_MAGIC_5381: i64 = 5381
37// GALLERY ARTIFACT PROBES (2026-08-18, operator: cards must DO something on the page): a .gallery row's
38// optional 5th field names an organ + verb; at EVERY emit the generator forks it against the row's own
39// docroot artifact and embeds the captured output under the figure -- measured at emit, refreshed on
40// every beat, the same law as the matrix cells (never seat-typed prose). rc!=0 or empty output is shown
41// honestly; output filling the reserve announces its truncation.
42const GAL_PROBE_CAP: i64 = 16384 // a probe's stdout reserve (kkfacts decode measures ~1.5KB); brim announces
43const GAL_PROBE_AV: i64 = 6 // elf + up to 3 spec tokens + artifact path + NUL
44const K_MAGIC_262144: i64 = 262144
45const K_MAGIC_20480: i64 = 20480
46const K_MAGIC_20479: i64 = 20479
47// COLUMN CAPACITY DERIVED FROM THE ROW SLOT WIDTH, NEVER GUESSED (2026-08-27, synthroom's seventh rival).
48// A parsed row is stored in SWC_ROW_STRIDE i64 slots: label|organ|symbol|exceed, ONE CELL PER DECLARED
49// @cols ENTRY, then the note -- so the column cap is the stride minus those five fixed fields, computed
50// in main() as max_cols. The literal 6 this replaces silently truncated a seven-entry @cols line to six
51// and then REFUSED every data row as an over-count (schema 11 against 12 fields): the generator's own
52// stray-pipe guard convicting a correct file, with no message naming the real cause.
53const SWC_ROW_STRIDE: i64 = 16
54const SWC_ROW_FIXED: i64 = 5
55
56
57import "nx_swcompare_lib.nx"
58// CE2 (2026-08-23): the estate's adoption ladder, ONE classifier shared with nx_catalog and nx_compare_rank
59import "nx_catalog_lib.nx"
60// ONE ASSEMBLER FOR EVERY DOMAIN (2026-09-02): the SOTA field (the N-peer grade grid, its measured bindings and
61// its census) is a lib pass composed here whenever knowledge/compare/<dom>.sota exists -- absent file =
62// byte-identical, the refs/gallery/bench precedent. Before this the sota-class pages were emitted by a
63// second generator with a second shape and lacked four of this page's sections (measured live 2026-09-02).
64import "nx_swcompare_sota_lib.nx"
65// ---- EC10 (2026-09-01, ecosystem rung): THE ADOPTION LADDER REACHES THE PAGE WHOLE ----
66// clb_classify computes a ten-state ladder per row and this generator collapsed it to FULL/PARTIAL before
67// any field, so DARK, UNPROMOTED, UNREGISTERED and SOURCE-ONLY -- the four classes the operator named --
68// were computed on every row and discarded. The histogram below buckets rows by the class TOKEN the
69// classifier itself returned, DATA-DRIVEN: no hardcoded token list to drift when the lib grows a verdict,
70// and no UNKNOWN bucket is possible because every token is its own bucket. Gate tokens embed a per-organ
71// trial count after a space (GATE:LIVE trial=3), so bucketing compares only up to the first space --
72// otherwise every gate would fragment into its own class and the histogram would be a row list wearing a
73// summary's name.
74const MXH_MAX: i64 = 64 // distinct class tokens; the ladder has 10 verdicts plus GATE: variants, and an overflow is COUNTED, never silent
75func mx_tokclass_len(s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { if s[i] == (32 as u8) { return i } i = i + 1 } return i }
76func mx_tokclass_eq(a: *u8, b: *u8) -> i64 {
77 let la: i64 = mx_tokclass_len(a)
78 if la != mx_tokclass_len(b) { return 0 }
79 var i: i64 = 0
80 while i < la { if a[i] != b[i] { return 0 } i = i + 1 }
81 return 1
82}
83// c_has / c_file_has (bare substring over the organ) were REMOVED 2026-08-23: presence is measured by
84// nx_symdecl_lib sd_declared (one ruler, shared with the ranker, the sota watch section and the
85// comparewatch plane). A substring rewarded a comment or a call site with a LANDED cell.
86func atoi(s: *u8) -> i64 {
87 var v: i64 = 0; var i: i64 = 0
88 while s[i] != (0 as u8) { let c: i64 = s[i] as i64; if c < 48 { break } if c > 57 { break } v = v * 10 + (c - 48); i = i + 1 }
89 return v
90}
91
92// PROVENANCE HASH (2026-08-07). The published artifact declares a content hash of the .matrix it was
93// generated FROM, so a consumer can decide staleness WITHOUT clocks: hash the current matrix, compare
94// to the published source_hash, and a mismatch means the page no longer reflects its source.
95// WHY NOT TIMESTAMPS: mtimes lie across copies (this tree has TWO knowledge/compare directories) and
96// clocks lie across machines. Content does not. A page that carries generated_unix alone can only tell
97// you WHEN it was made, never WHETHER it is current -- and /compare/doctor sat a month stale asserting
98// a sentence that had stopped being true, with a perfectly valid timestamp.
99// WHY djb2 AND NOT SHA-256: this detects DRIFT, not tampering, and it needs no crypto dependency in a
100// generator that has none. It catches the SAME-SIZE edit that a byte-count comparison is structurally
101// blind to, which is the case that actually bites. Masked to 48 bits so it is always a positive
102// JSON integer (i64 wraps silently here, so the raw accumulator can go negative).
103func swc_src_hash(b: *u8, n: i64) -> i64 {
104 var h: i64 = K_MAGIC_5381
105 var i: i64 = 0
106 while i < n { h = h * 33 + (b[i] as i64); i = i + 1 }
107 if h < 0 { h = 0 - h }
108 return h & 0xFFFFFFFFFFFF
109}
110
111// STATE MARK (2026-08-13, the blessed register): shape-first glyphs -- not words, not coloured chips.
112// Shape carries the state, so the matrix stays readable in the e-ink profile where colour carries nothing.
113// The entity is assembled with wc(35) because a literal '#' inside a string is an nx_cc lexer trap.
114func mark(fd: i64, code: i64) -> i64 {
115 w(fd, "<span class='g" as *u8)
116 if code == 0 { w(fd, " off" as *u8) }
117 if code == 3 { w(fd, " half" as *u8) }
118 w(fd, "'>&" as *u8); wc(fd, 35)
119 if code == 2 { w(fd, "9673;" as *u8) } else { if code == 1 { w(fd, "9679;" as *u8) } else { if code == 3 { w(fd, "9680;" as *u8) } else { w(fd, "9675;" as *u8) } } }
120 w(fd, "</span>" as *u8)
121 return 0
122}
123// one matrix cell: the mark plus the word in the title attr, so hover and screen readers get prose
124// while the grid stays scannable.
125func mark_td(fd: i64, name: *u8, code: i64, nishi: i64) -> i64 {
126 if nishi == 1 { w(fd, "<td class='ni' title='" as *u8) } else { w(fd, "<td title='" as *u8) }
127 w(fd, name); w(fd, ": " as *u8)
128 if code == 2 { w(fd, "leads" as *u8) } else { if code == 1 { w(fd, "present" as *u8) } else { if code == 3 { w(fd, "partial" as *u8) } else { w(fd, "absent" as *u8) } } }
129 w(fd, "'>" as *u8)
130 mark(fd, code)
131 w(fd, "</td>" as *u8)
132 return 0
133}
134// ---- PROS / CONS STRIP, DERIVED (2026-09-05; operator: "make the compare more intelligent, pros vs cons,
135// instead of single shaping everything"). Every row used to render as a glyph strip plus a raw adoption
136// token styled like a badge: a human could not read it, and a PARTIAL adoption read as a positive. This
137// strip is DERIVED from the same data the cells are drawn from -- nothing typed by a seat -- and it signs
138// every fact: what Nishi has, whom it is ahead of, whom it is behind, whether the contract is still open,
139// and the catalog lib's own remedy phrase where adoption is partial. Rival marks are documented presence,
140// so a row Nishi holds over every rival says "no measured con", never a victory claim.
141func pc_pts(code: i64) -> i64 { if code == 2 { return 3 } if code == 1 { return 2 } if code == 3 { return 1 } return 0 }
142func pc_strip(fd: i64, nishi: i64, exceed: i64, iswatch: i64, adopt: i64, rem: *u8, cf: *i64, ncol: i64, rf: *i64, rr: i64) -> i64 {
143 let np: i64 = pc_pts(nishi)
144 w(fd, "<div class='pc'><span class='pro'><b>Pros</b> " as *u8)
145 var pros: i64 = 0
146 if nishi == 2 { w(fd, "Nishi leads, a measured exceed" as *u8); pros = pros + 1 }
147 if nishi == 1 { w(fd, "Nishi has it, measured on disk" as *u8); pros = pros + 1 }
148 if nishi == 3 { w(fd, "Nishi has it in part" as *u8); pros = pros + 1 }
149 var ahead: i64 = 0
150 var cj: i64 = 0
151 while cj < ncol {
152 let rp: i64 = pc_pts(atoi(rf[rr*SWC_ROW_STRIDE + 4 + cj] as *u8))
153 if np > rp {
154 if ahead == 0 { if pros > 0 { w(fd, "; " as *u8) } w(fd, "ahead of " as *u8) } else { w(fd, ", " as *u8) }
155 w(fd, cf[cj] as *u8)
156 ahead = ahead + 1
157 }
158 cj = cj + 1
159 }
160 if ahead > 0 { pros = pros + 1 }
161 if adopt == CLB_FULL { if pros > 0 { w(fd, "; " as *u8) } w(fd, "fully adopted on the estate ladder" as *u8); pros = pros + 1 }
162 if pros == 0 { w(fd, "none measured yet" as *u8) }
163 w(fd, "</span><span class='con'><b>Cons</b> " as *u8)
164 var cons: i64 = 0
165 var behind: i64 = 0
166 cj = 0
167 while cj < ncol {
168 let rp2: i64 = pc_pts(atoi(rf[rr*SWC_ROW_STRIDE + 4 + cj] as *u8))
169 if rp2 > np {
170 if behind == 0 { w(fd, "behind " as *u8) } else { w(fd, ", " as *u8) }
171 w(fd, cf[cj] as *u8)
172 if rp2 == 3 { w(fd, " (leads)" as *u8) }
173 behind = behind + 1
174 }
175 cj = cj + 1
176 }
177 if behind > 0 { cons = cons + 1 }
178 if iswatch == 1 {
179 if cons > 0 { w(fd, "; " as *u8) }
180 w(fd, "open contract, nothing on disk yet" as *u8)
181 cons = cons + 1
182 } else {
183 if nishi == 0 { if cons > 0 { w(fd, "; " as *u8) } w(fd, "no implementing organ measured" as *u8); cons = cons + 1 }
184 }
185 if adopt == CLB_PARTIAL { if cons > 0 { w(fd, "; " as *u8) } w(fd, "not adopted yet: " as *u8); w(fd, rem); cons = cons + 1 }
186 if cons == 0 { w(fd, "none on the measured axes (rival marks are documented presence, not depth)" as *u8) }
187 w(fd, "</span></div>" as *u8)
188 return 0
189}
190// ---- ROADMAP LAYERS, FROM DATA (2026-08-13) -------------------------------------------------------
191// knowledge/compare/<dom>.plan carries the executive answer and the dependency-ordered path as ROWS:
192// pos|.. goal|.. unit|.. answer|<label>|<figure>|<text> bar|<name>|<url>|<measures>|<theirs>|<ours>
193// rung|<id>|<title>|<contract>|<done-rule>|<executor>|<est>|<deps> ms|<id>|<label>|<cum>|<rungs>
194// A domain WITHOUT the file emits the matrix alone, byte-for-byte as before -- the other 39 domains are
195// untouched by construction, so this ships without a fleet-wide risk.
196// The file is RE-READ per phase because splitpipe NUL-terminates in place and would eat a second pass.
197// Print what the DEBT PLANE says about an id: open, eaten, or not filed there at all. The state file is
198// `id<TAB>state` per line, refreshed by the regen before any page is emitted.
199// dstate LIFTED to nx_swcompare_lib.nx 2026-08-22 (DG5) -- the base class owns it now so plan_pass can
200// reach it from either generator. This body is the pre-lift copy, kept ONLY until the byte-compare below
201// is banked; it is unreachable (nothing calls this name).
202func dstate_REMOVED_SEE_LIB(fd: i64, id: *u8, ds: *u8, dn: i64) -> i64 {
203 if dn <= 0 { return 0 }
204 var i: i64 = 0
205 while i < dn {
206 var e: i64 = i
207 while e < dn { if ds[e] == (10 as u8) { break } e = e + 1 }
208 var k: i64 = 0
209 var ok: i64 = 1
210 var stop: i64 = 0
211 while stop == 0 {
212 if i + k >= e { stop = 1 } else {
213 let c: i64 = ds[i+k] as i64
214 if c == 9 { stop = 1 } else {
215 let ic: i64 = id[k] as i64
216 if ic == 0 { ok = 0; stop = 1 } else { if ic != c { ok = 0; stop = 1 } else { k = k + 1 } }
217 }
218 }
219 }
220 if ok == 1 { if (id[k] as i64) == 0 {
221 var s: i64 = i + k
222 if s < e { if ds[s] == (9 as u8) { s = s + 1 } }
223 w(fd, "<span class='pstate'>" as *u8)
224 var q: i64 = s
225 while q < e { wc(fd, ds[q] as i64); q = q + 1 }
226 w(fd, "</span>" as *u8)
227 return 1
228 } }
229 i = e + 1
230 }
231 // ⚠NOT "not filed". The lookup is scoped to THIS domain, so a debt filed under another scope (the
232 // decode-path row lives under graphics) is absent here while being perfectly real in the plane.
233 // Saying "not filed" would have published a false negative about a colleague's open work.
234 w(fd, "<span class='pstate note'>not in this scope</span>" as *u8)
235 return 0
236}
237// CITATIONS AS DATA (2026-08-17, operator: the /compare publish should carry a true research paper's
238// citations in a beyond-arxiv way). knowledge/compare/<dom>.refs rows:
239// ref|<key>|<citation prose>|<url>|<library mirror or ->|<content pin or ->|<accessed or ->|<evidence class>|<grounds>
240// BEYOND ARXIV = every reference resolves TWICE: the publisher's copy AND the estate's non-rottable
241// library mirror with a content pin, plus the evidence class and the exact claim it grounds -- a dead
242// publisher link cannot rot the reference, and a reader grades the evidence without leaving the page.
243// A domain without a .refs file emits BYTE-IDENTICALLY (the plan_pass neutrality pattern); inline
244// [@key] marks in notes render as keyed cites, and no pre-existing note carries that token.
245// PUBLISH-THEN-LINK (2026-08-17, operator: "i cant click on the links to the papers to read them in our
246// library"). knowledge/library has NO public route -- /library is the login-gated book reader -- so a
247// mirror path rendered as text was provenance without a door. The emitter now PUBLISHES each cited mirror
248// file into the domain's own docroot (refs/<basename>, static visitor content, atomic tmp+rename via
249// sys_read_file which sizes from the file and cannot short-read) and links THERE. Fail-safe direction: a
250// mirror it cannot read or fully write renders as plain text -- a dead link is never emitted.
251// The References preamble is the ONE thing this generator and nx_swcompare_sota did not share in rp_html
252// (h2 class + the phrase naming the notes). It is a per-generator DATUM now, so the row-emit body is
253// byte-identical across both and nx_oo_extract can move it to the shared lib.
254const RP_HDR: *u8 = "<h3 id='refs'>References</h3>\n<div class='meth'><b>Beyond a link list.</b> Every reference below resolves twice — the publisher's copy and, where banked, the estate's own <b>non-rottable library mirror</b> with a <b>content pin</b> — and carries its <b>evidence class</b> plus the exact claim on this page it grounds. Keyed marks like <span class='cite'>[key]</span> in the matrix notes jump here. A dash means honestly absent, never assumed.</div>\n<ol class='refs'>\n" as *u8
255// rp_html lives in nx_swcompare_lib.nx since 2026-08-23 (one copy; header passed as RP_HDR).
256// ---- RENDERED-EVIDENCE GALLERY (2026-08-18, operator: the turntable and renders must ride the
257// emit, never a hand page). knowledge/compare/<dom>.gallery rows img|<file>|<caption>|<producer>
258// become an evidence strip. PUBLISH-THEN-LINK, the refs_pass law: each file is probed IN THE DOMAIN
259// DOCROOT at emit time -- present emits the figure with its measured byte size; absent emits a NAMED
260// absence and never a dead link. A domain without a .gallery file emits byte-identically.
261func gp_probe(dom: *u8, file: *u8) -> i64 {
262 let p: *u8 = sys_mmap(700)
263 var o: i64 = scopy(p, 0, "../sites/nishifamily/compare/" as *u8)
264 o = scopy(p, o, dom); o = scopy(p, o, "/" as *u8); o = scopy(p, o, file); p[o] = 0 as u8
265 let ln: *i64 = sys_mmap(16) as *i64
266 let b: *u8 = sys_read_file(p, ln)
267 if (b as i64) == 0 { return 0 - 1 }
268 let sz: i64 = ln[0]
269 sys_free_file(b, sz)
270 return sz
271}
272// html-escape n bytes while writing (probe output is untrusted bytes, never raw-embedded)
273func wesc(fd: i64, b: *u8, n: i64) -> i64 {
274 var i: i64 = 0
275 while i < n {
276 let c: i64 = b[i] as i64
277 if c == 60 { w(fd, "<" as *u8) } else { if c == 62 { w(fd, ">" as *u8) } else { if c == 38 { w(fd, "&" as *u8) } else { wc(fd, c) } } }
278 i = i + 1
279 }
280 return 0
281}
282// fork the row's probe against its docroot artifact; returns rc, output in pbuf/plen.
283// The spec string is split IN PLACE (each gal_pass call re-reads the data file, so per-row once).
284func gal_probe_run(probe: *u8, dom: *u8, file: *u8, pbuf: *u8, plen: *i64) -> i64 {
285 let av: *i64 = sys_mmap(GAL_PROBE_AV * 8) as *i64
286 var an: i64 = 0
287 var ps: i64 = 0
288 while probe[ps] != (0 as u8) {
289 if an >= GAL_PROBE_AV - 2 { break }
290 av[an] = (probe as i64) + ps
291 an = an + 1
292 while probe[ps] != (0 as u8) { if probe[ps] == (32 as u8) { break } ps = ps + 1 }
293 if probe[ps] == (32 as u8) { probe[ps] = 0 as u8; ps = ps + 1 }
294 }
295 let fpath: *u8 = sys_mmap(700)
296 var fo: i64 = scopy(fpath, 0, "../sites/nishifamily/compare/" as *u8)
297 fo = scopy(fpath, fo, dom); fo = scopy(fpath, fo, "/" as *u8); fo = scopy(fpath, fo, file)
298 fpath[fo] = 0 as u8
299 av[an] = fpath as i64
300 an = an + 1
301 av[an] = 0
302 return tr_run_capture(av[0] as *u8, av, pbuf, GAL_PROBE_CAP, plen)
303}
304// ---- EVIDENCE MEDIA KINDS (2026-09-02, operator: "real reproducible evidence that's human evaluatable ...
305// visuals to click open (in case some are nsfw) ... images or video or text or gif or audio"). A .gallery row's
306// first field was the literal `img`; it is now a KIND with an optional gate prefix:
307// img | gif | video | audio | text inline media (gif is an img), each probed on disk at emit
308// nsfw:<kind> GATED: nothing is rendered inline -- the reader clicks to open
309// The four evidence facts every row already carries (the artifact path, its caption, the producing organ, the
310// bytes on disk at emit, and the optional probe re-run at emit) are what make the evidence REPRODUCIBLE; the
311// gate only changes whether the media is shown before a click. A kind this table does not know is REFUSED
312// by name (the row is skipped and announced), never guessed into an <img>.
313const GAL_KIND_IMG: i64 = 1
314const GAL_KIND_VIDEO: i64 = 2
315const GAL_KIND_AUDIO: i64 = 3
316const GAL_KIND_TEXT: i64 = 4
317const GAL_TEXT_PREVIEW: i64 = 2048 // bytes of a text artifact shown inline; the whole file stays one click away
318const GAL_NSFW_PREFIX: *u8 = "nsfw:" as *u8
319func gal_kind_code(k: *u8) -> i64 {
320 if streq(k, "img" as *u8) == 1 { return GAL_KIND_IMG }
321 if streq(k, "gif" as *u8) == 1 { return GAL_KIND_IMG }
322 if streq(k, "video" as *u8) == 1 { return GAL_KIND_VIDEO }
323 if streq(k, "audio" as *u8) == 1 { return GAL_KIND_AUDIO }
324 if streq(k, "text" as *u8) == 1 { return GAL_KIND_TEXT }
325 return 0
326}
327func gal_kind_name(c: i64) -> *u8 {
328 if c == GAL_KIND_IMG { return "image" as *u8 }
329 if c == GAL_KIND_VIDEO { return "video" as *u8 }
330 if c == GAL_KIND_AUDIO { return "audio" as *u8 }
331 if c == GAL_KIND_TEXT { return "text" as *u8 }
332 return "unknown" as *u8
333}
334// attribute-safe write: the src of a video/audio/text link is built from DATA (domain + file name), and a
335// quote inside it would end the attribute -- the same hole ia_img_emit closed for img alt on 2026-08-26.
336func gal_attr(fd: i64, s: *u8) -> i64 {
337 var i: i64 = 0
338 while s[i] != (0 as u8) {
339 let c: i64 = s[i] as i64
340 if c == 39 { w(fd, "'" as *u8) } else { if c == 34 { w(fd, """ as *u8) } else {
341 if c == 60 { w(fd, "<" as *u8) } else { if c == 62 { w(fd, ">" as *u8) } else {
342 if c == 38 { w(fd, "&" as *u8) } else { wc(fd, c) } } } } }
343 i = i + 1
344 }
345 return 0
346}
347// the first GAL_TEXT_PREVIEW bytes of a text artifact, escaped; announces when the file is longer
348func gal_text_preview(fd: i64, dom: *u8, file: *u8) -> i64 {
349 let p: *u8 = sys_mmap(700)
350 var o: i64 = scopy(p, 0, "../sites/nishifamily/compare/" as *u8)
351 o = scopy(p, o, dom); o = scopy(p, o, "/" as *u8); o = scopy(p, o, file); p[o] = 0 as u8
352 let ln: *i64 = sys_mmap(16) as *i64
353 let b: *u8 = sys_read_file(p, ln)
354 if (b as i64) == 0 { w(fd, "(unreadable at emit)" as *u8); return 0 }
355 let sz: i64 = ln[0]
356 var show: i64 = sz
357 if show > GAL_TEXT_PREVIEW { show = GAL_TEXT_PREVIEW }
358 wesc(fd, b, show)
359 if sz > show { w(fd, "\n[preview: first " as *u8); wn(fd, show); w(fd, " of " as *u8); wn(fd, sz); w(fd, " bytes -- open the artifact for the whole file]" as *u8) }
360 sys_free_file(b, sz)
361 return 0
362}
363// The extra attributes on a gallery img are the GENERATOR'S OWN markup, never data, so they are
364// passed to ia_img_emit as literal bytes and deliberately not escaped.
365const GAL_IMG_EXTRA: *u8 = "loading='lazy'" as *u8
366
367// figcaption and the producer note are TEXT, not attribute values. The two contexts have different
368// rules -- escaping a quote in text puts a visible entity on the page -- so this routes through the
369// TEXT half of the one escaper rather than reusing the attribute half. Sized from the string itself,
370// so there is no ceiling here to guess and none to truncate.
371func gal_text(fd: i64, s: *u8) -> i64 {
372 let need: i64 = ia_slen(s) * IA_MAX_EXPANSION + IA_SEP_AND_NUL
373 let b: *u8 = sys_mmap(need)
374 let tr: *i64 = sys_mmap(IA_SLOT_BYTES) as *i64
375 ia_esc_text(b, 0, s, need, tr)
376 w(fd, b)
377 return 0
378}
379
380func gal_html(fld: *i64, count: i64, dom: *u8, probe: *u8, kind: i64, gated: i64) -> i64 { return gal_html_heading(fld, count, dom, probe, kind, gated, 2) }
381func gal_html_heading(fld: *i64, count: i64, dom: *u8, probe: *u8, kind: i64, gated: i64, heading_level: i64) -> i64 {
382 if count == 0 {
383 sc_heading_open(1, heading_level, " id='renders'" as *u8); w(1, "Rendered evidence" as *u8); sc_heading_close(1, heading_level); w(1, "\n" as *u8)
384 w(1, "<div class='meth'><b>These are the artifacts, not illustrations.</b> Every image, video, audio clip or text artifact below was probed <b>on disk at emit time</b> and carries its measured byte size plus the organ that regenerates it; a row marked gated renders nothing until you click it open; an absent file is named as absent and never linked. Re-run the producer and the page inherits the fresh render on the next compare beat.</div>\n<div class='gal'>\n" as *u8)
385 }
386 if kind == 0 {
387 w(1, "<div class='galmiss' data-t='refused'>row refused: unknown media kind <code>" as *u8); gal_text(1, fld[0] as *u8); w(1, "</code> for <code>" as *u8); gal_text(1, fld[1] as *u8); w(1, "</code> (img gif video audio text, optionally nsfw:kind) -- nothing is linked for a row the emitter cannot classify.</div>
388" as *u8)
389 return 0
390 }
391 let sz: i64 = gp_probe(dom, fld[1] as *u8)
392 if sz >= 0 {
393 // src MUST be site-absolute: the page serves at an extensionless URL with NO trailing slash
394 // (/compare/<dom>), so a relative src resolves against /compare/ and 404s -- the hand pages
395 // used absolute paths for exactly this reason. ../.. rows normalize client-side (/world/...).
396 // THE TAG IS BUILT BY nx_imgattr_lib, NOT CONCATENATED HERE (2026-08-26). The caption is DATA,
397 // and a row live on /compare/koikatsu carries an apostrophe: written raw into a single-quoted
398 // attribute it ended alt at the two words -The card- and turned the rest of the sentence into
399 // attribute names, so the accessible name of that image was two words and loading='lazy' was
400 // consumed with it. ia_img_emit escapes both quote characters whatever delimiter is used and
401 // REFUSES to write a tag with no usable alt, so this call site cannot re-open the hole.
402 let srcneed: i64 = ia_slen("/compare/" as *u8) + ia_slen(dom) + ia_slen(fld[1] as *u8) + IA_SEP_AND_NUL
403 let gsrc: *u8 = sys_mmap(srcneed)
404 var gso: i64 = scopy(gsrc, 0, "/compare/" as *u8)
405 gso = scopy(gsrc, gso, dom); gso = scopy(gsrc, gso, "/" as *u8); gso = scopy(gsrc, gso, fld[1] as *u8)
406 gsrc[gso] = 0 as u8
407 let altcap: i64 = ia_alt_cap_for(fld[2] as *u8, fld[1] as *u8)
408 let galt: *u8 = sys_mmap(altcap)
409 ia_alt_derive(fld[2] as *u8, fld[1] as *u8, galt, altcap)
410 let tagcap: i64 = ia_img_cap_for(gsrc, galt, GAL_IMG_EXTRA)
411 let gtag: *u8 = sys_mmap(tagcap)
412 let gtw: i64 = ia_img_emit(gtag, 0, tagcap, gsrc, galt, GAL_IMG_EXTRA)
413 w(1, "<figure class='galf' data-t='" as *u8); wlow(1, fld[2] as *u8); wc(1, 32); wlow(1, fld[3] as *u8)
414 w(1, "' data-kind='" as *u8); w(1, gal_kind_name(kind)); w(1, "'>" as *u8)
415 // GATED EVIDENCE: nothing is rendered before the click. The summary names the kind and the size so a
416 // reader decides with the facts; the media inside is exactly what an ungated row would have shown.
417 if gated == 1 { w(1, "<details class='galgate'><summary>gated evidence — click to open (" as *u8); w(1, gal_kind_name(kind)); w(1, ", " as *u8); wn(1, sz); w(1, " bytes on disk, may be NSFW)</summary>" as *u8) }
418 if kind == GAL_KIND_IMG {
419 if gtw > 0 { w(1, gtag) }
420 if gtw == 0 { w(1, "<div class='galmiss'>no alt could be derived from this row, so no image is emitted: an image no reader can have described is not published here. Give the row a caption.</div>" as *u8) }
421 }
422 if kind == GAL_KIND_VIDEO { w(1, "<video class='galv' controls preload='none' src='" as *u8); gal_attr(1, gsrc); w(1, "'>your browser cannot play this video; <a href='" as *u8); gal_attr(1, gsrc); w(1, "'>open the artifact</a></video>" as *u8) }
423 if kind == GAL_KIND_AUDIO { w(1, "<audio class='gala' controls preload='none' src='" as *u8); gal_attr(1, gsrc); w(1, "'>your browser cannot play this audio; <a href='" as *u8); gal_attr(1, gsrc); w(1, "'>open the artifact</a></audio>" as *u8) }
424 if kind == GAL_KIND_TEXT { w(1, "<p class='galt'><a href='" as *u8); gal_attr(1, gsrc); w(1, "'>open the text artifact</a></p><pre class='galpre'>" as *u8); gal_text_preview(1, dom, fld[1] as *u8); w(1, "</pre>" as *u8) }
425 if gated == 1 { w(1, "</details>" as *u8) }
426 w(1, "<figcaption>" as *u8); gal_text(1, fld[2] as *u8)
427 w(1, "<span class='galp'>" as *u8); gal_text(1, fld[3] as *u8); w(1, " · " as *u8); wn(1, sz); w(1, " bytes on disk at emit</span></figcaption>" as *u8)
428 if (probe as i64) != 0 {
429 let pbuf: *u8 = sys_mmap(GAL_PROBE_CAP)
430 let plen: *i64 = sys_mmap(16) as *i64
431 let prc: i64 = gal_probe_run(probe, dom, fld[1] as *u8, pbuf, plen)
432 w(1, "<details class='galprobe'><summary>measured at emit</summary><pre>" as *u8)
433 if prc == 0 { if plen[0] > 0 { wesc(1, pbuf, plen[0]) } else { w(1, "probe returned no output" as *u8) } } else { w(1, "probe refused rc=" as *u8); wn(1, prc) }
434 if plen[0] >= GAL_PROBE_CAP { w(1, "[probe output filled its reserve -- view truncated, announced]" as *u8) }
435 w(1, "</pre></details>" as *u8)
436 }
437 w(1, "</figure>\n" as *u8)
438 } else {
439 w(1, "<div class='galmiss' data-t='" as *u8); wlow(1, fld[2] as *u8); wc(1, 32); wlow(1, fld[3] as *u8)
440 w(1, "'>absent from the docroot at emit: <code>" as *u8); gal_text(1, fld[1] as *u8)
441 w(1, "</code> — regenerate with <code>" as *u8); gal_text(1, fld[3] as *u8); w(1, "</code>; nothing is linked while it is absent.</div>\n" as *u8)
442 }
443 return 0
444}
445func gal_json(fld: *i64, count: i64, dom: *u8, probe: *u8, kind: i64, gated: i64) -> i64 {
446 if count == 0 { wc(1, 44); wq(1); w(1, "gallery" as *u8); wq(1); wc(1, 58); wc(1, 91) } else { wc(1, 44) }
447 wc(1, 123)
448 if kind == 0 { kv_s(1, "kind" as *u8, "unknown" as *u8); wc(1, 44); kv_s(1, "refused" as *u8, fld[0] as *u8); wc(1, 44); kv_s(1, "file" as *u8, fld[1] as *u8); wc(1, 125); return 0 }
449 kv_s(1, "kind" as *u8, gal_kind_name(kind)); wc(1, 44)
450 kv_n(1, "gated" as *u8, gated); wc(1, 44)
451 kv_s(1, "file" as *u8, fld[1] as *u8); wc(1, 44)
452 kv_s(1, "caption" as *u8, fld[2] as *u8); wc(1, 44)
453 kv_s(1, "producer" as *u8, fld[3] as *u8); wc(1, 44)
454 kv_n(1, "bytes" as *u8, gp_probe(dom, fld[1] as *u8))
455 if (probe as i64) != 0 {
456 let pbuf: *u8 = sys_mmap(GAL_PROBE_CAP)
457 let plen: *i64 = sys_mmap(16) as *i64
458 let prc: i64 = gal_probe_run(probe, dom, fld[1] as *u8, pbuf, plen)
459 wc(1, 44); kv_n(1, "probe_rc" as *u8, prc)
460 var pn: i64 = plen[0]
461 if pn >= GAL_PROBE_CAP { pn = GAL_PROBE_CAP - 1 }
462 pbuf[pn] = 0 as u8
463 wc(1, 44); kv_s(1, "probe_output" as *u8, pbuf)
464 }
465 wc(1, 125)
466 return 0
467}
468func gal_pass(path: *u8, buf: *u8, cap: i64, mode: i64, dom: *u8) -> i64 { return gal_pass_heading(path, buf, cap, mode, dom, 2) }
469func gal_pass_heading(path: *u8, buf: *u8, cap: i64, mode: i64, dom: *u8, heading_level: i64) -> i64 {
470 let n: i64 = c_read(path, buf, cap)
471 if n <= 0 { return 0 }
472 buf[n] = 0 as u8
473 let fld: *i64 = sys_mmap(200) as *i64
474 var count: i64 = 0
475 var p: i64 = 0
476 while p < n {
477 var e: i64 = p
478 while e < n { if buf[e] == (10 as u8) { break } e = e + 1 }
479 buf[e] = 0 as u8
480 let line: *u8 = (buf as i64 + p) as *u8
481 p = e + 1
482 var skip: i64 = 0
483 if line[0] == (0 as u8) { skip = 1 }
484 if line[0] == (35 as u8) { skip = 1 }
485 if skip == 0 {
486 let nf: i64 = splitpipe(line, fld, 8)
487 var ktok: *u8 = fld[0] as *u8
488 var gated: i64 = 0
489 if starts(ktok, GAL_NSFW_PREFIX) == 1 { gated = 1; ktok = (ktok as i64 + 5) as *u8 }
490 let kind: i64 = gal_kind_code(ktok)
491 if kind == 0 { if nf >= 4 { if mode == 0 { w(1, " GALLERY ROW REFUSED: unknown media kind '" as *u8); w(1, ktok); w(1, "' (img gif video audio text, optionally nsfw:<kind>)\n" as *u8) } } }
492 if nf >= 4 {
493 var probe: *u8 = 0 as *u8
494 if nf >= 5 { probe = fld[4] as *u8 }
495 if mode == 1 { gal_html_heading(fld, count, dom, probe, kind, gated, heading_level) }
496 if mode == 2 { gal_json(fld, count, dom, probe, kind, gated) }
497 count = count + 1
498 }
499 }
500 }
501 if count > 0 { if mode == 1 { w(1, "</div>\n" as *u8) } else { if mode == 2 { wc(1, 93) } } }
502 return count
503}
504// plan_pass, dstate and wlow LIFTED to nx_swcompare_lib.nx 2026-08-22 (rung DG5). They lived HERE, which
505// is why a domain rendered by the SOTA generator had its .plan admitted as data and then NEVER DRAWN --
506// the tool plane's own build order was invisible on its own page. The base class owns them now and BOTH
507// generators call the one copy, so the two surfaces cannot drift into two plan dialects. The pre-lift
508// body below is the PRE-LIFT COPY and is UNREACHABLE -- nothing calls this name, and nx_cc now refuses
509// two definitions of one name outright, so it cannot shadow the base class copy either.
510// IT IS RETAINED DELIBERATELY: deleting an 85-line body by exact-match over a transport that is 503ing
511// risks corrupting the generator that emits EVERY /compare page, and removing dead code does not justify
512// that risk. Delete it on a calm transport, or via nx_oo_extract which owns removal with a byte proof.
513func plan_pass_PRELIFT_UNREACHABLE(path: *u8, buf: *u8, cap: i64, phase: i64) -> i64 {
514 let n: i64 = c_read(path, buf, cap)
515 if n <= 0 { return 0 }
516 buf[n] = 0 as u8
517 let fld: *i64 = sys_mmap(200) as *i64
518 let dsbuf: *u8 = sys_mmap(K_MAGIC_20480)
519 var dsn: i64 = 0
520 if phase == 3 {
521 let dsp: *u8 = sys_mmap(600)
522 var dq: i64 = 0
523 while path[dq] != (0 as u8) { dsp[dq] = path[dq]; dq = dq + 1 }
524 var cut: i64 = dq
525 while cut > 0 { if dsp[cut] == (46 as u8) { break } cut = cut - 1 }
526 if cut > 0 { dq = cut }
527 dq = scopy(dsp, dq, ".debtstate" as *u8)
528 dsp[dq] = 0 as u8
529 dsn = c_read(dsp, dsbuf, K_MAGIC_20479)
530 if dsn < 0 { dsn = 0 }
531 }
532 var in_rung: i64 = 0
533 var in_ms: i64 = 0
534 var in_biz: i64 = 0
535 var p: i64 = 0
536 while p < n {
537 var e: i64 = p
538 while e < n { if buf[e] == (10 as u8) { break } e = e + 1 }
539 buf[e] = 0 as u8
540 let line: *u8 = (buf as i64 + p) as *u8
541 p = e + 1
542 var skip: i64 = 0
543 if line[0] == (0 as u8) { skip = 1 }
544 if line[0] == (35 as u8) { skip = 1 }
545 if skip == 0 {
546 let nf: i64 = splitpipe(line, fld, 20)
547 let kind: *u8 = fld[0] as *u8
548 if phase == 1 {
549 if streq(kind, "pos" as *u8) == 1 { if nf >= 2 { w(1, "<p class='lead'><b>Where we are.</b> " as *u8); wnote(1, fld[1] as *u8); w(1, "</p>\n" as *u8) } }
550 if streq(kind, "goal" as *u8) == 1 { if nf >= 2 { w(1, "<p class='lead'><b>Where we need to go.</b> " as *u8); wnote(1, fld[1] as *u8); w(1, "</p>\n" as *u8) } }
551 if streq(kind, "answer" as *u8) == 1 { if nf >= 4 {
552 w(1, "<div class='answer'><b>" as *u8); w(1, fld[1] as *u8); w(1, ": " as *u8); w(1, fld[2] as *u8); w(1, ".</b> " as *u8); wnote(1, fld[3] as *u8); w(1, "</div>\n" as *u8) } }
553 if streq(kind, "bar" as *u8) == 1 { if nf >= 6 {
554 w(1, "<p class='lead'><b>Research bar.</b> <a href='" as *u8); w(1, fld[2] as *u8); w(1, "'>" as *u8); w(1, fld[1] as *u8); w(1, "</a> is measured on " as *u8); w(1, fld[3] as *u8)
555 w(1, ". Theirs: <b>" as *u8); w(1, fld[4] as *u8); w(1, "</b>. Ours: " as *u8); w(1, fld[5] as *u8); w(1, ".</p>\n" as *u8) } }
556 if streq(kind, "unit" as *u8) == 1 { if nf >= 2 { w(1, "<div class='meth'><b>The unit.</b> " as *u8); w(1, fld[1] as *u8); w(1, "</div>\n" as *u8) } }
557 // biz|axis|position|figures|decision -- the BUSINESS CASE row kind (investment, opportunity
558 // cost, market, competitive position, go-to-market, buy-vs-build). Rendered as one table in
559 // the executive layer; biz rows belong LAST in a plan's phase-1 block so the table closes clean.
560 if streq(kind, "biz" as *u8) == 1 { if nf >= 5 {
561 if in_biz == 0 { w(1, "<h2>Business case</h2>\n<table class='pl'><thead><tr><th>Axis</th><th>Position</th><th>Figures</th><th>Decision</th></tr></thead><tbody>\n" as *u8); in_biz = 1 }
562 w(1, "<tr><td><b>" as *u8); w(1, fld[1] as *u8); w(1, "</b></td><td>" as *u8); wnote(1, fld[2] as *u8)
563 w(1, "</td><td class='ct'>" as *u8); wnote(1, fld[3] as *u8); w(1, "</td><td>" as *u8); wnote(1, fld[4] as *u8); w(1, "</td></tr>\n" as *u8) } }
564 }
565 if phase == 3 {
566 if streq(kind, "debt" as *u8) == 1 { if nf >= 5 {
567 if in_rung == 0 { w(1, "<h2>Debt register</h2>\n<table class='pl'><thead><tr><th>Id</th><th class='r'>Sev</th><th>What it is</th><th>Unblock</th></tr></thead><tbody>\n" as *u8); in_rung = 1 }
568 w(1, "<tr><td class='ct'>" as *u8); w(1, fld[1] as *u8)
569 // STATE COMES FROM THE PLANE, NEVER FROM THIS ROW. An id the plane does not know is a
570 // page-local note wearing the shape of a filed debt, and saying so is the honest move.
571 dstate(1, fld[1] as *u8, dsbuf, dsn)
572 w(1, "</td><td class='r'>" as *u8); w(1, fld[2] as *u8)
573 w(1, "</td><td>" as *u8); w(1, fld[3] as *u8); w(1, "</td><td>" as *u8); w(1, fld[4] as *u8); w(1, "</td></tr>\n" as *u8) } }
574 if streq(kind, "risk" as *u8) == 1 { if nf >= 4 {
575 if in_rung == 1 { w(1, "</tbody></table>\n" as *u8); in_rung = 0 }
576 if in_ms == 0 { w(1, "<h2>Risk register</h2>\n<table class='pl'><thead><tr><th>Risk</th><th>Likelihood x impact</th><th>Mitigation</th></tr></thead><tbody>\n" as *u8); in_ms = 1 }
577 w(1, "<tr><td>" as *u8); w(1, fld[1] as *u8); w(1, "</td><td class='ct'>" as *u8); w(1, fld[2] as *u8)
578 w(1, "</td><td>" as *u8); w(1, fld[3] as *u8); w(1, "</td></tr>\n" as *u8) } }
579 }
580 if phase == 2 {
581 if streq(kind, "rung" as *u8) == 1 { if nf >= 8 {
582 if in_rung == 0 { w(1, "<table class='pl'><thead><tr><th>Rung</th><th>Closes with</th><th>Definition of done (pre-declared)</th><th>Executor</th><th class='r'>Est.</th></tr></thead><tbody>\n" as *u8); in_rung = 1 }
583 w(1, "<tr id='" as *u8); wlow(1, fld[1] as *u8); w(1, "'><td><b>" as *u8); w(1, fld[2] as *u8); w(1, "</b> (" as *u8); w(1, fld[1] as *u8); w(1, ")" as *u8)
584 if streq(fld[7] as *u8, "-" as *u8) == 0 { w(1, "<br><span class='ct'>after " as *u8); w(1, fld[7] as *u8); w(1, "</span>" as *u8) }
585 w(1, "</td><td class='ct'>" as *u8); w(1, fld[3] as *u8); w(1, "</td><td>" as *u8); w(1, fld[4] as *u8)
586 w(1, "</td><td><span class='ex'>" as *u8); w(1, fld[5] as *u8); w(1, "</span></td><td class='r'>" as *u8); w(1, fld[6] as *u8); w(1, " u</td></tr>\n" as *u8) } }
587 if streq(kind, "ms" as *u8) == 1 { if nf >= 5 {
588 if in_rung == 1 { w(1, "</tbody></table>\n" as *u8); in_rung = 0 }
589 if in_ms == 0 { w(1, "<h2>Milestones</h2>\n<table class='pl'><thead><tr><th>Milestone</th><th>Rungs</th><th class='r'>Cumulative</th></tr></thead><tbody>\n" as *u8); in_ms = 1 }
590 w(1, "<tr><td><b>" as *u8); w(1, fld[1] as *u8); w(1, "</b> · " as *u8); w(1, fld[2] as *u8); w(1, "</td><td class='ct'>" as *u8); w(1, fld[4] as *u8)
591 w(1, "</td><td class='r'>" as *u8); w(1, fld[3] as *u8); w(1, " u</td></tr>\n" as *u8) } }
592 }
593 }
594 }
595 if in_rung == 1 { w(1, "</tbody></table>\n" as *u8) }
596 if in_ms == 1 { w(1, "</tbody></table>\n" as *u8) }
597 if in_biz == 1 { w(1, "</tbody></table>\n" as *u8) }
598 return 1
599}
600// wlow LIFTED to nx_swcompare_lib.nx 2026-08-22 (DG5) -- ONE renderer in the base, both generators call
601// it. Left as a duplicate it would still COMPILE (nx_cc accepts duplicate definitions silently, debt
602// 1785447657), which is exactly how one copy gets fixed and the other does not.
603func con_row(label: *u8, ns: i64) -> i64 {
604 w(1, " [" as *u8)
605 if ns == 2 { w(1, "EXCEEDS" as *u8) } else { if ns == 1 { w(1, "PRESENT" as *u8) } else { if ns == 3 { w(1, "PARTIAL" as *u8) } else { w(1, "ABSENT " as *u8) } } }
606 w(1, "] " as *u8); w(1, label); w(1, "\n" as *u8); return 0
607}
608
609// ---- CE2: THE ADOPTION LADDER PER ROW (2026-08-23, operator: "fully wired fully adopted... you deploy partially constantly") ----
610// A Nishi mark used to be ONE bit: the implementing symbol exists in a source file -- rung one of the estate's
611// seven, so a gate compiled and never promoted, an organ promoted and never registered, a library imported only
612// by its own gate, all read identically to LIVE. Every MEASURED row now also carries WHERE ON ITS LADDER the organ
613// stands. The classifier is nx_catalog_lib's clb_classify (one composition of three rulers by organ kind:
614// program = the catalogue ladder, library = importer reach minus validation importers, gate = the
615// execution-surface census), shared with nx_compare_rank so the page and the ranker cannot disagree.
616// FULL = the top of its ladder; anything short is PARTIAL and NAMED with its remedy; every census source prints
617// its own asof= stamp. The flip law still holds: presence is necessary, adoption is necessary, the gate-proven
618// done-rule is the bar.
619// RANK_ROW_CAP: the ranked-order artefact (<dom>.rank, written by nx_compare_rank) is one line per rung, so its
620// byte size is bounded by the plan that produced it; this is the read reserve, announced if it ever fills.
621const RANK_READ_CAP: i64 = 65536
622
623// ---- CE6: render knowledge/compare/<dom>.rank (nx_compare_rank's stamped order) ----
624// rows: finish|id|title|sym|state|remedy . rank|n|stage|id|priority|v|m|c|title|sym . last line # asof=... (position-anchored)
625func rank_pass(dom: *u8, cap: i64) -> i64 { return rank_pass_heading(dom, cap, 2) }
626func rank_pass_heading(dom: *u8, cap: i64, heading_level: i64) -> i64 {
627 // A retained order cannot stand in for a rejected or changed input graph.
628 // Reuse the canonical graph and rank-binding reader; no second parser.
629 let rank_input: *SgPlan = sg_load(dom)
630 if sg_valid(rank_input) == 0 {
631 sc_heading_open(1, heading_level, "" as *u8); w(1, "Recorded ranking withheld" as *u8); sc_heading_close(1, heading_level)
632 w(1, "<p>Current prerequisite graph is invalid or unavailable. Historical rank data is retained, but cannot establish a current order. Latest execution outcome is unverified.</p>\n" as *u8)
633 return 0
634 }
635 if streq(sg_rank_state(rank_input), "PLAN_MATRIX_BOUND_ONLY" as *u8) != 1 {
636 sc_heading_open(1, heading_level, "" as *u8); w(1, "Recorded ranking withheld" as *u8); sc_heading_close(1, heading_level)
637 w(1, "<p>Retained ranking is not bound to the current plan and matrix: <code>" as *u8); w(1, sg_rank_state(rank_input)); w(1, "</code>. Historical data remains retained. Refresh the ranking after resolving the input differences. Latest execution outcome is unverified.</p>\n" as *u8)
638 return 0
639 }
640 w(1, "<p>Ranking matches the captured plan and matrix only. Latest execution outcome, research freshness, accepted delivery and investment return are unverified.</p>\n" as *u8)
641 // its OWN buffer, sized by the declared reserve -- the plan buffer handed around here is 20 KB and a
642 // reserve larger than the buffer it fills is an overrun wearing a constant
643 let buf: *u8 = sys_mmap(cap)
644 let rp: *u8 = sys_mmap(600)
645 var o: i64 = scopy(rp, 0, "knowledge/compare/" as *u8)
646 o = scopy(rp, o, dom); o = scopy(rp, o, ".rank" as *u8); rp[o] = 0 as u8
647 let n: i64 = c_read(rp, buf, cap - 1)
648 if n <= 0 {
649 sc_heading_open(1, heading_level, "" as *u8); w(1, "Recorded ranking" as *u8); sc_heading_close(1, heading_level); w(1, "\n<div class='meth'>No ranked order is published for this domain yet: run <code>nx_compare_rank " as *u8); w(1, dom); w(1, "</code> and this section fills itself on the next beat.</div>\n" as *u8)
650 return 0
651 }
652 if streq(sg_sha(buf, n), rank_input.rank_sha) != 1 {
653 w(1, "<p>Ranking changed or was read incompletely during evaluation. Table withheld; retry with a complete stable capture.</p>\n" as *u8)
654 return 0
655 }
656 if n >= cap - 1 { w(1, "<div class='meth'>rank artefact READ-CAPPED at " as *u8); wn(1, cap); w(1, " bytes -- the order below is a PREFIX</div>\n" as *u8) }
657 buf[n] = 0 as u8
658 // the stamp is the LAST line: read it before the parser NUL-splits anything
659 var ls: i64 = n - 1
660 if buf[ls] == (10 as u8) { ls = ls - 1 }
661 while ls > 0 { if buf[ls - 1] == (10 as u8) { break } ls = ls - 1 }
662 let stamp: *u8 = (buf as i64 + ls) as *u8
663 var se: i64 = ls
664 while se < n { if buf[se] == (10 as u8) { break } se = se + 1 }
665 buf[se] = 0 as u8
666 let fld: *i64 = sys_mmap(24 * 8) as *i64
667 sc_heading_open(1, heading_level, "" as *u8); w(1, "Recorded priority estimates" as *u8); sc_heading_close(1, heading_level); w(1, "\n" as *u8)
668 w(1, "<p class='lead'>Order from <code>nx_compare_rank</code> (nx_dr_ocm: (deficit + cost-of-delay + option + enables) x sponsor x self-sufficiency x momentum / cost). <b>FINISH</b> rows are rungs whose symbol is present but whose organ is short of full adoption: listed before new work by this heuristic. Priority is not measured delivery cost or execution readiness. Stamp: <code>" as *u8); w(1, stamp); w(1, "</code></p>\n" as *u8)
669 w(1, "<table class='pl'><thead><tr><th>#</th><th>Stage</th><th>Rung</th><th class='r'>Priority</th><th>Derivation</th></tr></thead><tbody>\n" as *u8)
670 var rows: i64 = 0
671 var p: i64 = 0
672 while p < ls {
673 var e: i64 = p
674 while e < ls { if buf[e] == (10 as u8) { break } e = e + 1 }
675 buf[e] = 0 as u8
676 let line: *u8 = (buf as i64 + p) as *u8
677 p = e + 1
678 if line[0] != (35 as u8) { if line[0] != (0 as u8) {
679 let nf: i64 = splitpipe(line, fld, 24)
680 let kind: *u8 = fld[0] as *u8
681 if streq(kind, "finish" as *u8) == 1 { if nf >= 6 {
682 rows = rows + 1
683 w(1, "<tr><td class='ct'>F</td><td><span class='ex'>FINISH</span></td><td><b>" as *u8); w(1, fld[2] as *u8); w(1, "</b> (" as *u8); w(1, fld[1] as *u8); w(1, ") <span class='ct'>" as *u8); w(1, fld[3] as *u8)
684 w(1, "</span></td><td class='r ct'>" as *u8); w(1, fld[4] as *u8); w(1, "</td><td>" as *u8); wnote(1, fld[5] as *u8); w(1, "</td></tr>\n" as *u8)
685 } }
686 if streq(kind, "rank" as *u8) == 1 { if nf >= 10 {
687 rows = rows + 1
688 w(1, "<tr><td class='ct'>#" as *u8); w(1, fld[1] as *u8); w(1, "</td><td><span class='ex'>" as *u8); w(1, fld[2] as *u8); w(1, "</span></td><td><b>" as *u8); w(1, fld[8] as *u8); w(1, "</b> (" as *u8); w(1, fld[3] as *u8); w(1, ") <span class='ct'>" as *u8); w(1, fld[9] as *u8)
689 w(1, "</span></td><td class='r'>" as *u8); w(1, fld[4] as *u8); w(1, "</td><td class='ct'>v=" as *u8); w(1, fld[5] as *u8); w(1, " m=" as *u8); w(1, fld[6] as *u8); w(1, " c=" as *u8); w(1, fld[7] as *u8); w(1, "</td></tr>\n" as *u8)
690 } }
691 } }
692 }
693 w(1, "</tbody></table>\n" as *u8)
694 if rows == 0 { w(1, "<div class='meth'>The rank artefact carries no rows: nothing open, or the ranker refused -- read its stamp above.</div>\n" as *u8) }
695 return rows
696}
697
698// ---- CE7: THE EVIDENCE PROFILE BAND -- the referee gap profile, ON THE PUBLISHED PAGE (2026-08-31) ----
699// nx_swcompare_evidence has computed the whole gap profile of every domain since 2026-08-31 and stamps
700// it to knowledge/status/evstamp_<dom>.verdict; nx_evprofile_lib is its ONE reader and nx_pm_board
701// consumes it. MEASURED THE SAME DAY (nx_shelltool grep evstamp_ over buildroot/runtime: 18 matches,
702// 23,410 files, coverage_complete=1 corpus_complete=1): NOT ONE GENERATOR READ IT. The profile reached
703// the PM board and never reached a single published board, so every /compare page could say RED and none
704// could say WHY. A measurement the organisation is paying for and not collecting is this estate own
705// named defect, and the operator ask is that the boards gaps be visible ON /compare. This is that half.
706//
707// THE ROOT TRAP, AND WHY THIS COMPOSES evp_load RATHER THAN OPENING A PATH ITSELF. nx_compare_regen runs
708// with CWD=buildroot (proven by its own RG_PUBJRNL of ../knowledge/status/...), and buildroot/knowledge/
709// status holds ZERO evstamp files. A BARE RELATIVE READ FROM THIS GENERATOR WOULD RESOLVE INTO AN EMPTY
710// TREE AND RENDER no-evidence FOR ALL 96 DOMAINS, CONFIDENTLY -- a wrong answer wearing the shape of a
711// complete one. evp_load composes ep_artifact_path (CWD -> ../ -> estate root, fail-closed) and REFUSES
712// when two different files answer to one name, so this band can never publish another board numbers.
713//
714// ABSTAIN, NEVER ACQUIT. A stamp written before the profile shipped carries none of these keys and
715// evp_parse leaves every slot -1. That renders as UNKNOWN with NOT ONE numeric field printed. A
716// zero-filled profile is a fabricated constant wearing the shape of a measurement, and it fails in the
717// flattering direction, which is the direction nobody audits.
718//
719// NO SCALAR GRADE IS COMPUTED, STORED OR RENDERED HERE. Every number below is a count printed with its
720// denominator, and the gap classes are SEPARATE predicates never merged into one not-honest score:
721// CLAIM-ONLY needs a gate WRITTEN and GATE-FAILING needs a gate FIXED, and one merged number sends a
722// seat at the wrong work. A bucket named for how the reader failed merges a real failure with a pass.
723import "nx_evprofile_lib.nx"
724
725// The read reserve is EVP_STAMP_CAP -- the lib that owns the wire owns its size, so there is exactly one
726// copy of that number and this band cannot drift from the reader that defines it.
727const EVB_PATH_CAP: i64 = 512
728const EVB_SECS_PER_DAY: i64 = 86400
729const EVB_SECS_PER_HOUR: i64 = 3600
730// Wide data scrolls in ITS OWN container: the page body must never scroll horizontally.
731const EVB_SCROLL_OPEN: *u8 = "<div style='overflow-x:auto'>"
732
733// One gap class, rendered only when it FIRES, and always beside the work it names. A count without a
734// worklist is not actionable, and a worklist without its reason is still one step short.
735func evb_remedy(fired: i64, name: *u8, remedy: *u8) -> i64 {
736 if fired != 1 { return 0 }
737 w(1, "<tr><td><b>" as *u8); w(1, name); w(1, "</b></td><td>" as *u8); w(1, remedy); w(1, "</td></tr>\n" as *u8)
738 return 1
739}
740
741// a count and its denominator, never one without the other
742func evb_pair(label: *u8, a: i64, b: i64) -> i64 {
743 w(1, "<span class='sep'>|</span>" as *u8); w(1, label); w(1, " <b>" as *u8); wn(1, a); w(1, "</b>/<b>" as *u8); wn(1, b); w(1, "</b>" as *u8)
744 return 0
745}
746
747func evb_one(label: *u8, a: i64) -> i64 {
748 w(1, "<span class='sep'>|</span>" as *u8); w(1, label); w(1, " <b>" as *u8); wn(1, a); w(1, "</b>" as *u8)
749 return 0
750}
751
752// A label whose value is a WORD, not a number. It exists so an abstention can be PRINTED in the same
753// row as the counts instead of being rounded down into one: -1 means UNKNOWN in this dialect, and a
754// reader that renders UNKNOWN as 0 publishes the one wrong answer nobody would question.
755func evb_word(label: *u8, word: *u8) -> i64 {
756 w(1, "<span class='sep'>|</span>" as *u8); w(1, label); w(1, " <b>" as *u8); w(1, word); w(1, "</b>" as *u8)
757 return 0
758}
759
760// ---- NON-VACUITY, FINALLY RENDERED WHERE A HUMAN LOOKS. ----
761// `vacuous` on this band is the WEAK word: it counts gates that printed GREEN on a ZERO denominator.
762// Clause 4 of the evidence law means something strictly stronger by non-vacuity -- "each gate has a
763// RECORDED RED observation; a gate never observed failing measures nothing" -- and THAT number has been
764// measured by ev_bite_fold, stamped as redseen= and parsed into EVP_F_REDSEEN since the bite ledger
765// shipped, while reaching only api.json. SAME WORD, TWO MEANINGS, AND THE WEAKER ONE WAS THE ONE ON THE
766// PAGE: softbody published "gates green 11/11 | gates vacuous 0" over eleven gates the ledger records as
767// never bitten. So the weak count is renamed for exactly what it counts and the strong one prints beside
768// it, as a count WITH ITS DENOMINATOR and its complement, never as a score.
769//
770// THREE STATES, BECAUSE ZERO IS NOT A SAFE DEFAULT HERE. "never bitten 0" reads as "every gate has been
771// shown able to fail" -- the flattering direction, which is the direction nobody audits. A stamp that
772// cannot answer must SAY so.
773func evb_bite(f: *i64) -> i64 {
774 let ran: i64 = f[EVP_F_RAN]
775 let red: i64 = f[EVP_F_REDSEEN]
776 // The stamp did not carry the key (a stamp older than the bite ledger, or a capped read). ABSTAIN.
777 if ran < 0 { evb_word("proven able to fail" as *u8, "UNKNOWN" as *u8); return 0 }
778 if red < 0 { evb_word("proven able to fail" as *u8, "UNKNOWN" as *u8); return 0 }
779 // No gate ran, so there is no population that could have been bitten. A 0/0 printed here would read
780 // as a clean board; the honest answer is that the question has no subject on this board yet.
781 if ran == 0 { evb_word("proven able to fail" as *u8, "n/a — no gate ran" as *u8); return 0 }
782 // redseen is folded over the SAME rows that increment ran, one call each, so red > ran cannot happen
783 // from a run of the referee. It can only come from a hand-edited stamp, and the right answer to that
784 // is a refusal -- not a negative complement dressed up as good news.
785 if red > ran { evb_word("proven able to fail" as *u8, "INCOHERENT — redseen exceeds gates run" as *u8); return 0 }
786 evb_pair("proven able to fail" as *u8, red, ran)
787 evb_one("never bitten" as *u8, ran - red)
788 return 0
789}
790
791func ev_pass(dom: *u8) -> i64 { return ev_pass_heading(dom, 2) }
792func ev_pass_heading(dom: *u8, heading_level: i64) -> i64 {
793 let buf: *u8 = sys_mmap(EVP_STAMP_CAP)
794 let pathout: *u8 = sys_mmap(EVB_PATH_CAP)
795 let flags: *i64 = sys_mmap(8 * EVP_NFLAG) as *i64
796 let n: i64 = evp_load(dom, buf, EVP_STAMP_CAP, pathout, flags)
797
798 sc_heading_open(1, heading_level, "" as *u8); w(1, "Evidence profile — what the gaps on this board actually are" as *u8); sc_heading_close(1, heading_level); w(1, "\n" as *u8)
799
800 // Two different files answering to one name is REFUSED, not silently decided. ep_open_rd probes the
801 // caller CWD first on purpose, so a stray copy beside the generator would WIN, and win silently.
802 if n == EVP_RC_AMBIGUOUS {
803 w(1, "<div class='meth'><b>REFUSED — two different files answer to one name.</b> A stamp exists both under this generator working directory and at the estate root, and their bytes differ. No reader may pick one, so this band publishes nothing rather than publish another board numbers. Resolve the duplicate at <code>" as *u8); w(1, pathout); w(1, "</code>.</div>\n" as *u8)
804 return 0
805 }
806 if n < 0 {
807 w(1, "<div class='meth'><b>Unstamped.</b> No evidence profile is published for this domain yet: run <code>nx_swcompare_evidence " as *u8); w(1, dom)
808 w(1, "</code> and this section fills itself on the next beat. <b>No numbers are shown, deliberately</b> — a zero-filled profile would read as a board with no gaps, which is the one wrong answer nobody would question.</div>\n" as *u8)
809 return 0
810 }
811 if flags[EVP_FL_BRIM] == 1 {
812 w(1, "<div class='meth'>stamp READ-CAPPED at " as *u8); wn(1, EVP_STAMP_CAP); w(1, " bytes — the profile below is a PREFIX of its own measurement</div>\n" as *u8)
813 }
814
815 let f: *i64 = sys_mmap(8 * EVP_NF) as *i64
816 evp_parse(buf, n, f)
817
818 // The version is DERIVED FROM THE WIRE, never declared on it: a v1 stamp simply has no profile keys.
819 if f[EVP_F_V] < 2 {
820 w(1, "<div class='meth'><b>UNKNOWN, not zero.</b> This domain stamp predates the gap profile, so it carries none of these keys and the reader abstains rather than acquit. Re-stamp with <code>nx_swcompare_evidence " as *u8); w(1, dom)
821 w(1, "</code>. Read from <code>" as *u8); w(1, pathout); w(1, "</code>.</div>\n" as *u8)
822 return 0
823 }
824
825 let rec: i64 = evp_reconciles(f)
826 let cjf: i64 = evp_conj_fail(f)
827 let now: i64 = sys_now_realtime_sec()
828 let ttl: i64 = evp_ttl_sec()
829 let stale: i64 = evp_stale(f, now, ttl)
830 var age: i64 = now - f[EVP_F_EPOCH]
831 if age < 0 { age = 0 }
832
833 w(1, "<p class='lead'>Measured by <code>nx_swcompare_evidence</code>, read back by <code>nx_evprofile_lib</code>. Every figure is a <b>count with its denominator</b> — there is deliberately no score, no grade and no percentage anywhere in this band, because a stored scalar is a field a seat can edit and a counted partition is not.</p>\n" as *u8)
834
835 w(1, "<p class='stats'>evidence" as *u8)
836 evb_pair("grounded" as *u8, f[EVP_F_GROUNDED], f[EVP_F_PRESENT])
837 evb_one("unsupported" as *u8, f[EVP_F_UNGROUND])
838 evb_pair("gates green" as *u8, f[EVP_F_GREEN], f[EVP_F_RAN])
839 evb_bite(f)
840 evb_one("green at 0/0" as *u8, f[EVP_F_VACUOUS])
841 evb_one("open gaps" as *u8, f[EVP_F_ABSENT])
842 evb_one("of them unnamed" as *u8, f[EVP_F_ABSBARE])
843 evb_one("of them proof withheld" as *u8, f[EVP_F_WITHHELD])
844 evb_one("flips ready" as *u8, f[EVP_F_LANDED])
845 w(1, "</p>\n" as *u8)
846
847 // The two gate-honesty figures above are DIFFERENT CLAIMS, and the page now says so in its own words:
848 // one word carried the weaker of the two meanings while sounding like the stronger one.
849 w(1, "<p class='legend'><b>proven able to fail</b> counts the gates that have a RECORDED RED — <code>nx_gate_bite</code> mutated the gate subject, rebuilt it, watched the gate go red, and that record is inside the shared TTL. <b>never bitten</b> is its complement over the same denominator: those gates ran and were green, and nothing has ever shown them able to detect anything, so their green is a statement about this run and not about the gate. <b>green at 0/0</b> is a separate and much weaker observation — the gate printed GREEN on a zero denominator, so its own tooth counter says it examined nothing. A gate can be green, non-zero, and still never bitten; that is the common case and it is now visible instead of implied.</p>\n" as *u8)
850
851 // A PARTITION IS A CLAIM: CHECK THAT THE PARTS SUM, AND PRINT THE SUM. Three states, because a
852 // partition we could not check and one that leaked are different facts and only one is a defect.
853 w(1, "<p class='legend'>partition: grounded + unsupported = " as *u8); wn(1, f[EVP_F_GROUNDED] + f[EVP_F_UNGROUND])
854 w(1, " vs present " as *u8); wn(1, f[EVP_F_PRESENT])
855 w(1, " · named + unnamed + withheld = " as *u8); wn(1, f[EVP_F_ABSNAMED] + f[EVP_F_ABSBARE] + f[EVP_F_WITHHELD])
856 w(1, " vs open " as *u8); wn(1, f[EVP_F_ABSENT]); w(1, " · " as *u8)
857 if rec == 1 { w(1, "<b>both reconcile</b>" as *u8) }
858 if rec == 0 { w(1, "<b>LEAK — these do not sum, and an unexplained residual is a defect in this instrument, not in the board</b>" as *u8) }
859 if rec < 0 { w(1, "<b>not measurable from this stamp</b>" as *u8) }
860 w(1, "</p>\n" as *u8)
861
862 // THE FAILING CONJUNCT, NAMED. The verdict line alone is a bare disjunction and the reader always
863 // guesses the alarming third; GPqN and gPQN are the same word and opposite work.
864 w(1, "<p class='legend'>liar-kill <code>conj=" as *u8)
865 if f[EVP_F_CJ_G] == 1 { w(1, "G" as *u8) } else { w(1, "g" as *u8) }
866 if f[EVP_F_CJ_P] == 1 { w(1, "P" as *u8) } else { w(1, "p" as *u8) }
867 if f[EVP_F_CJ_Q] == 1 { w(1, "Q" as *u8) } else { w(1, "q" as *u8) }
868 if f[EVP_F_CJ_N] == 1 { w(1, "N" as *u8) } else { w(1, "n" as *u8) }
869 w(1, "</code> · " as *u8)
870 if cjf < 0 { w(1, "all four conjuncts held" as *u8) } else {
871 w(1, "first failing conjunct: <b>" as *u8); w(1, evp_conj_name(cjf)); w(1, "</b>" as *u8)
872 }
873 w(1, "</p>\n" as *u8)
874
875 // WHICH DOCUMENT WAS GRADED. A verdict that cannot name its subject document is not a verdict about
876 // the published board -- and there are two knowledge trees whose copies of a matrix differ.
877 w(1, "<p class='legend'>graded document: <b>" as *u8); w(1, evp_tree_name(f[EVP_F_MROOT]))
878 w(1, "</b> tree, " as *u8); wn(1, f[EVP_F_MBYTES]); w(1, " bytes" as *u8)
879 if f[EVP_F_MCAPPED] == 1 { w(1, " <b>(READ-CAPPED: the referee graded a PREFIX of this document)</b>" as *u8) }
880 w(1, " · gates map: <b>" as *u8); w(1, evp_tree_name(f[EVP_F_GATESROOT]))
881 w(1, "</b> · stamped " as *u8); wn(1, age / EVB_SECS_PER_DAY); w(1, "d " as *u8)
882 wn(1, (age - (age / EVB_SECS_PER_DAY) * EVB_SECS_PER_DAY) / EVB_SECS_PER_HOUR); w(1, "h ago" as *u8)
883 if stale == 1 { w(1, " · <b>STALE against the shared TTL of " as *u8); wn(1, ttl); w(1, "s — this is evidence about a build nobody can vouch for now</b>" as *u8) }
884 w(1, " · source <code>" as *u8); w(1, pathout); w(1, "</code></p>\n" as *u8)
885
886 w(1, EVB_SCROLL_OPEN)
887 w(1, "<table class='pl'><thead><tr><th>Gap class</th><th>What it is, and the work it names</th></tr></thead><tbody>\n" as *u8)
888 var fired: i64 = 0
889 fired = fired + evb_remedy(evp_claim_only(f), "CLAIM-ONLY" as *u8,
890 "No declared gate ran for this board, so every capability mark here rests on a symbol existing in source and on nothing executing. The remedy is to WRITE a <code>.gates</code> map naming gates that already run — authoring, not research." as *u8)
891 fired = fired + evb_remedy(evp_gate_failing(f), "GATE-FAILING" as *u8,
892 "A declared gate ran and was not GREEN. The remedy is to FIX the gate it names. This is deliberately NOT merged with CLAIM-ONLY: one needs a gate written and the other needs a gate repaired, and a single merged number sends a seat at the wrong work." as *u8)
893 fired = fired + evb_remedy(evp_fabricated(f), "UNSUPPORTED-CLAIM" as *u8,
894 "A row published as measured names a symbol that is NOT in the organ file it cites. This is the one class worse than an open gap, because it is a published claim carrying a source line beside it as apparent proof." as *u8)
895 fired = fired + evb_remedy(evp_flip_ready(f), "FLIP-READY" as *u8,
896 "A watch contract symbol is now present in the organ it named: the cell can flip on a pure data edit with no new code. These are the cheapest closures on this board and they belong before any new work." as *u8)
897 fired = fired + evb_remedy(evp_unnamed_gap(f), "UNNAMED-GAP" as *u8,
898 "A gap row carries a bare <code>_ABSENT_</code> with no symbol after it, so it names no build contract and no seat can pick it up. Give it an <code>_ABSENT_:<symbol></code> and it becomes work somebody can do." as *u8)
899 fired = fired + evb_remedy(evp_withheld(f), "PROOF-WITHHELD" as *u8,
900 "The mechanism SHIPPED and its symbol really is in the organ it names, but the CLAIM this row makes rests on a <b>named precondition nobody has met</b>, so the row stays OPEN and is counted among the gaps. It is deliberately NOT a flip and no data edit closes it: meet the precondition the row names, then re-adjudicate. Before this class existed, the only way to withdraw such a claim was to write it as an absence — which this referee then resolved, FOUND, and filed as LANDED, so the retraction instructed its own reversal." as *u8)
901 fired = fired + evb_remedy(evp_withheld_refused(f), "WITHHELD-REFUSED" as *u8,
902 "A row claims withheld proof that the referee would not grant: either the precondition file it names now <b>holds data</b>, so the excuse has expired, or its symbol is not in the organ at all, so there is no shipped mechanism whose proof could be withheld. This is the tooth that stops the withheld form being a silence button, and the offending rows are named one by one by <code>nx_swcompare_evidence</code> itself." as *u8)
903 fired = fired + evb_remedy(evp_vacuous_gate(f), "VACUOUS-GATE" as *u8,
904 "A gate reported GREEN on a ZERO denominator. A gate with real teeth and a broken counter, and a gate with no teeth at all, are indistinguishable from outside; that indistinguishability is the finding, so it is reported here and never convicted." as *u8)
905 fired = fired + evb_remedy(stale, "STALE" as *u8,
906 "This profile is older than the shared TTL, or its clock ran backwards. It is reported as unusable rather than as fresh, because being wrong in the direction of refusing is the safe direction." as *u8)
907 if fired == 0 {
908 w(1, "<tr><td><b>NONE</b></td><td>No gap class fires on this board: every published claim is grounded, the declared gates ran and were green, no watch contract is unnamed or already landed, and the stamp is inside its TTL. That is a statement about <b>evidence</b>, not about depth, scale or polish.</td></tr>\n" as *u8)
909 }
910 w(1, "</tbody></table></div>\n" as *u8)
911 w(1, "<div class='meth'>This band reports the referee <b>counts</b>. The per-axis worklist rows — which axis is unsupported, which watch is ready to flip, which gap is unnamed — are printed by <code>nx_swcompare_evidence " as *u8); w(1, dom)
912 w(1, "</code> itself and are not carried on the stamp, so this page names the classes and the producer names the rows. That split is stated rather than hidden: a count without a worklist is not actionable, and this band is honest about which half of that it is.</div>\n" as *u8)
913 return fired
914}
915
916func main(argc: i64, argv: *i64) -> i64 {
917 if argc < 2 { w(1, "usage: nx_swcompare_matrix <domain> [html]\n" as *u8); sys_exit(1); return 1 }
918 let domain: *u8 = argv[1] as *u8
919 // EXPORT MODE (datavis DV6, 2026-09-15): `nx_swcompare_matrix <domain> export <dir>` writes <dir>/cdmap.svg, cdmap.png and
920 // cdmap.export.json from the <dir>/index.html this generator published a moment earlier; exit 0 landed, 1 failed, 2 no map.
921 if argc >= 4 { if streq(argv[2] as *u8, "export" as *u8) == 1 { return cdp_export(argv[3] as *u8) } }
922 let cap: i64 = K_MAGIC_262144
923 let buf: *u8 = sys_mmap(cap)
924 let buf2: *u8 = sys_mmap(cap)
925 let pathb: *u8 = sys_mmap(512)
926 var o: i64 = scopy(pathb, 0, "knowledge/compare/" as *u8)
927 o = scopy(pathb, o, domain); o = scopy(pathb, o, ".matrix" as *u8); pathb[o] = 0 as u8
928 // RESOLVE, don't assume. ct_compare_read_published probes the PUBLISHING tree first and the
929 // authored tree second, and its wrapper applies ct_swap_tree so `mwhich` is a TRUE TREE token
930 // rather than a POSITION token -- stamping the raw position would label every buildroot read
931 // PRIMARY and misname the very document it just graded correctly.
932 // The pathb build above is DELIBERATELY KEPT: lines below still print it as a diagnostic.
933 let mwhich: *i64 = sys_mmap(16) as *i64
934 mwhich[0] = CT_TREE_NONE
935 let n: i64 = ct_compare_read_published(domain, ".matrix" as *u8, buf, cap, mwhich)
936 // cdir = the tree that actually answered, so the sibling .refs and .plan reads below cannot
937 // silently come from a DIFFERENT generation than the .matrix they annotate.
938 var cdir: *u8 = ct_first_published()
939 if mwhich[0] == CT_TREE_PRIMARY { cdir = ct_second_published() }
940 // A domain with a .sota and no .matrix renders through THIS generator too: zero capability rows, the SOTA
941 // field section, and every shared pass. The refusal fires only when NEITHER data class exists.
942 let sst: *SotaState = sl_new()
943 let have_sota: i64 = sl_load(domain, sst)
944 var have_matrix: i64 = 1
945 if n <= 0 { have_matrix = 0 }
946 // THE REFUSAL NAMES BOTH TREES IT PROBED. The old text printed ONE hand-built path, which under a
947 // resolver is not necessarily a path anyone looked at -- a refusal that names the wrong subject
948 // costs the reader the investigation it was written to save them.
949 if have_matrix == 0 { if have_sota != 1 { w(1, "MATRIX FILE MISSING: " as *u8); w(1, domain); w(1, ".matrix absent from BOTH " as *u8); w(1, ct_first_published()); w(1, " and " as *u8); w(1, ct_second_published()); w(1, " (and no .sota beside it)\n" as *u8); sys_exit(1); return 1 } }
950 // HASH BEFORE THE PARSER TOUCHES IT. splitpipe NUL-terminates fields IN PLACE, so by JSON-emit
951 // time buf is no longer the file -- hashing it there produced a value no consumer could
952 // reproduce from disk, and nx_comparestale reported all 46 pages stale minutes after they were
953 // published. A COMPARATOR AND A WRITER THAT DISAGREE ON CANONICAL FORM NEVER CONVERGE; the
954 // canonical form here is THE BYTES AS READ.
955 var src_hash: i64 = swc_src_hash(buf, n)
956 // AND DECLARE WHICH FILE THAT WAS. A consumer must never have to infer it from an extension
957 // precedence rule: llm and lang each have BOTH a .matrix and a .sota, so "try .matrix first"
958 // hashed the wrong file and called two perfectly current pages STALE.
959 let src_base: *u8 = sys_mmap(256)
960 var sbo: i64 = scopy(src_base, 0, domain); sbo = scopy(src_base, sbo, ".matrix" as *u8); src_base[sbo] = 0 as u8
961 // a sota-only domain declares the .sota as the source it was generated from (the staleness contract)
962 if have_matrix == 0 { src_hash = sst.src_hash; sbo = scopy(src_base, 0, domain); sbo = scopy(src_base, sbo, ".sota" as *u8); src_base[sbo] = 0 as u8 }
963 // citations register (research-paper references as data); absent file = byte-identical emit
964 let refspath: *u8 = sys_mmap(600)
965 var rpo: i64 = scopy(refspath, 0, "knowledge/compare/" as *u8)
966 rpo = scopy(refspath, rpo, domain); rpo = scopy(refspath, rpo, ".refs" as *u8); refspath[rpo] = 0 as u8
967 // rendered-evidence register (images as data); absent file = byte-identical emit
968 let galpath: *u8 = sys_mmap(600)
969 var gpo: i64 = scopy(galpath, 0, "knowledge/compare/" as *u8)
970 gpo = scopy(galpath, gpo, domain); gpo = scopy(galpath, gpo, ".gallery" as *u8); galpath[gpo] = 0 as u8
971
972 // ROW CAPACITY DERIVED FROM THE FILE, NOT GUESSED (2026-08-18). A data row costs at least one
973 // newline, so rows <= lines + 1 -- an invariant, not a knob. The fixed 64 this replaces silently
974 // DROPPED rows 65+ (measured live on browser.matrix: 66 rows authored, 64 rendered, the last two
975 // vanished under a healthy stats line -- the no-silent-caps law violated inside the very organ
976 // whose job is honest counts; debt 1787077715). The guard at the append site is kept as the
977 // fail-loud floor and now REFUSES instead of skipping.
978 var maxr_lines: i64 = 1
979 var maxr_i: i64 = 0
980 while maxr_i < n { if buf[maxr_i] == (10 as u8) { maxr_lines = maxr_lines + 1 } maxr_i = maxr_i + 1 }
981 let MAXR: i64 = maxr_lines + 1
982 let rf: *i64 = sys_mmap(MAXR * SWC_ROW_STRIDE * 8) as *i64
983 let rl: *i64 = sys_mmap(16) as *i64 // the rule the one ruler applied to the last row measured
984 let rnishi: *i64 = sys_mmap(MAXR * 8) as *i64
985 let rexceed: *i64 = sys_mmap(MAXR * 8) as *i64
986 // DARK CONTRACT per row (2026-09-06, operator: a permanent fix, we do not build and lose capability to darkness):
987 // 1 when a watch row's organ file EXISTS and was read but does not declare the contracted symbol -- something
988 // shipped at that path under another name. mmap-zeroed, so every non-watch row reads 0 without a write.
989 let rdark: *i64 = sys_mmap(MAXR * 8) as *i64
990 let max_cols: i64 = SWC_ROW_STRIDE - SWC_ROW_FIXED
991 let cf: *i64 = sys_mmap(max_cols * 8) as *i64
992 let fld: *i64 = sys_mmap(24 * 8) as *i64
993 var ncol: i64 = 0
994 var title: *u8 = "Comparison" as *u8
995 var sub: *u8 = 0 as *u8
996 var verdict: *u8 = 0 as *u8
997 var rown: i64 = 0
998 var rule_subonly: i64 = 0
999
1000 var p: i64 = 0
1001 while p < n {
1002 var e: i64 = p
1003 while e < n { if buf[e] == (10 as u8) { break } e = e + 1 }
1004 buf[e] = 0 as u8
1005 let line: *u8 = (buf as i64 + p) as *u8
1006 p = e + 1
1007 if line[0] == (0 as u8) { } else { if line[0] == (35 as u8) { } else {
1008 if line[0] == (64 as u8) {
1009 if starts(line, "@title " as *u8) == 1 { title = (line as i64 + 7) as *u8 } else {
1010 if starts(line, "@sub " as *u8) == 1 { sub = (line as i64 + 5) as *u8 } else {
1011 if starts(line, "@verdict " as *u8) == 1 { verdict = (line as i64 + 9) as *u8 } else {
1012 if starts(line, "@cols " as *u8) == 1 { ncol = splitpipe((line as i64 + 6) as *u8, cf, max_cols) } } } }
1013 } else {
1014 let cnt: i64 = splitpipe(line, fld, 24)
1015 // SCHEMA v2: a row is label|organ|symbol|exceed then ONE CELL PER DECLARED COLUMN then the note,
1016 // so its width is 5 + ncol rather than a fixed 9. Four-column domains still compute 9 and parse
1017 // byte-identically; a fifth column (the research bar) now costs a data row, not a code change.
1018 let roww: i64 = SWC_ROW_FIXED + ncol
1019 // AN OVER-COUNT ROW IS A LIE WEARING THE SHAPE OF A NOTE (2026-08-18). A stray pipe inside
1020 // prose (a sibling wrote the math with vertical bars; another used ' | reuse: ' as a
1021 // separator) shears the note at that pipe, and '>=' below published the PREFIX as the whole
1022 // note with a healthy byte count -- 6 rows across 48 matrices, one of them 2.7KB short across
1023 // three regens, invisible to every reader. REFUSE the domain, name the row, and show the text
1024 // that begins each surplus field so the author sees exactly where the pipe is.
1025 if cnt > roww {
1026 w(1, "MATRIX ROW REFUSED: " as *u8); w(1, pathb); w(1, " row-index " as *u8); wn(1, rown)
1027 w(1, " has " as *u8); wn(1, cnt); w(1, " fields, schema is " as *u8); wn(1, roww)
1028 w(1, " -- a stray '|' inside the note; surplus fields begin: " as *u8)
1029 var sf: i64 = roww
1030 while sf < cnt { w(1, "[" as *u8); w(1, fld[sf] as *u8); w(1, "] " as *u8); sf = sf + 1 }
1031 w(1, "\n" as *u8)
1032 sys_exit(1); return 1
1033 }
1034 if cnt == roww { if rown >= MAXR {
1035 w(1, "MATRIX ROWS EXCEED DERIVED CAPACITY -- impossible by derivation (rows <= file lines); refusing rather than silently dropping. file=" as *u8)
1036 w(1, pathb); w(1, " rown=" as *u8); wn(1, rown)
1037 w(1, "
1038" as *u8)
1039 sys_exit(1); return 1
1040 } }
1041 if cnt == roww { if rown >= MAXR {
1042 w(1, "MATRIX ROWS EXCEED DERIVED CAPACITY -- impossible by derivation (rows <= file lines); refusing rather than silently dropping. file=" as *u8)
1043 w(1, pathb); w(1, " rown=" as *u8); wn(1, rown)
1044 w(1, "
1045" as *u8)
1046 sys_exit(1); return 1
1047 } }
1048 if cnt == roww { if rown < MAXR {
1049 var k: i64 = 0
1050 while k < roww { rf[rown*SWC_ROW_STRIDE + k] = fld[k]; k = k + 1 }
1051 let organ: *u8 = fld[1] as *u8
1052 let sym: *u8 = fld[2] as *u8
1053 var present: i64 = 0
1054 if streq(sym, "_ABSENT_" as *u8) == 1 { present = 0 } else {
1055 if starts(sym, "_ABSENT_:" as *u8) == 1 {
1056 // WATCH ROW (2026-08-13, operator: pages must INHERIT workstream ships, never be
1057 // re-authored): the expectation is named in data as _ABSENT_:<future_symbol>; it is
1058 // MEASURED here on every emit with the same ruler as present rows, so the moment a
1059 // workstream ships the organ+symbol, the next beat flips the cell -- and if the organ
1060 // is later retired the cell reverts. Bidirectional, fail-safe, zero hand edits.
1061 let wsym: *u8 = (sym as i64 + 9) as *u8
1062 // ONE RULER (2026-08-23): a top-level DECLARATION in the organ, never a substring --
1063 // nx_symdecl_lib is what the ranker and the comparewatch plane measure with too.
1064 present = 0
1065 let wst: i64 = sd_present(organ, wsym, rl)
1066 if wst == 1 { present = 1 }
1067 // DARK CONTRACT (2026-09-06): the ruler returns -1 for an organ it could not read and 0 for one it
1068 // READ whose symbol is not declared; a watch row in the second state names a path where something
1069 // shipped under another name (measured twice this week: DC16 amesh_run, motion mr_rig and
1070 // mo_body_index -- each read as 0 of N done for days). The JS rule's abstention is folded to 0 by
1071 // sd_present, so a JSDECL rule is excluded here: a cell the ruler cannot judge is OPEN, never DARK.
1072 if wst == 0 { if rl[0] != SD_RULE_JSDECL { rdark[rown] = 1 } }
1073 if present == 1 { rf[rown*SWC_ROW_STRIDE + 2] = wsym as i64 }
1074 } else { present = 0; if sd_present(organ, sym, rl) == 1 { present = 1 } }
1075 }
1076 // TWO SYMBOL RULERS, MEASURED (2026-08-23): this page tests a SUBSTRING, the ranker tests a
1077 // top-level DECLARATION (cl_symbol_declared), and a sibling seat caught a rung reading LANDED here
1078 // and OPEN there at once. Before the page switches rulers fleet-wide, COUNT the cells that would
1079 // flip: a row present by substring but not declared is a mention (comment, string, tooth name),
1080 // not an implementation. Published as rule_substring_only; the switch is a measured decision.
1081 if present == 1 {
1082 var dsym: *u8 = sym
1083 if starts(sym, "_ABSENT_:" as *u8) == 1 { dsym = (sym as i64 + 9) as *u8 }
1084 if cl_symbol_declared(organ, dsym) == 0 { rule_subonly = rule_subonly + 1 }
1085 }
1086 let exc: i64 = atoi(fld[3] as *u8)
1087 var nish: i64 = 0
1088 if present == 1 { if exc == 1 { nish = 2 } else { nish = 1 } } else { nish = 0 }
1089 rnishi[rown] = nish; rexceed[rown] = exc; rown = rown + 1
1090 } }
1091 } } }
1092 }
1093
1094 // DARK CONTRACT COUNT (2026-09-06): summed from the per-row facts, so the receipt and the page cannot disagree.
1095 var dark_c: i64 = 0
1096 var dki: i64 = 0
1097 while dki < rown { dark_c = dark_c + rdark[dki]; dki = dki + 1 }
1098
1099 // ---- CE2: adoption per measured row, one classification per distinct organ (memoised) ----
1100 // every source the classifier reads, loaded ONCE, estate-anchored (the regen forks this organ from
1101 // buildroot/, where relative reads miss or hit stale twins -- measured on the first live emit)
1102 let ads: *i64 = sys_mmap(CLB_N * 8) as *i64
1103 clb_load(ads)
1104 // each census stamps itself; the page prints the stamp, never a trust it did not measure
1105 let imp_asof: i64 = ads[CLB_IMP_ASOF]
1106 let ga_asof: i64 = ads[CLB_GA_ASOF]
1107 let radopt: *i64 = sys_mmap(MAXR * 8) as *i64
1108 let rtok: *i64 = sys_mmap(MAXR * 8) as *i64
1109 let rrem: *i64 = sys_mmap(MAXR * 8) as *i64
1110 let mname: *i64 = sys_mmap(MAXR * 8) as *i64
1111 let mtok: *i64 = sys_mmap(MAXR * 8) as *i64
1112 let mful: *i64 = sys_mmap(MAXR * 8) as *i64
1113 let mrem: *i64 = sys_mmap(MAXR * 8) as *i64
1114 var mc: i64 = 0
1115 var adopt_full: i64 = 0
1116 var adopt_partial: i64 = 0
1117 var ra: i64 = 0
1118 while ra < rown {
1119 radopt[ra] = CLB_NA
1120 rtok[ra] = "" as *u8 as i64
1121 rrem[ra] = "" as *u8 as i64
1122 if rnishi[ra] > 0 {
1123 let oname: *u8 = sys_mmap(CLB_TOK_CAP)
1124 cl_name_of_path(rf[ra*SWC_ROW_STRIDE + 1] as *u8, oname, CLB_TOK_CAP)
1125 var hit: i64 = 0 - 1
1126 var mi: i64 = 0
1127 while mi < mc { if streq(mname[mi] as *u8, oname) == 1 { hit = mi; mi = mc } mi = mi + 1 }
1128 if hit < 0 {
1129 let tokb: *u8 = sys_mmap(CLB_TOK_CAP)
1130 let remp: *i64 = sys_mmap(8) as *i64
1131 let ful: i64 = clb_classify(oname, ads, tokb, remp)
1132 mname[mc] = oname as i64; mtok[mc] = tokb as i64; mful[mc] = ful; mrem[mc] = remp[0]
1133 hit = mc
1134 mc = mc + 1
1135 }
1136 radopt[ra] = mful[hit]
1137 rtok[ra] = mtok[hit]
1138 rrem[ra] = mrem[hit]
1139 if mful[hit] == CLB_FULL { adopt_full = adopt_full + 1 } else { adopt_partial = adopt_partial + 1 }
1140 }
1141 ra = ra + 1
1142 }
1143
1144 // EC10: histogram of the classifier's OWN tokens over the measured rows. rtok is empty for a row that
1145 // was never classified (no organ measured), so those rows contribute nothing here and the histogram's
1146 // population is exactly the FULL+PARTIAL tally above -- a partition the console line asserts by summing.
1147 let mxh_tok: *i64 = sys_mmap(MXH_MAX * 8) as *i64
1148 let mxh_cnt: *i64 = sys_mmap(MXH_MAX * 8) as *i64
1149 var mxh_n: i64 = 0
1150 var mxh_ovf: i64 = 0
1151 var mxh_i: i64 = 0
1152 while mxh_i < rown {
1153 let mxh_t: *u8 = rtok[mxh_i] as *u8
1154 if mxh_t[0] != (0 as u8) {
1155 var mxh_hit: i64 = 0 - 1
1156 var mxh_j: i64 = 0
1157 while mxh_j < mxh_n { if mx_tokclass_eq(mxh_tok[mxh_j] as *u8, mxh_t) == 1 { mxh_hit = mxh_j; mxh_j = mxh_n } mxh_j = mxh_j + 1 }
1158 if mxh_hit >= 0 { mxh_cnt[mxh_hit] = mxh_cnt[mxh_hit] + 1 } else {
1159 if mxh_n < MXH_MAX { mxh_tok[mxh_n] = mxh_t as i64; mxh_cnt[mxh_n] = 1; mxh_n = mxh_n + 1 } else { mxh_ovf = mxh_ovf + 1 }
1160 }
1161 }
1162 mxh_i = mxh_i + 1
1163 }
1164
1165 var present_c: i64 = 0; var exceeds_c: i64 = 0; var absent_c: i64 = 0; var exflags: i64 = 0
1166 var r: i64 = 0
1167 while r < rown {
1168 if rexceed[r] == 1 { exflags = exflags + 1 }
1169 if rnishi[r] == 2 { exceeds_c = exceeds_c + 1 } else { if rnishi[r] == 1 { present_c = present_c + 1 } else { absent_c = absent_c + 1 } }
1170 r = r + 1
1171 }
1172 let total: i64 = rown
1173 // RIVAL-CLAIM PROVENANCE (2026-09-05): rows whose rival columns assert Yes, Best or Part, split by whether the
1174 // note cites a reference mark. Computed ONCE here so the JSON tally and the HTML band cannot disagree.
1175 var rv_rows: i64 = 0; var rv_cited: i64 = 0; var rv_uncited: i64 = 0
1176 var rvr: i64 = 0
1177 while rvr < rown {
1178 let rvc0: i64 = rv_class(rf[rvr*SWC_ROW_STRIDE + 4 + ncol] as *u8, rf, rvr, SWC_ROW_STRIDE, ncol)
1179 if rvc0 != RV_NONE { rv_rows = rv_rows + 1 }
1180 if rvc0 == RV_CITED { rv_cited = rv_cited + 1 }
1181 if rvc0 == RV_UNCITED { rv_uncited = rv_uncited + 1 }
1182 rvr = rvr + 1
1183 }
1184 var coverage: i64 = 0
1185 if total > 0 { coverage = ((present_c + exceeds_c) * 1000) / total }
1186 var neg: i64 = 0
1187 if rown > 0 { if sd_present(rf[1] as *u8, "zzznope_symbol_xyz" as *u8, rl) == 1 { neg = 1 } }
1188
1189 var html: i64 = 0
1190 var jsonmode: i64 = 0
1191 if argc >= 3 { if streq(argv[2] as *u8, "html" as *u8) == 1 { html = 1 } }
1192 if argc >= 3 { if streq(argv[2] as *u8, "json" as *u8) == 1 { jsonmode = 1 } }
1193
1194 var ladder_model: *SgPlan = 0 as *SgPlan
1195 if html + jsonmode > 0 { ladder_model = sg_load(domain) }
1196 if jsonmode == 1 {
1197 wc(1, 123)
1198 kv_n(1, "v" as *u8, 1); wc(1, 44)
1199 kv_s(1, "api" as *u8, "nishi-compare" as *u8); wc(1, 44)
1200 kv_n(1, "generated_unix" as *u8, sys_now_realtime_sec()); wc(1, 44)
1201 // The page carries the hash of the SOURCE it was generated from -- staleness becomes decidable
1202 // by a consumer with no clock and no filesystem access to this machine.
1203 kv_s(1, "source_file" as *u8, src_base); wc(1, 44); kv_n(1, "source_hash" as *u8, src_hash); wc(1, 44)
1204 kv_s(1, "domain" as *u8, domain); wc(1, 44)
1205 kv_s(1, "kind" as *u8, "matrix" as *u8); wc(1, 44)
1206 kv_s(1, "title" as *u8, title); wc(1, 44)
1207 if (sub as i64) != 0 { kv_s(1, "subtitle" as *u8, sub); wc(1, 44) }
1208 wq(1); w(1, "competitors" as *u8); wq(1); wc(1, 58); wc(1, 91)
1209 var cj: i64 = 0
1210 while cj < ncol { if cj > 0 { wc(1, 44) } wq(1); wj(1, cf[cj] as *u8); wq(1); cj = cj + 1 }
1211 wc(1, 93); wc(1, 44)
1212 wq(1); w(1, "axes" as *u8); wq(1); wc(1, 58); wc(1, 91)
1213 var rj: i64 = 0
1214 while rj < rown {
1215 if rj > 0 { wc(1, 44) }
1216 wc(1, 123)
1217 kv_s(1, "label" as *u8, rf[rj*SWC_ROW_STRIDE + 0] as *u8); wc(1, 44)
1218 kv_n(1, "nishi" as *u8, rnishi[rj]); wc(1, 44)
1219 kv_n(1, "exceed" as *u8, rexceed[rj]); wc(1, 44)
1220 // CE2: the ladder state and a 0/1/2 adopted flag (2 = not applicable: the axis is open)
1221 kv_s(1, "adopt" as *u8, rtok[rj] as *u8); wc(1, 44)
1222 kv_n(1, "adopted" as *u8, radopt[rj]); wc(1, 44)
1223 wq(1); w(1, "cells" as *u8); wq(1); wc(1, 58); wc(1, 91)
1224 // SCHEMA v2 COMPLETED 2026-08-15. The JSON half of this emitter was left on the fixed
1225 // four-cell layout when the parser (roww = 5 + ncol) and the HTML half both moved to
1226 // one-cell-per-declared-column. On a five-column domain it therefore emitted cells[4] and
1227 // published the FIFTH CODE as the note, dropping every prose note with it -- mangagen's
1228 // DiffSensei research bar has been unpublished this way since 2026-08-13, and the page
1229 // looked entirely healthy the whole time.
1230 // TWO HALVES OF ONE EMITTER ARE TWO READERS, AND AN UPGRADE APPLIED TO ONLY ONE OF THEM
1231 // IS A WIRE DISAGREEMENT THAT SHIPS LOOKING CORRECT.
1232 // NEUTRALITY IS EXACT, NOT ASSERTED: for ncol == 4 these expressions reduce to the old
1233 // literals (4 and 4+4), so every four-column domain emits byte-identical JSON.
1234 var ij: i64 = 0
1235 while ij < ncol { if ij > 0 { wc(1, 44) } wn(1, atoi(rf[rj*SWC_ROW_STRIDE + 4 + ij] as *u8)); ij = ij + 1 }
1236 wc(1, 93); wc(1, 44)
1237 kv_s(1, "note" as *u8, rf[rj*SWC_ROW_STRIDE + 4 + ncol] as *u8)
1238 wc(1, 125)
1239 rj = rj + 1
1240 }
1241 wc(1, 93); wc(1, 44)
1242 wq(1); w(1, "tally" as *u8); wq(1); wc(1, 58); wc(1, 123)
1243 kv_n(1, "coverage" as *u8, coverage); wc(1, 44); kv_n(1, "exceeds" as *u8, exceeds_c); wc(1, 44)
1244 kv_n(1, "present" as *u8, present_c); wc(1, 44); kv_n(1, "absent" as *u8, absent_c); wc(1, 44); kv_n(1, "total" as *u8, total); wc(1, 44)
1245 kv_n(1, "adopted_full" as *u8, adopt_full); wc(1, 44); kv_n(1, "adopted_partial" as *u8, adopt_partial); wc(1, 44)
1246 kv_n(1, "rival_rows" as *u8, rv_rows); wc(1, 44); kv_n(1, "rival_cited" as *u8, rv_cited); wc(1, 44); kv_n(1, "rival_uncited" as *u8, rv_uncited); wc(1, 44)
1247 // EC10: the whole ladder, machine-readable. Keys are "state"/"rows" (not "class"/"count") so no
1248 // flat-searching consumer of this document can collide with them.
1249 wq(1); w(1, "adopt_classes" as *u8); wq(1); wc(1, 58); wc(1, 91)
1250 var mxh_e: i64 = 0
1251 while mxh_e < mxh_n {
1252 if mxh_e > 0 { wc(1, 44) }
1253 wc(1, 123); wq(1); w(1, "state" as *u8); wq(1); wc(1, 58); wq(1)
1254 sys_write(1, mxh_tok[mxh_e] as *u8, mx_tokclass_len(mxh_tok[mxh_e] as *u8))
1255 wq(1); wc(1, 44); wq(1); w(1, "rows" as *u8); wq(1); wc(1, 58); wn(1, mxh_cnt[mxh_e]); wc(1, 125)
1256 mxh_e = mxh_e + 1
1257 }
1258 wc(1, 93); wc(1, 44)
1259 kv_n(1, "adopt_classes_overflow" as *u8, mxh_ovf); wc(1, 44)
1260 kv_n(1, "rule_substring_only" as *u8, rule_subonly); wc(1, 44)
1261 kv_n(1, "dark_contracts" as *u8, dark_c)
1262 wc(1, 125); wc(1, 44)
1263 wq(1); w(1, "adoption_sources" as *u8); wq(1); wc(1, 58); wc(1, 123)
1264 kv_n(1, "importers_asof" as *u8, imp_asof); wc(1, 44); kv_n(1, "gateadjudicate_asof" as *u8, ga_asof); wc(1, 44)
1265 kv_s(1, "rule" as *u8, "program: nx_catalog ladder; library: importer reach minus validation importers; gate: execution-surface census; FULL only at the top of its ladder" as *u8)
1266 wc(1, 125); wc(1, 44)
1267 kv_s(1, "codes" as *u8, "0=No 1=Yes 2=Best 3=Part; adopted 1=full 0=partial 2=n/a" as *u8); wc(1, 44)
1268 kv_s(1, "measurement" as *u8, "nishi cells verified by implementing-symbol on disk; competitor cells are documented capability presence" as *u8)
1269 // THE SOTA FIELD, MACHINE-READABLE (2026-09-02): the same field names the sota generator published
1270 if have_sota == 1 { sl_json(sst, domain, 1) }
1271 wc(1, 44); wq(1); w(1, "ppp" as *u8); wq(1); wc(1, 58); ppp_pass(domain, 1, 2)
1272 refs_pass(refspath, buf2, cap, 2, domain, RP_HDR)
1273 gal_pass(galpath, buf2, cap, 2, domain)
1274 // THE EVIDENCE PROFILE, MACHINE-READABLE (F1208). The HTML band above (ev_pass) and this object
1275 // read THE SAME stamp through THE SAME reader, so the page and api.json cannot disagree about
1276 // this board's gaps. evj_pass lives in nx_swcompare_lib so the SOTA generator emits the same
1277 // dialect from one renderer -- the refs_pass/plan_pass precedent, not a second copy here.
1278 evj_pass(domain)
1279 // MEASURED HEAD-TO-HEAD RECEIPT (2026-09-01): <dom>.bench rides in api.json through the one reader; absent file = no key
1280 bench_pass(domain, 1, 2)
1281 // LEADERBOARDS (ecosystem EC44, 2026-09-15): <dom>.leaderboard rides in api.json through the one ruler; absent file = no key
1282 lbp_pass(domain, 1, 2)
1283 // FOREIGN ASSETS (sovereignty SV13, 2026-09-16): <dom>.assets rides in api.json through the one reader, priced by the one estimator; absent file = no key
1284 assets_pass(domain, 1, 2)
1285 // MINED INTELLIGENCE (intelmine IM3): <dom>.proposed rides in api.json through the one reader; absent file = no key
1286 prop_pass(domain, 1, 2)
1287 // THE DISCOVERED FIELD (fieldwatch FW1, 2026-09-05): <dom>.field rides in api.json through the one reader with the @cols coverage; absent file = no key
1288 field_pass(domain, 1, 2, cf, ncol)
1289 // THE POSITION MAP (2026-09-15): the centrality/distinctiveness projection rides in api.json through the one ruler
1290 cdmap_pass(domain, 1, 2, cf, ncol, rf, SWC_ROW_STRIDE, rnishi, rown)
1291 // GAUGE HEARTBEATS (codeeffectiveness CE9, 2026-09-06): <dom>.gauge rides in api.json through the one ruler; a stale gauge carries no value key
1292 gauge_pass(domain, 1, 2)
1293 gaps_pass(domain, 1, 2)
1294 sg_json(ladder_model, 1)
1295 wc(1, 125); wc(1, 10)
1296 sys_exit(0); return 0
1297 }
1298
1299 if html == 1 {
1300 // shared site chrome (nav + footer) from nx_site_chrome; graceful fallback to minimal nav if absent.
1301 let hdrbuf: *u8 = sys_mmap(K_MAGIC_20480)
1302 var hdn: i64 = c_read("knowledge/site/chrome_header.html" as *u8, hdrbuf, K_MAGIC_20479)
1303 if hdn < 0 { hdn = 0 }
1304 hdrbuf[hdn] = 0 as u8
1305 let ftbuf: *u8 = sys_mmap(K_MAGIC_20480)
1306 var ftn: i64 = c_read("knowledge/site/chrome_footer.html" as *u8, ftbuf, K_MAGIC_20479)
1307 if ftn < 0 { ftn = 0 }
1308 ftbuf[ftn] = 0 as u8
1309 w(1, "<" as *u8); wc(1, 33); w(1, "DOCTYPE html>\n<html lang=\"en\"><head><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1'>\n" as *u8)
1310 sc_feed_link(1)
1311 w(1, "<title>" as *u8); w(1, title); w(1, " -- Nishi Compare</title>\n<style>\n" as *u8)
1312 // THREE THEMES AS TOKENS (2026-08-13, operator: white ground hurts legibility + honor the e-ink lane).
1313 // PAPER = low-glare default. INK = the e-ink profile: tones taken from the incumbent nx_eink_tone CIE L*
1314 // ladder (white / L*67 ~ rgb(168) / L*33 ~ rgb(78) / black) -- no mid-greys, accent collapses to black, and
1315 // the state marks are SHAPE-distinct so the matrix survives monochrome. DARK = the charcoal register.
1316 // PALETTE + THEME + BREAKPOINTS now come from sc_theme_pass in nx_swcompare_lib.nx, which
1317 // emits them from the estate's token SSOT (nx_brand_tokens). This replaced the light :root
1318 // AND the html[data-theme='dark'] literal that used to sit here: the dark values are now
1319 // declared ONCE as data and emitted TWICE -- under the chip selector and under
1320 // @media(prefers-color-scheme:dark){:root:not([data-theme]){...}} -- so the chip theme and
1321 // the OS-preference theme CANNOT drift apart. The guard on that media block is load-bearing;
1322 // sc_theme_pass documents why (paper is the bare :root default and sett() sets data-theme for
1323 // it, so an unguarded block would repaint an explicit Paper choice on an OS-dark machine).
1324 sc_theme_pass(1)
1325 // INK stays a literal HERE, deliberately: it is a THIRD theme and nx_brand_tokens' format
1326 // expresses exactly two keywords (token|/dark|). Bending the SSOT to carry a third register
1327 // for one page would be a schema change driven by a single caller. It now overrides the
1328 // --nx-color-* SSOT names rather than the short names, because the short names became
1329 // var() ALIASES in sc_theme_pass -- overriding an alias would be overriding the pointer
1330 // instead of the value, and ink would silently stop working for every aliased token.
1331 w(1, "html[data-theme='ink']{--nx-color-bg:rgb(255,255,255);--nx-color-fg:rgb(0,0,0);--nx-color-accent:rgb(0,0,0);--nx-color-panel:rgb(255,255,255);--nx-color-soft:rgb(255,255,255);--nx-color-tint:rgb(255,255,255);--nx-color-line:rgb(168,168,168);--nx-color-mut:rgb(78,78,78);--nx-color-faint:rgb(78,78,78);--nx-color-gk:rgb(0,0,0);--nx-color-goff:rgb(168,168,168);--nx-color-ghalf:rgb(78,78,78);--nx-color-codebg:rgb(255,255,255)}\n" as *u8)
1332 w(1, ".tchip{font-size:10.5px;letter-spacing:.06em;padding:4px 10px;border:1px solid var(--line);border-radius:999px;background:none;color:var(--mut);cursor:pointer;font-weight:600;text-transform:uppercase;margin-left:6px}.tchip.on{background:var(--fg);border-color:var(--fg);color:var(--bg)}.tgroup{margin-left:auto}\n" as *u8)
1333 // ONE LAYOUT EMITTER (2026-08-31). This body rule was byte-identical in intent to the one in
1334 // nx_swcompare_sota and five other generators, and the family had already drifted to SIX page
1335 // widths -- so it moved into sc_layout_pass. This page's OWN rendering is unchanged by the move
1336 // (it already read both layout tokens); what it GAINS is the min-width:0 guard that stops a wide
1337 // table forcing horizontal scroll onto the document, and overflow-wrap on the long monospace
1338 // identifiers that are the only real width bombs in a .pl table.
1339 sc_layout_pass(1)
1340 if have_sota == 1 { sl_css(1) }
1341 w(1, ".eyebrow{letter-spacing:.14em;text-transform:uppercase;font-size:.72rem;color:var(--mut);margin:22px 0 6px}.eyebrow b{color:var(--ac);font-weight:600}h1{font-size:clamp(1.7rem,4vw,2.3rem);line-height:1.15;margin:0 0 8px;color:var(--fg);text-wrap:balance}.sub{color:var(--mut);font-size:clamp(.93rem,2vw,1.02rem);margin:0 0 8px;max-width:74ch}.crumb{font-size:.82rem;margin:14px 0 2px;color:var(--mut)}a{color:var(--ac)}\n" as *u8)
1342 w(1, ".skip-link{position:absolute;left:-999px;top:0;background:var(--ac);color:var(--nx-color-bg);padding:12px 16px;z-index:9;border-radius:0 0 8px 0}.skip-link:focus{left:0}\n" as *u8)
1343 w(1, ".hd{border-bottom:1px solid var(--line);margin:0 0 8px}.hd nav{display:flex;gap:6px;flex-wrap:wrap;padding:10px 0}.hd a{color:var(--fg);text-decoration:none;padding:8px 12px;border-radius:8px;font-weight:600;min-height:44px;display:inline-flex;align-items:center}.hd a:hover{background:var(--soft)}\n" as *u8)
1344 // MEASURE CAP (2026-08-25): .meth and .verdict were the only prose blocks on the page with NO
1345 // max-width, so they inherited body's 1100px and set ~140-145 characters per line -- about 1.8x the
1346 // WCAG 1.4.8 (AAA) 80-character ceiling, and nearly 2x the 45-75 range typography practice uses for
1347 // body copy. They are bordered prose callouts, exactly the shape .answer already is, and .answer was
1348 // ALREADY capped at 72ch three rules away -- so this makes them consistent with their own sibling
1349 // rather than introducing a new value. text-wrap:pretty additionally suppresses orphaned last words
1350 // and is ignored by engines that do not implement it, so it degrades to today's rendering.
1351 w(1, ".meth{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:14px 18px;margin:16px 0;font-size:.88rem;color:var(--mut);max-width:var(--nx-layout-measure);text-wrap:pretty}.meth b{color:var(--fg)}\n" as *u8)
1352 w(1, ".legend{font-size:12.5px;color:var(--mut);margin:10px 0}.legend .m{margin-right:15px;white-space:nowrap}.legend .g{font-size:15px;vertical-align:-1px;margin-right:5px}\n" as *u8)
1353 w(1, ".stats{font-size:13.5px;color:var(--mut);margin:0 0 10px}.stats b{color:var(--fg);font-weight:600;font-variant-numeric:tabular-nums}.stats .sep{margin:0 10px;color:var(--line)}\n" as *u8)
1354 w(1, "table{width:100%;border-collapse:collapse;margin:4px 0}th{font-size:11px;letter-spacing:.09em;text-transform:uppercase;color:var(--mut);font-weight:600;text-align:center;padding:9px 8px;border-bottom:1px solid var(--fg)}th:first-child{text-align:left;padding-left:0}th.ni{color:var(--ac)}\n" as *u8)
1355 w(1, "td{border-bottom:1px solid var(--line);padding:11px 6px;text-align:center;font-size:16px;line-height:1.3}td:first-child{text-align:left;padding-left:0;font-size:13.5px;font-weight:500;max-width:360px}td.ni{background:var(--tint);color:var(--ac);font-size:17px}\n" as *u8)
1356 w(1, ".g{color:var(--gk)}.g.off{color:var(--goff)}.g.half{color:var(--ghalf)}td.ni .g{color:var(--ac)}td.ni .g.off{color:var(--goff)}\n" as *u8)
1357 w(1, "tr.grp td{padding:24px 0 6px;font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;color:var(--faint);font-weight:600;text-align:left;background:none;border-bottom:1px solid var(--line)}\n" as *u8)
1358 w(1, "details{display:inline}details summary{cursor:pointer;list-style:none;display:inline}details summary::-webkit-details-marker{display:none}details summary:hover{color:var(--ac)}details summary::after{content:' >';color:var(--faint);font-weight:400}details[open] summary::after{content:' <'}\n" as *u8)
1359 w(1, ".ev{display:block;margin:8px 0 4px;padding:10px 12px;background:var(--tint);border-left:2px solid var(--ac);font-size:12.5px;line-height:1.7;color:var(--mut);font-weight:400;text-align:left}.ev code{font-family:var(--mono);font-size:11.5px;color:var(--fg);background:var(--codebg);padding:1px 5px;border-radius:4px}.ev a{color:var(--ac)}\n" as *u8)
1360 w(1, ".fbar{position:sticky;top:0;background:var(--bg);padding:11px 0 9px;border-bottom:1px solid var(--line);display:flex;gap:8px;flex-wrap:wrap;align-items:center;z-index:5}.fbar input{flex:1 1 220px;min-width:170px;padding:8px 12px;font-size:14px;border:1px solid var(--line);border-radius:8px;background:var(--panel);color:var(--fg)}\n" as *u8)
1361 w(1, ".fchip{font-size:12px;padding:6px 12px;border:1px solid var(--line);border-radius:999px;background:none;color:var(--mut);cursor:pointer;font-weight:500}.fchip.on{background:var(--ac);border-color:var(--ac);color:var(--bg)}.cnt{font-size:12px;color:var(--faint);margin-left:auto;font-variant-numeric:tabular-nums}\n" as *u8)
1362 w(1, ".ghead{letter-spacing:.13em;text-transform:uppercase;font-size:.72rem;color:var(--ac);margin:28px 0 2px;font-weight:650;border-bottom:1px solid var(--line);padding-bottom:6px}\n" as *u8)
1363 w(1, ".watch{display:block;font:11px/1.7 var(--mono);color:var(--mut);font-weight:400}.watch b{color:var(--ac);font-weight:500}\n" as *u8)
1364 w(1, ".pstate{display:block;font:10px/1.8 var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--y)}.pstate.note{color:var(--mut)}\n" as *u8)
1365 w(1, ".layer{font-size:10.5px;letter-spacing:.2em;text-transform:uppercase;color:var(--bg);background:var(--ac);display:inline-block;padding:3px 10px;border-radius:4px;font-weight:700;margin:42px 0 2px}\n" as *u8)
1366 w(1, ".lnav{border-bottom:1px solid var(--line);padding:9px 0;margin:2px 0 14px;font-size:11px}.lnav a{color:var(--mut);text-decoration:none;margin-right:16px;letter-spacing:.06em;text-transform:uppercase;font-weight:600}.lnav a:hover{color:var(--ac)}\n" as *u8)
1367 w(1, ".lead{font-size:inherit;line-height:1.65;max-width:var(--nx-layout-measure);margin:10px 0;color:var(--mut)}.lead b{color:var(--fg)}.lead a{color:var(--ac)}\n" as *u8)
1368 w(1, ".answer{border-left:3px solid var(--ac);background:var(--tint);padding:12px 18px;margin:12px 0;font-size:inherit;line-height:1.6;max-width:var(--nx-layout-measure);color:var(--mut)}.answer b{color:var(--fg)}\n" as *u8)
1369 w(1, ".pl{width:100%;border-collapse:collapse;margin:8px 0}.pl th{font-size:10.5px;text-align:left;padding:8px 10px 8px 0;border-bottom:1px solid var(--fg);color:var(--mut);text-transform:uppercase;letter-spacing:.09em}.pl td{border-bottom:1px solid var(--line);padding:10px 10px 10px 0;font-size:13px;line-height:1.5;vertical-align:top;text-align:left;max-width:none}.pl td.r{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}.pl .ct{font-family:var(--mono);font-size:11.5px;color:var(--ac)}.pl .ex{font-size:10px;text-transform:uppercase;letter-spacing:.06em;border:1px solid var(--line);border-radius:4px;padding:2px 7px;color:var(--mut);white-space:nowrap}\n" as *u8)
1370 w(1, "h2{letter-spacing:.12em;text-transform:uppercase;font-size:.78rem;color:var(--mut);margin:34px 0 6px;font-weight:600}@media(max-width:700px){td:first-child{max-width:none;font-size:12.5px}th,td{padding:9px 3px}}\n" as *u8)
1371 w(1, ".refs{margin:6px 0 0;padding-left:0;list-style:none}.refs li{border-bottom:1px solid var(--line);padding:10px 0;font-size:13px;line-height:1.6;max-width:86ch}.rkey{font-family:var(--mono);font-size:11.5px;color:var(--ac);margin-right:6px}.rlinks{color:var(--mut);font-size:12px}.rlinks code{font-family:var(--mono);font-size:11px;background:var(--codebg);padding:1px 5px;border-radius:4px;color:var(--fg)}.rgrade{font-size:10px;text-transform:uppercase;letter-spacing:.06em;border:1px solid var(--line);border-radius:4px;padding:1px 6px;color:var(--mut);white-space:nowrap}.rg{display:block;font-size:12px;color:var(--faint);margin-top:3px}.cite{font-family:var(--mono);font-size:11px;text-decoration:none}\n" as *u8)
1372 w(1, ".verdict{background:var(--panel);border:1px solid var(--line);border-left:4px solid var(--ac);padding:13px 18px;border-radius:0 12px 12px 0;margin:18px 0;font-size:.92rem;color:var(--mut);max-width:var(--nx-layout-measure);text-wrap:pretty}.verdict b{color:var(--fg)}.foot{margin-top:30px;color:var(--mut);font-size:.76rem;border-top:1px solid var(--line);padding-top:14px;font-family:ui-monospace,Consolas,monospace}\n" as *u8)
1373 w(1, ":focus-visible{outline:3px solid var(--ac);outline-offset:2px}main>*{animation:rise .45s ease both}main>*:nth-child(2){animation-delay:.04s}main>*:nth-child(3){animation-delay:.08s}main>*:nth-child(4){animation-delay:.12s}@keyframes rise{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){main>*{animation:none}}\n" as *u8)
1374 let galcss_fd: i64 = sys_openat_rd(galpath)
1375 if galcss_fd >= 0 { sys_close(galcss_fd)
1376 w(1, ".galgate summary{cursor:pointer;font-size:.82rem;color:var(--ac);padding:10px 12px;background:var(--tint);border-left:2px solid var(--ac)}.galgate[open] summary{margin-bottom:6px}.galv,.gala{width:100%;display:block;background:var(--soft)}.galpre{font:11.5px/1.5 var(--mono);white-space:pre-wrap;overflow-wrap:anywhere;max-height:14em;overflow:auto;background:var(--tint);padding:8px 10px;margin:0}.galt{margin:6px 0}\n" as *u8)
1377 }
1378 w(1, ".gal{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:14px;margin:12px 0}.galf{margin:0;border:1px solid var(--line);border-radius:12px;overflow:hidden;background:var(--panel)}.galf img{width:100%;height:auto;display:block}.galf figcaption{padding:10px 12px;font-size:12.5px;line-height:1.55;color:var(--mut)}.galp{display:block;font:10.5px/1.7 var(--mono);color:var(--faint);margin-top:4px}.galmiss{border:1px dashed var(--line);border-radius:10px;padding:10px 12px;font-size:12.5px;color:var(--mut)}.galmiss code{font-family:var(--mono);font-size:11px;background:var(--codebg);padding:1px 5px;border-radius:4px;color:var(--fg)}.galprobe{margin:6px 12px 10px}.galprobe summary{font:10.5px/1.7 var(--mono);color:var(--ac);cursor:pointer}.galprobe pre{white-space:pre-wrap;word-break:break-all;font:10.5px/1.6 var(--mono);background:var(--codebg);padding:8px 10px;border-radius:8px;max-height:220px;overflow:auto;margin:4px 0 0}\n" as *u8)
1379 w(1, ".pc{font-size:12px;line-height:1.5;margin-top:5px;color:var(--mut)}.pc span{display:block}.pc .pro b{color:var(--y);margin-right:4px}.pc .con b{color:var(--n);margin-right:4px}.watch.con{border-color:var(--n);color:var(--n)}\n" as *u8)
1380 w(1, ".cnt,.rg,.galp,tr.grp td{color:var(--mut)}\n" as *u8)
1381 // THE PRINT SHEET GOES LAST (datavis DV7, 2026-09-15): order is its specificity -- see sc_print_css in nx_swcompare_lib
1382 sc_print_css(1)
1383 w(1, "</style>\n" as *u8)
1384 // theme applied BEFORE first paint so a chosen ground never flashes the default one
1385 w(1, "<script>(function(){var t;try{t=localStorage.getItem('nx-theme')}catch(e){}if(t){document.documentElement.setAttribute('data-theme',t)}})()</script>\n" as *u8)
1386 w(1, "</head><body>\n" as *u8)
1387 w(1, "<a class='skip-link' href='" as *u8); wc(1, 35); w(1, "main'>Skip to content</a>\n" as *u8)
1388 if hdn > 0 { w(1, hdrbuf) } else { w(1, "<header class='hd'><nav><a href='/'>Nishi Family</a><a href='/compare'>Compare</a></nav></header>" as *u8) }
1389 w(1, "<main id='main'>\n" as *u8)
1390 w(1, "<p class='crumb'><a href='/'>Nishi Family</a> › <a href='/compare'>Compare</a> › " as *u8); w(1, title); w(1, "</p>\n" as *u8)
1391 w(1, "<div style='display:flex;align-items:center;flex-wrap:wrap;gap:6px'><p class='eyebrow'><b>Nishi Compare</b> · measured, not asserted</p>" as *u8)
1392 w(1, "<span class='tgroup'><button class='tchip on' data-th='paper'>Paper</button><button class='tchip' data-th='ink'>Ink</button><button class='tchip' data-th='dark'>Dark</button></span></div>\n" as *u8)
1393 w(1, "<h1>" as *u8); w(1, title); w(1, "</h1>\n<p class='sub'>Nishi vs the field — every Nishi cell is measured against real organ source at emit time; each gap names the watch contract that will close it.</p>\n" as *u8)
1394 if (sub as i64) != 0 { w(1, "<p class='sub' style='font-size:.88rem'>" as *u8); w(1, sub); w(1, "</p>\n" as *u8) }
1395 // A domain that declares knowledge/compare/<dom>.plan leads with the executive answer and the
1396 // dependency-ordered path; the matrix then becomes Layer 3, the evidence behind both.
1397 let planpath: *u8 = sys_mmap(600)
1398 var plo: i64 = scopy(planpath, 0, "knowledge/compare/" as *u8)
1399 plo = scopy(planpath, plo, domain)
1400 plo = scopy(planpath, plo, ".plan" as *u8)
1401 planpath[plo] = 0 as u8
1402 var haveplan: i64 = 0
1403 let plfd: i64 = sys_openat_rd(planpath)
1404 if plfd >= 0 { sys_close(plfd); haveplan = 1 }
1405 let planbuf: *u8 = sys_mmap(K_MAGIC_20480)
1406 if haveplan == 1 {
1407 w(1, "<nav class='production-nav' aria-label='Domain sections'><a href='#exec'>Overview</a><a href='#roadmap'>Production map</a><a href='#eng'>Capability comparisons</a><a href='#delivery-evidence'>Delivery and evidence</a></nav>\n" as *u8)
1408 sc_production_open(1, "exec" as *u8, "Overview" as *u8, "The purpose, declared position and evidence coverage of this domain. Source presence and completed acceptance are different measures." as *u8)
1409 plan_pass_heading(planpath, planbuf, K_MAGIC_20479, 1, 3)
1410 }
1411 // PRESENT = measured-plus-exceeds. Reporting present_c alone read as "12 of 24" while 15 rows were
1412 // in fact measured, because the exceeds are counted in their own bucket -- a partition that does
1413 // not sum in the reader's head is a wrong number with an authoritative typeface.
1414 w(1, "<p class='stats'><b>" as *u8); wn(1, present_c + exceeds_c); w(1, "</b> of <b>" as *u8); wn(1, rown); w(1, "</b> capabilities measured<span class='sep'>|</span><b>" as *u8); wn(1, exceeds_c)
1415 w(1, "</b> of them measured exceeds<span class='sep'>|</span><b>" as *u8); wn(1, absent_c); w(1, "</b> open<span class='sep'>|</span>coverage <b>" as *u8); wn(1, coverage); w(1, "</b>/1000" as *u8)
1416 // CE2: adoption beside coverage -- a presence number alone is the partial-deploy blind spot
1417 w(1, "<span class='sep'>|</span>adoption <b>" as *u8); wn(1, adopt_full); w(1, "</b> full / <b>" as *u8); wn(1, adopt_partial); w(1, "</b> partial</p>\n" as *u8)
1418 // CE7: THE GAP PROFILE, FOR EVERY DOMAIN. Placed DELIBERATELY OUTSIDE the haveplan guard.
1419 // Beside rank_pass it would have been skipped for every plan-less board -- and a board with
1420 // no plan is exactly the one whose gaps most need publishing. That skip would have been
1421 // silent, and a silently absent band reads as a board with nothing to report.
1422 if haveplan == 1 { ev_pass_heading(domain, 3) } else { ev_pass(domain) }
1423 if haveplan == 1 {
1424 sc_production_close(1)
1425 sc_production_open(1, "roadmap" as *u8, "Production map" as *u8, "Follow the dependencies, declared acceptance criteria and recorded priorities. Inspect source binding before treating a rank as executable work." as *u8)
1426 // CE6 (2026-08-23): THE ORDER, WHERE A HUMAN READS IT. nx_compare_rank computes the priority of every
1427 // open rung from the boards and writes knowledge/compare/<dom>.rank (one line per rung, stamped);
1428 // the roadmap table below this used to render rungs in plan-file declaration order, so "the ranker
1429 // is the order" was a doctrine with no surface. FINISH rows come first: rungs whose symbol is
1430 // present but whose organ is short of full adoption -- the cheapest closures on the board.
1431 w(1, "<p class='meth'>Ranking source binding: <b>" as *u8)
1432 if (ladder_model as i64) == 0 { w(1, "UNAVAILABLE" as *u8) } else { w(1, sg_rank_state(ladder_model)) }
1433 w(1, "</b>. Recorded priorities require current acceptance evidence and resource checks before execution.</p>\n" as *u8)
1434 rank_pass_heading(domain, RANK_READ_CAP, 3)
1435 sc_heading_open(1, 3, "" as *u8); w(1, "Declared roadmap — contract, acceptance, executor, effort" as *u8); sc_heading_close(1, 3); w(1, "\n" as *u8)
1436 plan_pass_heading(planpath, planbuf, K_MAGIC_20479, 2, 3)
1437 sg_html_heading(ladder_model, 1, 3)
1438 sc_production_close(1)
1439 }
1440 sc_production_open(1, "eng" as *u8, "Capability comparisons" as *u8, "Compare the field, search individual capabilities and open their source and adoption evidence. Documented presence does not establish comparative quality." as *u8)
1441 // THE POSITION MAP (2026-09-15): the four-quadrant centrality/distinctiveness map projected from the cells
1442 // measured above, rendered by the base for both generators, with the day spine as its time axis
1443 cdmap_pass_heading(domain, 1, 1, cf, ncol, rf, SWC_ROW_STRIDE, rnishi, rown, 3)
1444 w(1, "<div class='meth'><b>How this is scored.</b> Every <b>Nishi</b> mark is <b>measured</b>: the generator reads the real organ source on disk and requires the implementing symbol to exist (no self-grading). A <b>watching</b> tag names the organ and symbol contracted to close a gap — the mark flips itself on the next compare beat when that workstream ships, and the <code>comparewatch-</code> plane row flips with it. A <b>dark</b> tag means the organ file EXISTS but does not declare the contracted symbol: something shipped there under another name, and until the contract is repointed to the real entry point (the plan rung and this row) or the function is renamed, that capability is invisible to this board — a build lost to darkness, named so it is not. <b>The flip is necessary, not sufficient:</b> it proves the symbol exists, never that the capability is good. The bar is the rung's pre-declared done-rule, proven by its gate — a symbol shipped without the behaviour behind it is a defect, and the flip is exactly what makes that defect visible instead of quiet. Competitor marks record <b>documented capability presence</b> — presence, not depth or scale. <b>Adoption is measured too:</b> every measured row carries where its organ stands on the estate's ladder (source → built → promoted → registered → invoked; libraries by importer reach minus validation importers; gates by the execution surfaces that run them). A row is <b>fully adopted</b> only at the top of its ladder; anything short is tagged <b>partial</b> with the exact remedy, so a build nobody promoted can no longer read as shipped. Census stamps: importers asof " as *u8); wn(1, imp_asof); w(1, ", gate census asof " as *u8); wn(1, ga_asof); w(1, " (unix seconds; -1 = census absent).</div>\n" as *u8)
1445 sc_heading_open(1, 3, "" as *u8); w(1, "Capability matrix — measured against source" as *u8); sc_heading_close(1, 3); w(1, "\n" as *u8)
1446 w(1, "<p class='legend'><span class='m'>" as *u8); mark(1, 2); w(1, " leads / measured exceed</span><span class='m'>" as *u8); mark(1, 1)
1447 w(1, " present</span><span class='m'>" as *u8); mark(1, 3); w(1, " partial</span><span class='m'>" as *u8); mark(1, 0)
1448 w(1, " absent</span> · click any capability for its evidence</p>\n" as *u8)
1449 w(1, "<div class='fbar'><input id='q' type='search' placeholder='Search capabilities, organs, symbols...' aria-label='Search capabilities'>" as *u8)
1450 w(1, "<button class='fchip on' data-f='all'>All</button><button class='fchip' data-f='me'>Measured</button><button class='fchip' data-f='ex'>Exceeds</button><button class='fchip' data-f='wa'>Watching</button><button class='fchip' data-f='dk'>Dark</button><button class='fchip' data-f='pa'>Partial</button><button class='fchip' data-f='ab'>Open</button><span class='cnt' id='cnt'></span></div>\n" as *u8)
1451 w(1, "<div class='table-scroll' role='region' aria-label='Capability comparison' tabindex='0'><table><thead><tr><th>Capability</th><th class='ni'>Nishi</th>" as *u8)
1452 var ci: i64 = 0
1453 while ci < ncol { w(1, "<th>" as *u8); w(1, cf[ci] as *u8); w(1, "</th>" as *u8); ci = ci + 1 }
1454 w(1, "</tr></thead><tbody>\n" as *u8)
1455 let pg: *u8 = sys_mmap(32)
1456 pg[0] = 0 as u8
1457 var rr: i64 = 0
1458 while rr < rown {
1459 let lab: *u8 = rf[rr*SWC_ROW_STRIDE + 0] as *u8
1460 // group = label prefix before ':' within the first 14 chars -> section header on change
1461 var g: i64 = 0
1462 var gi2: i64 = 0
1463 var gstop: i64 = 0
1464 while gstop == 0 {
1465 if gi2 >= 14 { gstop = 1 } else {
1466 let lc: i64 = lab[gi2] as i64
1467 if lc == 0 { gstop = 1 } else { if lc == 58 { g = gi2; gstop = 1 } else { gi2 = gi2 + 1 } }
1468 }
1469 }
1470 var nameoff: i64 = 0
1471 if g > 0 {
1472 var same: i64 = 1
1473 var gk: i64 = 0
1474 var gks: i64 = 0
1475 while gks == 0 { if gk >= g { gks = 1 } else { if pg[gk] != lab[gk] { same = 0; gks = 1 } else { gk = gk + 1 } } }
1476 if same == 1 { let pgt: i64 = pg[g] as i64; if pgt != 0 { same = 0 } }
1477 if same == 0 {
1478 w(1, "<tr class='grp'><td colspan='" as *u8); wn(1, ncol + 2); w(1, "'>" as *u8)
1479 var gc: i64 = 0
1480 while gc < g { wc(1, lab[gc] as i64); gc = gc + 1 }
1481 w(1, "</td></tr>\n" as *u8)
1482 gc = 0
1483 while gc < g { pg[gc] = lab[gc]; gc = gc + 1 }
1484 pg[g] = 0 as u8
1485 }
1486 nameoff = g + 1
1487 let sp2: i64 = lab[nameoff] as i64
1488 if sp2 == 32 { nameoff = nameoff + 1 }
1489 }
1490 let rsym: *u8 = rf[rr*SWC_ROW_STRIDE + 2] as *u8
1491 let rorg: *u8 = rf[rr*SWC_ROW_STRIDE + 1] as *u8
1492 // an UNLANDED watch row: the contract is named and still open. A LANDED one has already had
1493 // its symbol normalised past the prefix upstream, so it reads as an ordinary measured row.
1494 var iswatch: i64 = 0
1495 if starts(rsym, "_ABSENT_:" as *u8) == 1 { iswatch = 1 }
1496 w(1, "<tr class='cx' data-s='" as *u8)
1497 if rnishi[rr] == 2 { w(1, "ex" as *u8) } else {
1498 if rnishi[rr] == 1 { w(1, "me" as *u8) } else {
1499 if iswatch == 1 { if rdark[rr] == 1 { w(1, "dk" as *u8) } else { w(1, "wa" as *u8) } } else { w(1, "ab" as *u8) } } }
1500 w(1, "' data-a='" as *u8)
1501 if radopt[rr] == CLB_FULL { w(1, "full" as *u8) } else { if radopt[rr] == CLB_PARTIAL { w(1, "partial" as *u8) } else { w(1, "na" as *u8) } }
1502 w(1, "' data-t='" as *u8); wlow(1, lab); wc(1, 32); wlow(1, rorg); wc(1, 32); wlow(1, rsym); wc(1, 32); wlow(1, rtok[rr] as *u8); w(1, "'>" as *u8)
1503 w(1, "<td><details><summary>" as *u8); w(1, (lab as i64 + nameoff) as *u8); w(1, "</summary><span class='ev'>" as *u8)
1504 // EVIDENCE, DERIVED -- never prose typed by a seat: what was measured, in which organ, by which rule.
1505 if rnishi[rr] == 2 {
1506 w(1, "Measured exceed: <code>" as *u8); w(1, rsym); w(1, "</code> in <code>" as *u8); w(1, rorg); w(1, "</code>, verified at emit. " as *u8)
1507 } else {
1508 if rnishi[rr] == 1 {
1509 w(1, "Measured: <code>" as *u8); w(1, rsym); w(1, "</code> exists in <code>" as *u8); w(1, rorg); w(1, "</code>, verified at emit. " as *u8)
1510 } else {
1511 if iswatch == 1 {
1512 if rdark[rr] == 1 {
1513 w(1, "DARK — <code>" as *u8); w(1, rorg); w(1, "</code> EXISTS but does not declare <code>" as *u8); w(1, (rsym as i64 + 9) as *u8)
1514 w(1, "</code>: something shipped at this path under another name, and this mark would read open forever. Repoint the contract to the real entry point (the plan rung AND this row) or rename the function; the flip follows on the next beat, and the <code>comparewatch-</code> plane row reads DARK until then. " as *u8)
1515 } else {
1516 w(1, "Open — watching <code>" as *u8); w(1, rorg); w(1, "</code> : <code>" as *u8); w(1, (rsym as i64 + 9) as *u8)
1517 w(1, "</code>, re-measured on every compare beat. Ship that symbol and this mark flips itself; the <code>comparewatch-</code> plane row flips with it. " as *u8)
1518 }
1519 } else {
1520 w(1, "Open — no implementing organ is measured for this axis yet. " as *u8)
1521 } } }
1522 wnote(1, rf[rr*SWC_ROW_STRIDE + 4 + ncol] as *u8)
1523 // RIVAL-CLAIM PROVENANCE (2026-09-05): a row that grades a rival with no reference mark says so in its own evidence
1524 let rvc: i64 = rv_class(rf[rr*SWC_ROW_STRIDE + 4 + ncol] as *u8, rf, rr, SWC_ROW_STRIDE, ncol)
1525 if rvc == RV_UNCITED { w(1, " <span class='watch con'>rival marks uncited — the Yes, Best or Part codes on this row are an observation read with no reference mark behind them</span>" as *u8) }
1526 // CE2: the ladder state, in the evidence for every measured row
1527 if radopt[rr] != CLB_NA {
1528 w(1, " <b>Adoption:</b> <code>" as *u8); w(1, rtok[rr] as *u8); w(1, "</code>" as *u8)
1529 if radopt[rr] == CLB_FULL { w(1, " — fully adopted (top of its ladder)." as *u8) } else { w(1, " — PARTIAL: " as *u8); w(1, rrem[rr] as *u8); w(1, "." as *u8) }
1530 }
1531 w(1, "</span></details>" as *u8)
1532 if iswatch == 1 { w(1, "<span class='watch'>watching <b>" as *u8); w(1, (rsym as i64 + 9) as *u8); w(1, "</b></span>" as *u8) }
1533 if radopt[rr] == CLB_PARTIAL { w(1, "<span class='watch con' title='" as *u8); w(1, rtok[rr] as *u8); w(1, "'>not adopted: " as *u8); w(1, rrem[rr] as *u8); w(1, "</span>" as *u8) }
1534 pc_strip(1, rnishi[rr], rexceed[rr], iswatch, radopt[rr], rrem[rr] as *u8, cf, ncol, rf, rr)
1535 w(1, "</td>" as *u8)
1536 mark_td(1, "Nishi" as *u8, rnishi[rr], 1)
1537 var cj: i64 = 0
1538 while cj < ncol {
1539 let cn2: *u8 = cf[cj] as *u8
1540 mark_td(1, cn2, atoi(rf[rr*SWC_ROW_STRIDE + 4 + cj] as *u8), 0)
1541 cj = cj + 1
1542 }
1543 w(1, "</tr>\n" as *u8)
1544 rr = rr + 1
1545 }
1546 w(1, "</tbody></table></div>\n" as *u8)
1547 // RIVAL-CLAIM PROVENANCE (2026-09-05): the page's own count of rival claims and how many carry a reference mark
1548 w(1, "<div class='meth' id='rivalprov'><b>Rival-claim provenance.</b> Every Yes, Best or Part mark in a rival column is a claim about someone else's product. rows with rival marks " as *u8); wn(1, rv_rows)
1549 w(1, " · cited " as *u8); wn(1, rv_cited); w(1, " · uncited " as *u8); wn(1, rv_uncited)
1550 w(1, ". A cited row carries a reference mark that resolves to a pinned mirror (the refs gate measures that); an uncited row is an observation read and is badged in its evidence until a reference lands. The badge is the receipt, never the proof: a mark proves a mirror exists, not that the mirror supports the code.</div>\n" as *u8)
1551 sc_production_close(1)
1552 sc_production_open(1, "delivery-evidence" as *u8, "Delivery and evidence" as *u8, "Inspect risks, technical debt, rendered observations, experiments and references. Read scope and limitations alongside every result." as *u8)
1553 if haveplan == 1 {
1554 plan_pass_heading(planpath, planbuf, K_MAGIC_20479, 3, 3)
1555 w(1, "<div class='meth'><b>On these two registers.</b> Rows are declared in the domain's plan file and carry the <b>debt id</b>, which is the join key back to the sovereign debt plane — that plane, not this page, is the authority on state. Reconciling them automatically (the regen reading the plane and refreshing these rows) is a named, owed rung; until it lands, treat an id here as a pointer to look up, not a status to trust.</div>\n" as *u8)
1556 }
1557 // THE SOTA FIELD (2026-09-02): the grade grid with measured bindings, one pass, only when a .sota exists
1558 if have_sota == 1 { sl_html_heading(sst, domain, 1, 3) }
1559 // rendered evidence: only when knowledge/compare/<domain>.gallery exists (publish-then-link, gal_pass)
1560 gal_pass_heading(galpath, planbuf, K_MAGIC_20479, 1, domain, 3)
1561 // evidence affordance: only when knowledge/compare/<domain>.gates exists (this domain has executable proofs)
1562 let gpath: *u8 = sys_mmap(256)
1563 var go: i64 = 0
1564 let gp1: *u8 = "knowledge/compare/"
1565 var gi: i64 = 0
1566 while gp1[gi] != (0 as u8) { gpath[go] = gp1[gi]; go = go + 1; gi = gi + 1 }
1567 var gd: i64 = 0
1568 while domain[gd] != (0 as u8) { gpath[go] = domain[gd]; go = go + 1; gd = gd + 1 }
1569 let gp2: *u8 = ".gates"
1570 var gj: i64 = 0
1571 while gp2[gj] != (0 as u8) { gpath[go] = gp2[gj]; go = go + 1; gj = gj + 1 }
1572 gpath[go] = 0 as u8
1573 let gfd: i64 = sys_openat_rd(gpath)
1574 if gfd >= 0 {
1575 sys_close(gfd)
1576 w(1, "<div class='meth' style='border-left:4px solid var(--y)'><b>Evidence for every claim.</b> This is not an opinion matrix: each capability we mark present is <b>grounded in real source</b> and proven by a <b>live-forked gate</b>. See the autonomously-generated <a href='/compare/" as *u8); w(1, domain); w(1, "/evidence'><b>evidence page →</b></a> (per-axis source lines + executed self-test verdicts) or the machine-readable <a href='/compare/" as *u8); w(1, domain); w(1, "/evidence.json'>evidence.json</a>.</div>\n" as *u8)
1577 }
1578 if (verdict as i64) != 0 {
1579 w(1, "<div class='verdict'><b>Honest verdict.</b> " as *u8); wnote(1, verdict); w(1, "</div>\n" as *u8)
1580 } else {
1581 w(1, "<div class='verdict'><b>Honest verdict.</b> The coverage above is capability <b>presence measured against source</b> — not depth, scale, or polish, where mature rivals may lead. Exceeds are claimed only where a mechanism backs them. Every open gap is a <b>watch contract</b>: it names the organ and symbol that closes it, and this page flips the cell itself when that workstream ships.</div>\n" as *u8)
1582 }
1583 // the paper ends with its references; a domain without a .refs file emits byte-identically here
1584 // MEASURED HEAD-TO-HEAD RECEIPT (2026-09-01): rendered by the base for both generators; absent file = no section
1585 bench_pass_heading(domain, 1, 1, 3)
1586 // LEADERBOARDS (ecosystem EC44, 2026-09-15): <dom>.leaderboard rendered by the base with the estate's row placed by the ruler; absent file = no section
1587 lbp_pass_heading(domain, 1, 1, 3)
1588 // FOREIGN ASSETS (sovereignty SV13, 2026-09-16): <dom>.assets rendered by the base for both generators with each asset's licence, bytes, replacement rung and lift; absent file = no section
1589 assets_pass_heading(domain, 1, 1, 3)
1590 ppp_pass_heading(domain, 1, 1, 3)
1591 // MINED INTELLIGENCE (intelmine IM3, 2026-09-05): <dom>.proposed rows from nx_intelmine_propose, rendered by the base for both generators; absent file = no section
1592 prop_pass_heading(domain, 1, 1, 3)
1593 // THE DISCOVERED FIELD (fieldwatch FW1, 2026-09-05): <dom>.field rendered by the base for both generators, with this matrix's @cols measured as a subset of it; absent file = no section
1594 field_pass_heading(domain, 1, 1, cf, ncol, 3)
1595 // GAUGE HEARTBEATS (codeeffectiveness CE9, 2026-09-06): <dom>.gauge rendered by the base for both generators; a stale gauge reads STALE, never zero; absent file = no section
1596 gauge_pass_heading(domain, 1, 1, 3)
1597 gaps_pass_heading(domain, 1, 1, 3)
1598 refs_pass(refspath, planbuf, K_MAGIC_20479, 1, domain, RP_HDR)
1599 sc_production_close(1)
1600 w(1, "<p class='foot'>generated by nx_swcompare_matrix (sovereign NishiLang organ) from knowledge/compare/" as *u8); w(1, domain); w(1, ".matrix · source checks show implementation presence; runtime and user-outcome evidence are reported separately · JavaScript supports page controls</p>\n" as *u8)
1601 // PRESENTATION SHIM ONLY (the JS-interop law): theme selection + row filtering. No comparison
1602 // logic lives here -- every mark was decided by the organ before a byte of this page was written.
1603 w(1, "<script>\n" as *u8)
1604 w(1, "var tc=[].slice.call(document.querySelectorAll('.tchip'));function sett(n){document.documentElement.setAttribute('data-theme',n);try{localStorage.setItem('nx-theme',n)}catch(e){}for(var i=0;i<tc.length;i=i+1){if(tc[i].getAttribute('data-th')===n){tc[i].className='tchip on'}else{tc[i].className='tchip'}}}\n" as *u8)
1605 w(1, "for(var j=0;j<tc.length;j=j+1){tc[j].addEventListener('click',(function(c){return function(){sett(c.getAttribute('data-th'))}})(tc[j]))}\n" as *u8)
1606 w(1, "(function(){var t;try{t=localStorage.getItem('nx-theme')}catch(e){}if(t){for(var k=0;k<tc.length;k=k+1){if(tc[k].getAttribute('data-th')===t){tc[k].className='tchip on'}else{tc[k].className='tchip'}}}})();\n" as *u8)
1607 w(1, "var q=document.getElementById('q'),ch=[].slice.call(document.querySelectorAll('.fchip')),rows=[].slice.call(document.querySelectorAll('tr.cx')),st='all';\n" as *u8)
1608 w(1, "function ap(){if(q==null){return}var t=(q.value||'').toLowerCase(),n=0;rows.forEach(function(r){var s=r.getAttribute('data-s'),m=(st==='all')||(s===st)||((st==='pa')&&(r.getAttribute('data-a')==='partial')),h=(t==='')||((r.getAttribute('data-t')+' '+r.textContent.toLowerCase()).indexOf(t)>=0),ok=m&&h;r.style.display=ok?'':'none';if(ok){n=n+1}});[].slice.call(document.querySelectorAll('.galf,.galmiss')).forEach(function(g){var gh=(t==='')||((g.getAttribute('data-t')||'').indexOf(t)>=0);g.style.display=gh?'':'none'});\n" as *u8)
1609 w(1, "[].slice.call(document.querySelectorAll('tr.grp')).forEach(function(g){var e=g.nextElementSibling,any=false;while(e&&(e.className.indexOf('grp')<0)){if((e.className.indexOf('cx')>=0)&&(e.style.display.indexOf('none')<0)){any=true;e=null}else{e=e.nextElementSibling}}g.style.display=any?'':'none'});\n" as *u8)
1610 w(1, "var c=document.getElementById('cnt');if(c){c.textContent=n+' / '+rows.length+' axes'}}\n" as *u8)
1611 w(1, "if(q){q.addEventListener('input',ap);for(var z=0;z<ch.length;z=z+1){ch[z].addEventListener('click',(function(b){return function(){for(var y=0;y<ch.length;y=y+1){ch[y].className='fchip'}b.className='fchip on';st=b.getAttribute('data-f');ap()}})(ch[z]))}ap()}\n" as *u8)
1612 w(1, "</script>\n" as *u8)
1613 w(1, "</main>\n" as *u8)
1614 if ftn > 0 { w(1, ftbuf) }
1615 w(1, "</body></html>\n" as *u8)
1616 sys_exit(0); return 0
1617 }
1618
1619 w(1, "=== NX-SWCOMPARE-MATRIX domain=" as *u8); w(1, domain); w(1, " -- Nishi MEASURED vs 4 competitors ===\n" as *u8)
1620 w(1, " title=" as *u8); w(1, title); w(1, " rows=" as *u8); wn(1, rown); w(1, " cols=" as *u8); wn(1, ncol); w(1, "\n" as *u8)
1621 var rc: i64 = 0
1622 while rc < rown { con_row(rf[rc*SWC_ROW_STRIDE + 0] as *u8, rnishi[rc]); rc = rc + 1 }
1623 w(1, " TALLY: EXCEEDS=" as *u8); wn(1, exceeds_c); w(1, " PRESENT=" as *u8); wn(1, present_c); w(1, " ABSENT=" as *u8); wn(1, absent_c); w(1, " coverage=" as *u8); wn(1, coverage); w(1, "/1000\n" as *u8)
1624 // CE2: the adoption partition of the measured rows, with every partial state named (a count without a worklist is not actionable)
1625 w(1, " ADOPTION: FULL=" as *u8); wn(1, adopt_full); w(1, " PARTIAL=" as *u8); wn(1, adopt_partial); w(1, " of measured=" as *u8); wn(1, present_c + exceeds_c)
1626 w(1, " importers_asof=" as *u8); wn(1, imp_asof); w(1, " gateadjudicate_asof=" as *u8); wn(1, ga_asof)
1627 w(1, " rule_substring_only=" as *u8); wn(1, rule_subonly); w(1, " dark_contracts=" as *u8); wn(1, dark_c); w(1, "\n" as *u8)
1628 // EC10: the histogram, its partition ASSERTED against the tally it must sum to -- a partition is a claim
1629 w(1, " ADOPT-CLASSES:" as *u8)
1630 var mxh_p: i64 = 0
1631 var mxh_sum: i64 = 0
1632 while mxh_p < mxh_n {
1633 w(1, " " as *u8); sys_write(1, mxh_tok[mxh_p] as *u8, mx_tokclass_len(mxh_tok[mxh_p] as *u8)); w(1, "=" as *u8); wn(1, mxh_cnt[mxh_p])
1634 mxh_sum = mxh_sum + mxh_cnt[mxh_p]
1635 mxh_p = mxh_p + 1
1636 }
1637 w(1, " sum=" as *u8); wn(1, mxh_sum + mxh_ovf); w(1, " of=" as *u8); wn(1, adopt_full + adopt_partial); w(1, " overflow=" as *u8); wn(1, mxh_ovf); w(1, "\n" as *u8)
1638 var rp: i64 = 0
1639 while rp < rown { if radopt[rp] == CLB_PARTIAL { w(1, " PARTIAL " as *u8); w(1, rf[rp*SWC_ROW_STRIDE + 1] as *u8); w(1, " " as *u8); w(1, rtok[rp] as *u8); w(1, " -- " as *u8); w(1, rrem[rp] as *u8); w(1, "\n" as *u8) } rp = rp + 1 }
1640
1641 let liar_corpus: i64 = (rown >= 8) as i64
1642 let liar_neg: i64 = (neg == 0) as i64
1643 // WIDENED, NOT REMOVED (2026-09-05): this is a SIZE floor -- did the board MEASURE enough rows to be a comparison --
1644 // and an EXCEEDS row is a measured-present row carrying a stronger claim; the ADOPTION denominator above already
1645 // counts present_c + exceeds_c as measured. Counting PRESENT alone refused /compare/observability (13 EXCEEDS,
1646 // 3 PRESENT, 800/1000 coverage) for being too STRONG on every regen, while exceeds<=flags already guards the
1647 // over-claim direction. The printed label names what is counted.
1648 let liar_present: i64 = (present_c + exceeds_c >= 5) as i64
1649 let liar_exbound: i64 = (exceeds_c <= exflags) as i64
1650 // ★WIDENED, NOT REMOVED. The check exists so a domain cannot quietly drop or invent competitor columns;
1651 // pinning it to exactly 4 also forbade comparing against a RESEARCH bar alongside the product field.
1652 // A floor of 4 keeps the original guarantee (no domain thins its field) while allowing a fifth column.
1653 let liar_cols: i64 = (ncol >= 4) as i64
1654 w(1, " LIAR-KILL: rows>=8=" as *u8); wn(1, liar_corpus); w(1, " neg-control-zero=" as *u8); wn(1, liar_neg)
1655 w(1, " measured>=5=" as *u8); wn(1, liar_present); w(1, " exceeds<=flags=" as *u8); wn(1, liar_exbound); w(1, " cols>=4=" as *u8); wn(1, liar_cols); w(1, "\n" as *u8)
1656 // THE FIELD CENSUS (2026-09-02): the sota liar-kill prints its own lines and its verdict folds in here; a
1657 // sota-only domain (no .matrix) is judged by the field alone -- the matrix floors cannot apply to zero rows.
1658 var sota_ok: i64 = 1
1659 if have_sota == 1 { sota_ok = sl_census(sst, domain, 1) }
1660 var ok: i64 = liar_corpus & liar_neg & liar_present & liar_exbound & liar_cols
1661 // A SOTA-BEARING DOMAIN IS JUDGED BY THE FIELD'S OWN LIAR-KILL (2026-09-02, measured on the first unified regen):
1662 // its .matrix is a WATCH REGISTER (foodscience 9 rows / 3 present, water 8 / 3, livingdocs 7 / 2), not the
1663 // comparison, so the matrix size floors (rows>=8, present>=5, cols>=4) refused five domains that the field pass
1664 // had just judged MEASURED-HONEST and their previous pages were kept. The INTEGRITY teeth stay on every domain
1665 // (the neg-control must be zero, exceeds may not exceed their flags); only the SIZE floors move to the field.
1666 if have_sota == 1 { ok = liar_neg & liar_exbound }
1667 if have_matrix == 0 { ok = 1 }
1668 ok = ok & sota_ok
1669 w(1, "NX-SWCOMPARE-MATRIX domain=" as *u8); w(1, domain); w(1, " coverage=" as *u8); wn(1, coverage); w(1, "/1000 verdict=" as *u8)
1670 if ok == 1 { w(1, "MEASURED-HONEST (liar-killed)\n" as *u8); sys_exit(0); return 0 }
1671 // NAME THE FAILING CONJUNCT (2026-09-02): a compound assertion that will not name which part failed sends every
1672 // reader at the alarming third -- regen #7 refused five thin domains and the line said only "a check failed".
1673 w(1, "RED (a check failed:" as *u8)
1674 if liar_corpus == 0 { w(1, " rows<8" as *u8) }
1675 if liar_neg == 0 { w(1, " neg-control-nonzero" as *u8) }
1676 if liar_present == 0 { w(1, " measured<5" as *u8) }
1677 if liar_exbound == 0 { w(1, " exceeds>flags" as *u8) }
1678 if liar_cols == 0 { w(1, " cols<4" as *u8) }
1679 if sota_ok == 0 { w(1, " sota-field" as *u8) }
1680 w(1, " -- the previous page stays published)\n" as *u8); sys_exit(1); return 1
1681}