nx_sota_drift_gate.nx source
↩ module page · 291 lines · 20157 B
1// nx_sota_drift_gate.nx -- THE REFEREE for MEASURED BINDINGS in the SOTA emitter (2026-09-01).
2// Subject: the promoted nx_swcompare_matrix generator END TO END -- since 2026-09-02 the ONE assembler, which
3// composes the SOTA field from nx_swcompare_sota_lib (this gate used to drive nx_swcompare_sota). The defect this guards: a sota page is
4// hand-graded and rots the moment an organ ships (lang.sota said "no LSP, formatter, incremental builds or
5// stepping debugger" a week after all four landed, and the same class recurred within a week of a hand fix).
6// The emitter now lets a grade row carry `=<organ>:<symbol>` before its note and re-measures it on every
7// publish with the one symbol ruler. This gate PLANTS every drift class on a fixture domain in its own /tmp
8// tree (never in the estate's knowledge tree: a gate must not share a fixture with a production beat) and
9// forks the generator in census, html and json modes:
10// STALE-UNDER (grade No, symbol present) -> counted, named, page badge, census still exit 0
11// UNBACKED (grade Yes, symbol absent) -> counted, named, census REFUSES (exit 1) -- the liar-kill class
12// UNRESOLVED (symbol-only binding, no matrix) and UNREADABLE (organ path absent) -> counted and named
13// an unbound row is NOT counted (the neg-control that keeps the count honest)
14// the drift partition sums to bound
15// The fixture is ASSERTED to have reached its condition before any outcome is asserted, and gv_bite proves the
16// refusal fires on the unbacked fixture and stays silent on the consistent one.
17// exit: 0 GREEN . 1 RED . 3 SKIP (generator or fixture unavailable) license_tier: ORIGINAL No hw writes.
18import "nx_syscalls.nx"
19import "nx_gate_verdict.nx"
20import "nx_tool_run.nx"
21
22const SG_PATH: i64 = 1024
23const SG_FIX: i64 = 16384
24const SG_CAP: i64 = 1048576
25const SG_WORD: i64 = 8
26const SG_ARGV: i64 = 8
27const SG_MODE_RWX: i64 = 493
28const SG_MODE_RW: i64 = 420
29const SG_TIMEOUT_MS: i64 = 60000
30const SG_ROWS: i64 = 22 // above the generator's rows>=20 liar-kill floor
31const SG_NUM_ROWS: i64 = 3 // its quantitative>=3 floor
32const SG_ROOT: *u8 = "/tmp/nx_sota_drift_gate"
33const SG_NL: i64 = 10
34const SG_ZERO: i64 = 48
35const SG_NINE: i64 = 57
36const SG_MINUS: i64 = 45
37
38func sg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
39func sg_cat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64 = off; var i: i64 = 0; while s[i] != (0 as u8) { dst[o] = s[i]; o = o + 1; i = i + 1 } dst[o] = 0 as u8; return o }
40func sg_put(dst: *u8, off: i64, c: i64) -> i64 { dst[off] = c as u8; dst[off + 1] = 0 as u8; return off + 1 }
41func sg_catn(dst: *u8, off: i64, v: i64) -> i64 {
42 var o: i64 = off
43 var m: i64 = v
44 if m < 0 { o = sg_put(dst, o, SG_MINUS); m = 0 - m }
45 let t: *u8 = sys_mmap(32)
46 var k: i64 = 0
47 if m == 0 { t[0] = SG_ZERO as u8; k = 1 }
48 while m > 0 { t[k] = (SG_ZERO + (m % 10)) as u8; m = m / 10; k = k + 1 }
49 var j: i64 = 0
50 while j < k { dst[o] = t[k - 1 - j]; o = o + 1; j = j + 1 }
51 dst[o] = 0 as u8
52 return o
53}
54func sg_find(buf: *u8, n: i64, needle: *u8) -> i64 {
55 let m: i64 = sg_slen(needle)
56 if m == 0 { return 0 - 1 }
57 var i: i64 = 0
58 while i + m <= n {
59 var j: i64 = 0
60 var ok: i64 = 1
61 while j < m { if buf[i + j] != needle[j] { ok = 0; j = m } else { j = j + 1 } }
62 if ok == 1 { return i }
63 i = i + 1
64 }
65 return 0 - 1
66}
67func sg_has(buf: *u8, n: i64, needle: *u8) -> i64 { if sg_find(buf, n, needle) >= 0 { return 1 } return 0 }
68// the integer right after key in buf, -1 when the key is absent
69func sg_num_after(buf: *u8, n: i64, key: *u8) -> i64 {
70 let at: i64 = sg_find(buf, n, key)
71 if at < 0 { return 0 - 1 }
72 var i: i64 = at + sg_slen(key)
73 var v: i64 = 0
74 var any: i64 = 0
75 while i < n {
76 let c: i64 = buf[i] as i64
77 if c < SG_ZERO { break }
78 if c > SG_NINE { break }
79 v = v * 10 + (c - SG_ZERO)
80 any = 1
81 i = i + 1
82 }
83 if any == 0 { return 0 - 1 }
84 return v
85}
86func sg_write(path: *u8, text: *u8) -> i64 {
87 let fd: i64 = sys_openat_wr(path, SG_MODE_RW)
88 if fd < 0 { return 0 - 1 }
89 let n: i64 = sg_slen(text)
90 var off: i64 = 0
91 while off < n { let r: i64 = sys_write(fd, (text as i64 + off) as *u8, n - off); if r <= 0 { sys_close(fd); return 0 - 2 } off = off + r }
92 sys_close(fd)
93 return 0
94}
95func sg_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
96// absolute path of the promoted generator from the caller's CWD: serving root (nishihost), its parent from
97// buildroot, or the fresh build artifact; the FIRST that exists wins and is named
98func sg_resolve_gen(out: *u8) -> i64 {
99 let cwd: *u8 = sys_mmap(SG_PATH)
100 if sys_getcwd(cwd, SG_PATH) <= 0 { return 0 }
101 var k: i64 = 0
102 while k < 4 {
103 var o: i64 = sg_cat(out, 0, cwd)
104 // SUBJECT RE-POINTED 2026-09-02: the field is a lib pass inside the ONE assembler now, so the gate drives
105 // the promoted nx_swcompare_matrix on the same sota-only fixture tree and asserts the same bytes.
106 if k == 0 { o = sg_cat(out, o, "/nx_swcompare_matrix.elf" as *u8) }
107 if k == 1 { o = sg_cat(out, o, "/../nx_swcompare_matrix.elf" as *u8) }
108 if k == 2 { o = sg_cat(out, o, "/buildroot/_build/nx_swcompare_matrix.sov.elf" as *u8) }
109 if k == 3 { o = sg_cat(out, o, "/_build/nx_swcompare_matrix.sov.elf" as *u8) }
110 if sg_exists(out) == 1 { return 1 }
111 k = k + 1
112 }
113 out[0] = 0 as u8
114 return 0
115}
116// the fixture .sota: 8 columns, 22 rows (3 quantitative) so the generator's own liar-kill floors pass, with the
117// drift rows requested. kind: 1 stale-only . 2 unbacked . 3 consistent-only . 4 unresolved . 5 unreadable
118func sg_fixture(dst: *u8, kind: i64) -> i64 {
119 var o: i64 = sg_cat(dst, 0, "@title drift fixture\n@sub fixture\n@verdict fixture verdict\n@cols Nishi|C1|C2|C3|C4|C5|C6|C7\n@cat Q\n" as *u8)
120 var q: i64 = 0
121 while q < SG_NUM_ROWS { o = sg_cat(dst, o, "quant " as *u8); o = sg_catn(dst, o, q); o = sg_cat(dst, o, "|num|1|1|1|1|1|1|1|1|measured 2026-09-01\n" as *u8); q = q + 1 }
122 o = sg_cat(dst, o, "@cat G\n" as *u8)
123 // the two BOUND rows, first: their labels are what the census must name
124 if kind == 1 { o = sg_cat(dst, o, "Bound stale row|g|n|Y|Y|Y|Y|Y|Y|Y|=runtime/fx_organ.nx:fx_present|hand grade No over a present symbol\n" as *u8) }
125 if kind == 2 { o = sg_cat(dst, o, "Bound unbacked row|g|Y|Y|Y|Y|Y|Y|Y|Y|=runtime/fx_organ.nx:fx_absent|hand grade Yes over an absent symbol\n" as *u8) }
126 if kind == 3 { o = sg_cat(dst, o, "Bound consistent yes row|g|Y|Y|Y|Y|Y|Y|Y|Y|=runtime/fx_organ.nx:fx_present|grade Yes over a present symbol\n" as *u8) }
127 if kind == 4 { o = sg_cat(dst, o, "Bound unresolved row|g|n|Y|Y|Y|Y|Y|Y|Y|=fx_nowhere|symbol-only binding with no matrix beside the sota\n" as *u8) }
128 if kind == 5 { o = sg_cat(dst, o, "Bound unreadable row|g|n|Y|Y|Y|Y|Y|Y|Y|=runtime/fx_missing.nx:fx_present|bound organ path does not exist\n" as *u8) }
129 // CE4: kind 6 -- grade Yes, symbol PRESENT in source, organ binary NOT served (no fx_unserved.elf twin): the McCabe shape
130 if kind == 6 { o = sg_cat(dst, o, "Bound unserved row|g|Y|Y|Y|Y|Y|Y|Y|Y|=runtime/fx_unserved.nx:fx_present|grade Yes over a present symbol whose organ binary is not on the serving surface\n" as *u8) }
131 o = sg_cat(dst, o, "Bound consistent no row|g|n|Y|Y|Y|Y|Y|Y|Y|=runtime/fx_organ.nx:fx_absent|grade No over an absent symbol\n" as *u8)
132 // unbound filler rows: never counted as bound (the neg-control)
133 var r: i64 = 0
134 while r < SG_ROWS - SG_NUM_ROWS - 2 { o = sg_cat(dst, o, "unbound row " as *u8); o = sg_catn(dst, o, r); o = sg_cat(dst, o, "|g|Y|Y|Y|Y|Y|Y|Y|Y|filler measured 2026-09-01\n" as *u8); r = r + 1 }
135 return o
136}
137// SUBJECT OVERRIDE (CE4, 2026-09-05): `nx_sota_drift_gate <subject_elf>` drives THAT binary instead of the promoted
138// one, so a staged build is provable BEFORE promote -- the nx_gate_bite `subject` precedent. A relative path is
139// ABSOLUTISED against the caller's CWD here, because sg_run chdirs the child into SG_ROOT and a bare relative path
140// would silently resolve there. An override that does not exist is a NAMED refusal (gv_need), never a fallback.
141func sg_subject_from_argv(a1: *u8, out: *u8) -> i64 {
142 var o: i64 = 0
143 if a1[0] != (47 as u8) {
144 let cwd: *u8 = sys_mmap(SG_PATH)
145 if sys_getcwd(cwd, SG_PATH) <= 0 { out[0] = 0 as u8; return 0 }
146 o = sg_cat(out, 0, cwd)
147 o = sg_cat(out, o, "/" as *u8)
148 }
149 o = sg_cat(out, o, a1)
150 return sg_exists(out)
151}
152func sg_run(gen: *u8, mode: *u8, out: *u8, outlen: *i64) -> i64 {
153 let av: *i64 = sys_mmap(SG_ARGV * SG_WORD) as *i64
154 av[0] = gen as i64; av[1] = ("fx" as *u8) as i64
155 if sg_slen(mode) > 0 { av[2] = mode as i64; av[3] = 0 } else { av[2] = 0 }
156 return tr_run_capture_cwd(gen, av, out, SG_CAP, outlen, SG_TIMEOUT_MS, SG_ROOT)
157}
158
159func main(argc: i64, argv: *i64) -> i64 {
160 let ctr: *i64 = gv_ctr()
161 gv_head("NX-SOTA-DRIFT-GATE: hand grades bound to symbols are re-measured, and an over-claim refuses to publish" as *u8)
162 let gen: *u8 = sys_mmap(SG_PATH)
163 var have: i64 = 0
164 var subj_src: *u8 = "resolved" as *u8
165 if argc >= 2 { have = sg_subject_from_argv(argv[1] as *u8, gen); subj_src = "argv-override" as *u8 } else { have = sg_resolve_gen(gen) }
166 gv_puts(" generator=" as *u8); if have == 1 { gv_puts(gen) } else { gv_puts("ABSENT" as *u8) } gv_puts(" (" as *u8); gv_puts(subj_src); gv_puts(")\n" as *u8)
167 if gv_need("promoted nx_swcompare_matrix (the one assembler; serving root, its parent, or _build)" as *u8, have, ctr) == 0 {
168 return gv_verdict("nx_sota_drift_gate" as *u8, ctr, "no generator to drive" as *u8)
169 }
170 // ---- the fixture tree, built at runtime under /tmp ----
171 sys_mkdir(SG_ROOT, SG_MODE_RWX)
172 let p: *u8 = sys_mmap(SG_PATH)
173 var o: i64 = sg_cat(p, 0, SG_ROOT); o = sg_cat(p, o, "/knowledge" as *u8); sys_mkdir(p, SG_MODE_RWX)
174 o = sg_cat(p, 0, SG_ROOT); o = sg_cat(p, o, "/knowledge/compare" as *u8); sys_mkdir(p, SG_MODE_RWX)
175 o = sg_cat(p, 0, SG_ROOT); o = sg_cat(p, o, "/runtime" as *u8); sys_mkdir(p, SG_MODE_RWX)
176 let organp: *u8 = sys_mmap(SG_PATH)
177 o = sg_cat(organp, 0, SG_ROOT); o = sg_cat(organp, o, "/runtime/fx_organ.nx" as *u8)
178 sg_write(organp, "// fixture organ for nx_sota_drift_gate\nfunc fx_present() -> i64 { return 1 }\n" as *u8)
179 // CE4 (2026-09-05): the SERVED TWIN of the fixture organ, so CONSISTENT means present AND served. The assembler
180 // re-reads a shipped claim through nx_symdecl_lib cb_serve_state_cwd, which probes ../<base>.elf then ./<base>.elf
181 // from the child's CWD (SG_ROOT); this plants the second. fx_unserved carries the SAME symbol in source with NO
182 // twin -- the McCabe shape -- and its twin is unlinked every run so the gate stays idempotent.
183 let twinp: *u8 = sys_mmap(SG_PATH)
184 o = sg_cat(twinp, 0, SG_ROOT); o = sg_cat(twinp, o, "/fx_organ.elf" as *u8)
185 sg_write(twinp, "ELF-STUB served twin for nx_sota_drift_gate\n" as *u8)
186 let unsp: *u8 = sys_mmap(SG_PATH)
187 o = sg_cat(unsp, 0, SG_ROOT); o = sg_cat(unsp, o, "/runtime/fx_unserved.nx" as *u8)
188 sg_write(unsp, "// fixture organ with NO served twin for nx_sota_drift_gate\nfunc fx_present() -> i64 { return 1 }\n" as *u8)
189 let unstwin: *u8 = sys_mmap(SG_PATH)
190 o = sg_cat(unstwin, 0, SG_ROOT); o = sg_cat(unstwin, o, "/fx_unserved.elf" as *u8)
191 sys_unlinkat(unstwin)
192 let sotap: *u8 = sys_mmap(SG_PATH)
193 o = sg_cat(sotap, 0, SG_ROOT); o = sg_cat(sotap, o, "/knowledge/compare/fx.sota" as *u8)
194 let fx: *u8 = sys_mmap(SG_FIX)
195 let out: *u8 = sys_mmap(SG_CAP)
196 let ol: *i64 = sys_mmap(16) as *i64
197 if gv_need("fixture organ written under /tmp" as *u8, sg_exists(organp), ctr) == 0 {
198 return gv_verdict("nx_sota_drift_gate" as *u8, ctr, "fixture tree unwritable" as *u8)
199 }
200 // ---- A: stale-only ----
201 sg_fixture(fx, 1); sg_write(sotap, fx)
202 let rcA: i64 = sg_run(gen, "" as *u8, out, ol)
203 let nA: i64 = ol[0]
204 gv_puts(" A(stale) rc=" as *u8); gv_num(rcA); gv_puts(" bytes=" as *u8); gv_num(nA); gv_puts("\n" as *u8)
205 gv_check("A-fixture-reached-the-condition-bound=2" as *u8, (sg_num_after(out, nA, "bound=" as *u8) == 2) as i64, ctr)
206 gv_check("A-stale-under-counted-once" as *u8, (sg_num_after(out, nA, "stale_under=" as *u8) == 1) as i64, ctr)
207 gv_check("A-unbacked-zero" as *u8, (sg_num_after(out, nA, "unbacked=" as *u8) == 0) as i64, ctr)
208 gv_check("A-consistent-counts-the-No-over-absent-row" as *u8, (sg_num_after(out, nA, "consistent=" as *u8) == 1) as i64, ctr)
209 gv_check("A-census-names-the-stale-row-by-label" as *u8, sg_has(out, nA, "- Bound stale row [STALE-UNDER]" as *u8), ctr)
210 gv_check("A-census-still-publishes-exit-0" as *u8, (rcA == 0) as i64, ctr)
211 let rcAh: i64 = sg_run(gen, "html" as *u8, out, ol)
212 let nAh: i64 = ol[0]
213 gv_check("A-html-carries-the-STALE-UNDER-badge" as *u8, sg_has(out, nAh, ">STALE-UNDER</b>" as *u8), ctr)
214 gv_check("A-html-names-the-organ-and-symbol" as *u8, sg_has(out, nAh, "bound to <code>runtime/fx_organ.nx:fx_present</code>" as *u8), ctr)
215 gv_check("A-html-measured-bindings-preamble-present" as *u8, sg_has(out, nAh, "Measured bindings." as *u8), ctr)
216 gv_check("A-html-exit-0" as *u8, (rcAh == 0) as i64, ctr)
217 let rcAj: i64 = sg_run(gen, "json" as *u8, out, ol)
218 let nAj: i64 = ol[0]
219 gv_check("A-json-drift-field-STALE-UNDER" as *u8, sg_has(out, nAj, "\"drift\":\"STALE-UNDER\"" as *u8), ctr)
220 gv_check("A-json-summary-stale_under-1" as *u8, sg_has(out, nAj, "\"stale_under\":1" as *u8), ctr)
221 gv_check("A-json-measured-PRESENT-with-rule-decl" as *u8, sg_has(out, nAj, "\"measured\":\"PRESENT\",\"rule\":\"decl\"" as *u8), ctr)
222 gv_check("A-json-exit-0" as *u8, (rcAj == 0) as i64, ctr)
223 // ---- B: unbacked (the over-claim) ----
224 sg_fixture(fx, 2); sg_write(sotap, fx)
225 let rcB: i64 = sg_run(gen, "" as *u8, out, ol)
226 let nB: i64 = ol[0]
227 gv_puts(" B(unbacked) rc=" as *u8); gv_num(rcB); gv_puts(" bytes=" as *u8); gv_num(nB); gv_puts("\n" as *u8)
228 gv_check("B-fixture-reached-the-condition-unbacked=1" as *u8, (sg_num_after(out, nB, "unbacked=" as *u8) == 1) as i64, ctr)
229 gv_check("B-census-names-the-unbacked-row-by-label" as *u8, sg_has(out, nB, "- Bound unbacked row [UNBACKED]" as *u8), ctr)
230 gv_check("B-census-verdict-line-says-RED" as *u8, sg_has(out, nB, "verdict=RED" as *u8), ctr)
231 // ---- C: consistent only (the positive control for the refusal) ----
232 sg_fixture(fx, 3); sg_write(sotap, fx)
233 let rcC: i64 = sg_run(gen, "" as *u8, out, ol)
234 let nC: i64 = ol[0]
235 gv_puts(" C(consistent) rc=" as *u8); gv_num(rcC); gv_puts(" bytes=" as *u8); gv_num(nC); gv_puts("\n" as *u8)
236 gv_check("C-fixture-reached-the-condition-consistent=2" as *u8, (sg_num_after(out, nC, "consistent=" as *u8) == 2) as i64, ctr)
237 gv_check("C-no-drift-counted" as *u8, ((sg_num_after(out, nC, "stale_under=" as *u8) == 0) as i64) & ((sg_num_after(out, nC, "unbacked=" as *u8) == 0) as i64), ctr)
238 gv_check("C-census-publishes-MEASURED-HONEST" as *u8, sg_has(out, nC, "MEASURED-HONEST" as *u8), ctr)
239 gv_bite("neg-control-unbacked-refuses-and-consistent-publishes" as *u8, (rcB == 1) as i64, (rcC != 0) as i64, ctr)
240 // ---- D: unresolved (symbol-only binding, no matrix beside the fixture) ----
241 sg_fixture(fx, 4); sg_write(sotap, fx)
242 let rcD: i64 = sg_run(gen, "" as *u8, out, ol)
243 let nD: i64 = ol[0]
244 gv_check("D-unresolved-counted-once" as *u8, (sg_num_after(out, nD, "unresolved=" as *u8) == 1) as i64, ctr)
245 gv_check("D-unresolved-named" as *u8, sg_has(out, nD, "[UNRESOLVED]" as *u8), ctr)
246 gv_check("D-unresolved-does-not-refuse" as *u8, (rcD == 0) as i64, ctr)
247 // ---- E: unreadable organ ----
248 sg_fixture(fx, 5); sg_write(sotap, fx)
249 let rcE: i64 = sg_run(gen, "" as *u8, out, ol)
250 let nE: i64 = ol[0]
251 gv_check("E-unreadable-counted-once" as *u8, (sg_num_after(out, nE, "unreadable=" as *u8) == 1) as i64, ctr)
252 gv_check("E-unreadable-named-not-called-absent" as *u8, sg_has(out, nE, "[UNREADABLE]" as *u8), ctr)
253 gv_check("E-unreadable-does-not-refuse" as *u8, (rcE == 0) as i64, ctr)
254 // ---- the partition, on every run: consistent + stale + unbacked + unresolved + unreadable + unserved == bound ----
255 let bE: i64 = sg_num_after(out, nE, "bound=" as *u8)
256 let sumE: i64 = sg_num_after(out, nE, "consistent=" as *u8) + sg_num_after(out, nE, "stale_under=" as *u8) + sg_num_after(out, nE, "unbacked=" as *u8) + sg_num_after(out, nE, "unresolved=" as *u8) + sg_num_after(out, nE, "unreadable=" as *u8) + sg_num_after(out, nE, "unserved=" as *u8)
257 gv_check("drift-partition-sums-to-bound-with-unserved-declared-a-member" as *u8, ((bE == 2) as i64) & ((sumE == bE) as i64), ctr)
258 gv_check("neg-control-unbound-filler-rows-are-not-counted-as-bound" as *u8, (bE == 2) as i64, ctr)
259 // ---- F: unserved (CE4, 2026-09-05) -- grade Yes, symbol PRESENT in source, organ binary NOT served ----
260 // The McCabe shape: symbol presence passes it, the served re-read catches it. Published WITH the badge and
261 // counted; it must NOT refuse -- the verdict CONTRADICTS the claim, it does not deny it.
262 sg_fixture(fx, 6); sg_write(sotap, fx)
263 let rcF: i64 = sg_run(gen, "" as *u8, out, ol)
264 let nF: i64 = ol[0]
265 gv_puts(" F(unserved) rc=" as *u8); gv_num(rcF); gv_puts(" bytes=" as *u8); gv_num(nF); gv_puts("\n" as *u8)
266 let unsF: i64 = sg_num_after(out, nF, "unserved=" as *u8)
267 gv_check("F-fixture-reached-the-condition-bound=2" as *u8, (sg_num_after(out, nF, "bound=" as *u8) == 2) as i64, ctr)
268 gv_check("F-unserved-counted-once" as *u8, (unsF == 1) as i64, ctr)
269 gv_check("F-the-Yes-row-is-NOT-counted-consistent-symbol-presence-alone-no-longer-blesses-a-shipped-claim" as *u8, (sg_num_after(out, nF, "consistent=" as *u8) == 1) as i64, ctr)
270 gv_check("F-census-names-the-unserved-row-by-label" as *u8, sg_has(out, nF, "- Bound unserved row [UNSERVED]" as *u8), ctr)
271 gv_check("F-unserved-does-not-refuse-a-contradiction-publishes-with-the-badge" as *u8, (rcF == 0) as i64, ctr)
272 let bF: i64 = sg_num_after(out, nF, "bound=" as *u8)
273 let sumF: i64 = sg_num_after(out, nF, "consistent=" as *u8) + sg_num_after(out, nF, "stale_under=" as *u8) + sg_num_after(out, nF, "unbacked=" as *u8) + sg_num_after(out, nF, "unresolved=" as *u8) + sg_num_after(out, nF, "unreadable=" as *u8) + unsF
274 gv_check("F-drift-partition-sums-to-bound-with-the-unserved-row-inside-it" as *u8, ((bF == 2) as i64) & ((sumF == bF) as i64), ctr)
275 let rcFh: i64 = sg_run(gen, "html" as *u8, out, ol)
276 let nFh: i64 = ol[0]
277 gv_check("F-html-carries-the-UNSERVED-badge" as *u8, sg_has(out, nFh, ">UNSERVED</b>" as *u8), ctr)
278 gv_check("F-html-exit-0" as *u8, (rcFh == 0) as i64, ctr)
279 let rcFj: i64 = sg_run(gen, "json" as *u8, out, ol)
280 let nFj: i64 = ol[0]
281 gv_check("F-json-drift-field-UNSERVED" as *u8, sg_has(out, nFj, "\"drift\":\"UNSERVED\"" as *u8), ctr)
282 gv_check("F-json-summary-unserved-1" as *u8, sg_has(out, nFj, "\"unserved\":1" as *u8), ctr)
283 // BOTH SIGNALS AT ONCE: the served twin planted at setup is the ONLY difference between C's Yes row and F's, so
284 // re-run C and prove the same ruler is silent there -- a served organ is byte-identical to before this change.
285 sg_fixture(fx, 3); sg_write(sotap, fx)
286 sg_run(gen, "" as *u8, out, ol)
287 let unsC: i64 = sg_num_after(out, ol[0], "unserved=" as *u8)
288 gv_check("C-again-the-served-twin-keeps-the-Yes-row-CONSISTENT-unserved-0" as *u8, (unsC == 0) as i64, ctr)
289 gv_bite("unserved-fires-on-a-source-only-organ-and-is-silent-on-the-served-consistent-fixture" as *u8, (unsF == 1) as i64, (unsC != 0) as i64, ctr)
290 return gv_verdict("nx_sota_drift_gate" as *u8, ctr, "every drift class is planted, counted, named; the over-claim refuses, the consistent fixture publishes, and a shipped claim over a source-only organ reads UNSERVED without refusing" as *u8)
291}