nx_selfsuff_gate.nx source
↩ module page · 303 lines · 20134 B
1// nx_selfsuff_gate.nx -- the referee for the SOVEREIGNTY LEDGER (nx_selfsuff) and for the ranker term
2// it feeds (nx_compare_rank rk_selfsuff_term, PR11).
3//
4// THE TOOTH THAT MATTERS IS THE POSITIVE CONTROL. A dependency penalty that fires on EVERY rung
5// passes every negative test ever written for it -- it demotes the bad rungs, and nobody notices it
6// demoted the good ones too, because a uniform multiplier is a no-op on ORDERING wearing the costume
7// of rigour. So the first tooth here is an IDENTITY: with a ledger that says zero dependency, the
8// ranked priorities must be BYTE-FOR-BYTE the same sequence as with no ledger at all.
9//
10// Fixtures live under /tmp/<gate>/ (a gate must not share its fixture with a production beat), except
11// the fixture DOMAIN, which must sit beside the real compare data because nx_compare_rank resolves
12// buildroot/knowledge/compare/<dom> itself. It is named _ssgatefix so it is unmistakable, it is in no
13// regen/radar list so no generator consumes it, and it deliberately carries NO ver| ladder so the
14// ranker files NOTHING into the production pm intake journal on a gate run.
15//
16// END-TO-END: this gate fork/execs the DEPLOYED ./nx_selfsuff.elf and ./nx_compare_rank.elf, so
17// nx_gate_bite needs its 4th argument (subject target) or every mutant survives by construction.
18import "nx_syscalls.nx"
19import "nx_gate_verdict.nx"
20import "nx_tool_run.nx"
21
22const SG_CAP: i64 = 262144
23const SG_MAXP: i64 = 64
24const SG_MODE_755: i64 = 493
25const SG_MODE_644: i64 = 420
26const SG_NL: i64 = 10
27// BOUNDED, not unbounded. MEASURED 2026-08-20: the first version of this gate used the untimed
28// tr_run_capture and hung for over eleven minutes -- a forked ranker was waiting on the sovereign
29// store lock while seven sibling lanes worked the box, and a gate that can wait forever is
30// indistinguishable from a gate that emits nothing. AND THE CAUSE IS NOT THE RANKER'S OWN WORK, which
31// was measured at 14 s: nx_compare_rank forks nx_dr_ocm / nx_store_put / nx_pm_intake, the grandchildren
32// INHERIT the capture pipe, and the read cannot see EOF until the LAST holder exits.
33// ★★★★★ A CAPTURE WAITS FOR THE LAST HOLDER OF THE PIPE, NOT FOR THE PROCESS YOU FORKED.
34// The bound is sized against the SUBJECT'S OWN WORK -- 6x that measured 14 s at load 16. Inheriting
35// nx_compare_rank_fleet's RF_TIMEOUT_MS (280000) was tried first and is the WRONG calibration here: it
36// covers a whole domain's ranking, so five forks would spend 23 minutes waiting on closed pipes.
37const SG_CHILD_TMO_MS: i64 = 90000
38
39func sg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
40func sg_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } d[p] = 0 as u8; return p }
41func sg_write(path: *u8, body: *u8) -> i64 {
42 let fd: i64 = sys_openat_wr(path, SG_MODE_644)
43 if fd < 0 { return 0 }
44 let n: i64 = sg_slen(body)
45 let w: i64 = sys_write(fd, body, n)
46 sys_close(fd)
47 if w == n { return 1 }
48 return 0
49}
50func sg_has(hay: *u8, n: i64, needle: *u8) -> i64 {
51 let m: i64 = sg_slen(needle)
52 if m == 0 { return 0 }
53 var i: i64 = 0
54 while i + m <= n {
55 if hay[i] == needle[0] {
56 var k: i64 = 0
57 var same: i64 = 1
58 while k < m { if hay[i+k] != needle[k] { same = 0; k = m } else { k = k + 1 } }
59 if same == 1 { return 1 }
60 }
61 i = i + 1
62 }
63 return 0
64}
65// collect every "priority=<int>" in output order. THE ranking fingerprint: it is what changes when a
66// coefficient changes and what must NOT change when the coefficient is 1.
67func sg_pris(buf: *u8, n: i64, out: *i64, cap: i64) -> i64 {
68 let key: *u8 = "priority=" as *u8
69 let m: i64 = sg_slen(key)
70 var c: i64 = 0
71 var i: i64 = 0
72 while i + m <= n {
73 var same: i64 = 1
74 var k: i64 = 0
75 while k < m { if buf[i+k] != key[k] { same = 0; k = m } else { k = k + 1 } }
76 if same == 1 {
77 var j: i64 = i + m
78 var v: i64 = 0
79 var any: i64 = 0
80 var run: i64 = 1
81 while run == 1 {
82 if j >= n { run = 0 } else {
83 let ch: i64 = buf[j] as i64
84 if ch >= 48 { if ch <= 57 { v = v * 10 + (ch - 48); any = 1; j = j + 1 } else { run = 0 } } else { run = 0 }
85 }
86 }
87 if any == 1 { if c < cap { out[c] = v; c = c + 1 } }
88 i = j
89 } else { i = i + 1 }
90 }
91 return c
92}
93func sg_run(elf: *u8, a1: *u8, a2: *u8, a3: *u8, buf: *u8, lenout: *i64) -> i64 {
94 let av: *i64 = sys_mmap(8 * 8) as *i64
95 av[0] = elf as i64
96 var k: i64 = 1
97 if a1 != (0 as *u8) { av[k] = a1 as i64; k = k + 1 }
98 if a2 != (0 as *u8) { av[k] = a2 as i64; k = k + 1 }
99 if a3 != (0 as *u8) { av[k] = a3 as i64; k = k + 1 }
100 av[k] = 0
101 lenout[0] = 0
102 return tr_run_capture_to(elf, av, buf, SG_CAP - 1, lenout, SG_CHILD_TMO_MS)
103}
104
105func main(argc: i64, argv: *i64) -> i64 {
106 gv_head("NX-SELFSUFF-GATE -- the sovereignty ledger and the ranker term it feeds" as *u8)
107 let ctr: *i64 = gv_ctr()
108
109 // OPTIONAL [root]: chdir to the NISHIHOST ROOT first. The production contract is unchanged (a gate
110 // runner already starts here), but this estate ALSO runs organs from buildroot/, and every path
111 // below -- the fixture domain beside the real compare data, and the two subject elfs -- is
112 // nishihost-relative. A forked child inherits this cwd, so setting it ONCE here is the only place
113 // that can make the gate and both its subjects agree about where they are.
114 if argc > 1 { sys_chdir(argv[1] as *u8) }
115
116 // ---------------- SETUP: /tmp fixture tree, created every run (a teardown does not run when a
117 // run crashes, so setup must be idempotent and must not depend on the last run's leftovers).
118 sys_mkdir("/tmp/nx_selfsuff_gate" as *u8, SG_MODE_755)
119 sys_mkdir("/tmp/nx_selfsuff_gate/r" as *u8, SG_MODE_755)
120 sys_mkdir("/tmp/nx_selfsuff_gate/r/buildroot" as *u8, SG_MODE_755)
121 sys_mkdir("/tmp/nx_selfsuff_gate/r/buildroot/knowledge" as *u8, SG_MODE_755)
122 sys_mkdir("/tmp/nx_selfsuff_gate/r/buildroot/knowledge/compare" as *u8, SG_MODE_755)
123 sys_mkdir("/tmp/nx_selfsuff_gate/r/buildroot/runtime" as *u8, SG_MODE_755)
124 sys_mkdir("/tmp/nx_selfsuff_gate/r/knowledge" as *u8, SG_MODE_755)
125 sys_mkdir("/tmp/nx_selfsuff_gate/r/knowledge/status" as *u8, SG_MODE_755)
126 sys_mkdir("/tmp/nx_selfsuff_gate/n" as *u8, SG_MODE_755)
127
128 var fx: i64 = 1
129 // the fixture conf: one of each vocabulary kind, so each host class has a rule to hit
130 if sg_write("/tmp/nx_selfsuff_gate/r/buildroot/knowledge/compare/selfsuff.conf" as *u8,
131 "sovereign=nishifamily.com\nreserved_suffix=.example\nnondialled_host=schemas.openxmlformats.org\nnetmarker=sys_connect\nauto_file=autofix.txt\n" as *u8) == 0 { fx = 0 }
132 if sg_write("/tmp/nx_selfsuff_gate/r/buildroot/knowledge/compare/regen.list" as *u8, "fixdom\n" as *u8) == 0 { fx = 0 }
133 if sg_write("/tmp/nx_selfsuff_gate/r/buildroot/knowledge/compare/fixdom.matrix" as *u8,
134 "@cols A|B\nnet organ|runtime/fx_net.nx|fx_go|0|1|1|note\ndoc organ|runtime/fx_doc.nx|fx_doc_ns|0|1|1|note\nauto organ|runtime/fx_auto.nx|fx_auto_step|0|1|1|note\nvia organ|runtime/fx_via.nx|fx_via_step|0|1|1|note\n" as *u8) == 0 { fx = 0 }
135 // fx_net: FOUR host classes in one organ, and a network marker IN CODE so its hosts count
136 if sg_write("/tmp/nx_selfsuff_gate/r/buildroot/runtime/fx_net.nx" as *u8,
137 "func fx_go() -> i64 {\n let a: *u8 = \"https://real-outside.org/x\" as *u8\n let b: *u8 = \"https://nishifamily.com/y\" as *u8\n let c: *u8 = \"https://evil.example/z\" as *u8\n let d: *u8 = \"nishi://start\" as *u8\n return sys_connect(0, a, 1)\n}\n" as *u8) == 0 { fx = 0 }
138 // fx_doc: a REAL host name with NO network capability -- an XML namespace URI. The false positive
139 // that made the first version of this detector worthless.
140 if sg_write("/tmp/nx_selfsuff_gate/r/buildroot/runtime/fx_doc.nx" as *u8,
141 "func fx_doc_ns() -> i64 {\n let n1: *u8 = \"http://schemas.openxmlformats.org/ns\" as *u8\n return 0\n}\n" as *u8) == 0 { fx = 0 }
142 if sg_write("/tmp/nx_selfsuff_gate/r/buildroot/runtime/fx_auto.nx" as *u8,
143 "func fx_auto_step() -> i64 {\n return 0\n}\n" as *u8) == 0 { fx = 0 }
144 // fx_via: THE ANTI-VACUITY FIXTURE FOR THE CLOSURE. It carries NO url literal, NO ".elf" fork
145 // literal and NO socket primitive -- it only IMPORTS a carrier and calls it. Every same-organ test
146 // reports it SOVEREIGN; only a transitive import walk can see that it reaches the network. This
147 // organ is the tooth the previous detector could not have passed, which is the point of it.
148 if sg_write("/tmp/nx_selfsuff_gate/r/buildroot/runtime/fx_via.nx" as *u8,
149 "import \"fx_net.nx\"\nfunc fx_via_step() -> i64 {\n return fx_go()\n}\n" as *u8) == 0 { fx = 0 }
150 if sg_write("/tmp/nx_selfsuff_gate/r/autofix.txt" as *u8, "beat fx_auto every 3600\n" as *u8) == 0 { fx = 0 }
151 // the no-conf root, for the refusal tooth
152 sys_mkdir("/tmp/nx_selfsuff_gate/n/buildroot" as *u8, SG_MODE_755)
153 // ledger fixtures for the ranker teeth
154 if sg_write("/tmp/nx_selfsuff_gate/lg_zero.ledger" as *u8,
155 "dep|_ssgatefix|runtime/nx_compare_rank.nx|0|0|0|0|-\n" as *u8) == 0 { fx = 0 }
156 if sg_write("/tmp/nx_selfsuff_gate/lg_dep2.ledger" as *u8,
157 "dep|_ssgatefix|runtime/nx_compare_rank.nx|2|1|9|0|a.outside.org;b.outside.org\n" as *u8) == 0 { fx = 0 }
158 if sg_write("/tmp/nx_selfsuff_gate/lg_dep99.ledger" as *u8,
159 "dep|_ssgatefix|runtime/nx_compare_rank.nx|99|1|9|1|many\n" as *u8) == 0 { fx = 0 }
160 if sg_write("/tmp/nx_selfsuff_gate/lg_other.ledger" as *u8,
161 "dep|_ssgatefix|runtime/nx_not_this_organ.nx|5|1|9|1|x\n" as *u8) == 0 { fx = 0 }
162 // the fixture DOMAIN, beside the real compare data (the ranker resolves that path itself).
163 // The symbols carry the _ABSENT_ watch spelling ON PURPOSE: a bare symbol reads PRESENT from the
164 // DATA alone, both rungs close, and the ranker has nothing open -- every term tooth below would go
165 // green having examined nothing. A FIXTURE THE DEFECT CANNOT REACH IS NOT A TEST, and this one was
166 // measured vacuous on its first run (open=0) before the spelling was fixed.
167 // NO ver| ladder on purpose: nothing is on a critical path, so nothing is filed into pm intake.
168 if sg_write("buildroot/knowledge/compare/_ssgatefix.matrix" as *u8,
169 "@title SelfSuff gate fixture -- NOT in regen.list, no generator consumes it\n@cols R1|R2\nfixture alpha|runtime/nx_compare_rank.nx|_ABSENT_:ssfix_alpha|0|2|2|gate fixture row\nfixture beta|runtime/nx_compare_rank.nx|_ABSENT_:ssfix_beta|0|3|2|gate fixture row\n" as *u8) == 0 { fx = 0 }
170 if sg_write("buildroot/knowledge/compare/_ssgatefix.plan" as *u8,
171 "unit|1 u = one measured session-leg\nrung|S1|Fixture rung alpha|ssfix_alpha|gate fixture done-rule|Organ|1|-\nrung|S2|Fixture rung beta|ssfix_beta|gate fixture done-rule|Organ|1|-\n" as *u8) == 0 { fx = 0 }
172
173 if gv_need("fixtures-written" as *u8, fx, ctr) == 0 { return gv_verdict("nx_selfsuff_gate" as *u8, ctr, "fixture setup could not write; nothing was tested" as *u8) }
174
175 // ---------------- CENSUS TEETH (nx_selfsuff) ----------------
176 let cb: *u8 = sys_mmap(SG_CAP)
177 let cl: *i64 = sys_mmap(16) as *i64
178 sg_run("./nx_selfsuff.elf" as *u8, "census" as *u8, "-" as *u8, "/tmp/nx_selfsuff_gate/r" as *u8, cb, cl)
179 // ASSERT THE FIXTURE REACHED THE CONDITION BEFORE ASSERTING THE OUTCOME: if the subject produced
180 // nothing, every string tooth below would fail for the wrong reason and read as a broken census.
181 var censusout: i64 = 0
182 if cl[0] > 0 { censusout = 1 }
183 if gv_need("census-subject-produced-output" as *u8, censusout, ctr) == 0 { return gv_verdict("nx_selfsuff_gate" as *u8, ctr, "./nx_selfsuff.elf returned no bytes; the census teeth were not run" as *u8) }
184 gv_check("census-dedupes-refs-to-subjects" as *u8, sg_has(cb, cl[0], "distinct_organs=4" as *u8), ctr)
185 // ---- THE CLOSURE TEETH. fx_via has no socket, no host literal and no fork literal; it only
186 // IMPORTS fx_net. The tooth below is one the same-organ detector CANNOT pass, and the two
187 // neg-controls are what stop the closure from being a term that paints everything.
188 gv_check("net-reach-VIA-HELPER-fires-on-an-organ-with-no-socket-and-no-host-of-its-own" as *u8, sg_has(cb, cl[0], "via_helper=1" as *u8), ctr)
189 gv_check("net-reach-DIRECT-still-counts-the-organ-that-opens-its-own-socket" as *u8, sg_has(cb, cl[0], "direct=1 " as *u8), ctr)
190 gv_check("neg-control-net-reach-does-NOT-paint-every-organ-network-dependent" as *u8, sg_has(cb, cl[0], "none=2 " as *u8), ctr)
191 gv_check("net-reach-partition-reconciles-to-with-source" as *u8, sg_has(cb, cl[0], "1+1+2=4)" as *u8), ctr)
192 gv_check("closure-partition-reconciles-matrix-plus-aux-to-total" as *u8, sg_has(cb, cl[0], "CLOSURE matrix_nodes=4" as *u8), ctr)
193 gv_check("import-edge-is-actually-collected-not-merely-declared" as *u8, sg_has(cb, cl[0], "import_edges=1" as *u8), ctr)
194 // ⚠ THE TOOTH THAT USED TO SIT HERE WAS NAMED "ledger-carries-the-net_dep-column-header" AND
195 // ASSERTED sg_has("LEDGER") -- a string this census prints unconditionally. A TOOTH WHOSE NAME
196 // DOES NOT MATCH WHAT IT ASSERTS IS WORSE THAN NO TOOTH: it reads as coverage and tests nothing.
197 // Replaced with a real one, bound to this fixture's own edge count.
198 gv_check("neg-control-every-fixture-edge-resolves-so-no-unwalked-remainder-is-hidden" as *u8, sg_has(cb, cl[0], "edge_names_with_no_source=0" as *u8), ctr)
199 gv_check("hostclass-OUTSIDE-fires-on-a-dialled-internet-host" as *u8, sg_has(cb, cl[0], "OUTSIDE=1 " as *u8), ctr)
200 gv_check("neg-control-hostclass-sovereign-does-not-count" as *u8, sg_has(cb, cl[0], "sovereign=1 " as *u8), ctr)
201 gv_check("neg-control-hostclass-reserved-fixture-does-not-count" as *u8, sg_has(cb, cl[0], "fixture=1 " as *u8), ctr)
202 gv_check("neg-control-hostclass-scheme-token-is-not-a-host" as *u8, sg_has(cb, cl[0], "scheme_token=1 " as *u8), ctr)
203 gv_check("neg-control-hostclass-named-namespace-authority-is-not-a-dependency" as *u8, sg_has(cb, cl[0], "non_dialled=1 " as *u8), ctr)
204 gv_check("host-partition-reconciles-to-its-own-total" as *u8, sg_has(cb, cl[0], "=5)" as *u8), ctr)
205 // 3 of 4: fx_auto is on the fixture roster and the other three are not. fx_net is IMPORTED by
206 // fx_via and MUST STILL READ SEAT-ONLY -- BEING IMPORTED IS NOT BEING INVOKED. This tooth read 2
207 // while imports were folded into the "forked by anything" rule, which silently made 143 real
208 // organs look autonomous and moved the ranked claude_loop axis. The 3 is the tooth.
209 gv_check("autonomy-axis-separates-a-ROSTERED-organ-from-a-merely-IMPORTED-one" as *u8, sg_has(cb, cl[0], "SEAT-ONLY with_source=3" as *u8), ctr)
210 let nb: *u8 = sys_mmap(SG_CAP)
211 let nl: *i64 = sys_mmap(16) as *i64
212 sg_run("./nx_selfsuff.elf" as *u8, "census" as *u8, "-" as *u8, "/tmp/nx_selfsuff_gate/n" as *u8, nb, nl)
213 gv_check("neg-control-census-refuses-without-its-conf-vocabulary" as *u8, sg_has(nb, nl[0], "SELFSUFF REFUSED" as *u8), ctr)
214
215 // ---------------- RANKER TERM TEETH (nx_compare_rank rk_selfsuff_term) ----------------
216 let b0: *u8 = sys_mmap(SG_CAP)
217 let l0: *i64 = sys_mmap(16) as *i64
218 let bz: *u8 = sys_mmap(SG_CAP)
219 let lz: *i64 = sys_mmap(16) as *i64
220 let b2: *u8 = sys_mmap(SG_CAP)
221 let l2: *i64 = sys_mmap(16) as *i64
222 let b9: *u8 = sys_mmap(SG_CAP)
223 let l9: *i64 = sys_mmap(16) as *i64
224 let bo: *u8 = sys_mmap(SG_CAP)
225 let lo2: *i64 = sys_mmap(16) as *i64
226 sg_run("./nx_compare_rank.elf" as *u8, "_ssgatefix" as *u8, "300" as *u8, "/tmp/nx_selfsuff_gate/absent.ledger" as *u8, b0, l0)
227 sg_run("./nx_compare_rank.elf" as *u8, "_ssgatefix" as *u8, "300" as *u8, "/tmp/nx_selfsuff_gate/lg_zero.ledger" as *u8, bz, lz)
228 sg_run("./nx_compare_rank.elf" as *u8, "_ssgatefix" as *u8, "300" as *u8, "/tmp/nx_selfsuff_gate/lg_dep2.ledger" as *u8, b2, l2)
229 sg_run("./nx_compare_rank.elf" as *u8, "_ssgatefix" as *u8, "300" as *u8, "/tmp/nx_selfsuff_gate/lg_dep99.ledger" as *u8, b9, l9)
230 sg_run("./nx_compare_rank.elf" as *u8, "_ssgatefix" as *u8, "300" as *u8, "/tmp/nx_selfsuff_gate/lg_other.ledger" as *u8, bo, lo2)
231
232 let p0: *i64 = sys_mmap(SG_MAXP * 8) as *i64
233 let pz: *i64 = sys_mmap(SG_MAXP * 8) as *i64
234 let p2: *i64 = sys_mmap(SG_MAXP * 8) as *i64
235 let p9: *i64 = sys_mmap(SG_MAXP * 8) as *i64
236 let po: *i64 = sys_mmap(SG_MAXP * 8) as *i64
237 let n0: i64 = sg_pris(b0, l0[0], p0, SG_MAXP)
238 let nz: i64 = sg_pris(bz, lz[0], pz, SG_MAXP)
239 let n2: i64 = sg_pris(b2, l2[0], p2, SG_MAXP)
240 let n9: i64 = sg_pris(b9, l9[0], p9, SG_MAXP)
241 let no3: i64 = sg_pris(bo, lo2[0], po, SG_MAXP)
242
243 // A TOOTH THAT PASSES ON THE EMPTY SET IS NOT A TOOTH: bind every comparison to its denominator.
244 var ranked: i64 = 0
245 if n0 > 0 { ranked = 1 }
246 if gv_need("ranker-produced-a-ranking" as *u8, ranked, ctr) == 0 { return gv_verdict("nx_selfsuff_gate" as *u8, ctr, "./nx_compare_rank.elf ranked no rungs on the fixture domain; the term teeth were not run" as *u8) }
247 var two: i64 = 0
248 if n0 == 2 { two = 1 }
249 gv_check("fixture-domain-ranks-both-rungs" as *u8, two, ctr)
250
251 // THE POSITIVE CONTROL. A zero-dependency ledger must leave the ranking EXACTLY as it was.
252 var same: i64 = 0
253 if nz == n0 { if n0 > 0 {
254 same = 1
255 var i: i64 = 0
256 while i < n0 { if pz[i] != p0[i] { same = 0; i = n0 } i = i + 1 }
257 } }
258 gv_check("POS-CONTROL-zero-dependency-changes-no-priority" as *u8, same, ctr)
259 gv_check("POS-CONTROL-names-the-sovereign-row-in-its-derivation" as *u8, sg_has(bz, lz[0], "SOVEREIGN-NO-PENALTY" as *u8), ctr)
260 gv_check("POS-CONTROL-multiplier-is-exactly-base" as *u8, sg_has(bz, lz[0], "mult_x4=4" as *u8), ctr)
261
262 // THE PENALTY DIRECTION: at least one rung must move DOWN, and none may move UP.
263 var lower: i64 = 0
264 var higher: i64 = 0
265 if n2 == n0 { if n0 > 0 {
266 var i2: i64 = 0
267 while i2 < n0 {
268 if p2[i2] < p0[i2] { lower = lower + 1 }
269 if p2[i2] > p0[i2] { higher = higher + 1 }
270 i2 = i2 + 1
271 }
272 } }
273 var loweok: i64 = 0
274 if lower > 0 { loweok = 1 }
275 var noup: i64 = 0
276 if higher == 0 { noup = 1 }
277 gv_check("penalty-demotes-a-dependent-rung" as *u8, loweok, ctr)
278 gv_check("neg-control-penalty-never-promotes-anything" as *u8, noup, ctr)
279 gv_check("penalty-multiplier-is-base-minus-measured-dependency" as *u8, sg_has(b2, l2[0], "mult_x4=2" as *u8), ctr)
280
281 // THE FLOOR: a huge dependency clamps at the floor and STILL leaves every rung in the ranking.
282 gv_check("floor-clamps-the-multiplier-at-one-quarter" as *u8, sg_has(b9, l9[0], "mult_x4=1" as *u8), ctr)
283 var nozero: i64 = 1
284 if sg_has(b9, l9[0], "mult_x4=0" as *u8) == 1 { nozero = 0 }
285 gv_check("neg-control-floor-never-zeroes-the-multiplier" as *u8, nozero, ctr)
286 var keptall: i64 = 0
287 if n9 == n0 { keptall = 1 }
288 gv_check("floor-demotes-but-never-hides-a-rung" as *u8, keptall, ctr)
289
290 // ABSTAIN, NEVER ACQUIT: no ledger is UNOBSERVED, and an organ absent from the census population
291 // is a THIRD state -- neither "measured zero" nor "unmeasurable".
292 gv_check("neg-control-absent-ledger-abstains-and-says-so" as *u8, sg_has(b0, l0[0], "SELFSUFF ledger UNOBSERVED" as *u8), ctr)
293 gv_check("neg-control-organ-absent-from-census-is-not-priced-as-zero" as *u8, sg_has(bo, lo2[0], "NO-LEDGER-ROW" as *u8), ctr)
294 var sameo: i64 = 0
295 if no3 == n0 { if n0 > 0 {
296 sameo = 1
297 var i3: i64 = 0
298 while i3 < n0 { if po[i3] != p0[i3] { sameo = 0; i3 = n0 } i3 = i3 + 1 }
299 } }
300 gv_check("neg-control-unmeasured-organ-leaves-the-ranking-untouched" as *u8, sameo, ctr)
301
302 return gv_verdict("nx_selfsuff_gate" as *u8, ctr, "sovereignty ledger + PR11 ranker term" as *u8)
303}