code wiki / (root) / nx_ppp_probe_gate.nx

nx_ppp_probe_gate.nx source

↩ module page · 126 lines · 7233 B

1// nx_ppp_probe_gate.nx -- THE VERDICT nx_ppp_probe COULD NOT PUBLISH (2026-08-25). 2// 3// nx_ppp_probe scores PERSON / PRODUCT / PLACE on our own live surface AND on each rival's front door, 4// and those numbers are PUBLISHED as competitive claims on /compare. It shipped with a 20-tooth internal 5// --kat and NO external gate, so /api/gate_run could not read its verdict and no roster ever ran it: 6// a published metric whose health nobody could ask about from outside. 7// 8// WHY IT NEEDED ONE, measured 2026-08-25: the probe scored viewport=0 on /games, a page that CORRECTLY 9// emits its mobile-scaling declaration in SINGLE quotes. It matched the double-quoted and the bare forms 10// and not the single-quoted one, so a PUBLISHED place score was understated by 50 permil. The defect 11// carried its own control in the same measurement -- on that identical page `canonical` read 1, because 12// THAT check had been hand-written with all three quote forms. A FIX APPLIED IN ONE PLACE AND NOT ITS 13// SIBLINGS IS HALF A FIX, AND THE HALF LEFT UNDONE IS THE ONE THAT SHIPS. 14// 15// SCOPE, DECLARED: this gate FORKS the deployed elf, so it is END-TO-END. It proves the subject's own 16// self-test still RUNS, has not SHRUNK, and still DISCRIMINATES on live pages. It does NOT re-derive the 17// scoring -- the subject's --kat owns that, and duplicating it here would be a second ruler. 18// SUBSTITUTABLE: argv[1] overrides the subject, so nx_gate_bite can hand it a freshly built mutant. 19// license_tier: ORIGINAL No hw writes (Rule 26). 20import "nx_syscalls.nx" 21import "nx_gate_verdict.nx" 22import "nx_tool_run.nx" 23 24const PG_SUBJECT_DEFAULT: *u8 = "nx_ppp_probe.elf" 25// Capture bound for a forked subject's stdout. The size is genuinely unknowable in advance, so a bound is 26// legitimate here -- but it must ANNOUNCE rather than truncate in silence, which the not-truncated tooth 27// below enforces. 28const PG_CAP: i64 = 262144 29// The subject's --kat tooth count on the day this gate was written. A SHRINK means a tooth stopped 30// running, which lowers BOTH the numerator and the denominator and still prints GREEN -- the exact defect 31// gv_ctr prevents INSIDE a gate, applied here to a FORKED subject's self-test. 32const PG_KAT_MIN_TEETH: i64 = 20 33const PG_URL_GOOD: *u8 = "https://nishifamily.com/games" 34const PG_URL_NOVP: *u8 = "https://nishifamily.com/render3d/negctl_noviewport.html" 35const PG_CONNECT: *u8 = "127.0.0.1:8443" 36const PG_NL: i64 = 10 37const PG_SP: i64 = 32 38const PG_TCH: i64 = 84 39const PG_ARGV_SLOTS: i64 = 8 40 41func pg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } 42func pg_count(buf: *u8, n: i64, pat: *u8) -> i64 { 43 let pl: i64 = pg_len(pat) 44 if pl == 0 { return 0 } 45 var c: i64 = 0 46 var i: i64 = 0 47 while i + pl <= n { 48 var k: i64 = 0 49 var m: i64 = 1 50 while k < pl { if buf[i+k] != pat[k] { m = 0; k = pl } else { k = k + 1 } } 51 if m == 1 { c = c + 1; i = i + pl } else { i = i + 1 } 52 } 53 return c 54} 55func pg_has(buf: *u8, n: i64, pat: *u8) -> i64 { if pg_count(buf, n, pat) > 0 { return 1 } return 0 } 56// Each --kat tooth prints a line beginning " T". That pattern carries a literal newline, which this 57// dialect's lexer treats ambiguously inside a string literal, so it is CONSTRUCTED byte-wise. 58func pg_count_teeth(buf: *u8, n: i64) -> i64 { 59 let p: *u8 = sys_mmap(PG_ARGV_SLOTS) 60 p[0] = PG_NL as u8; p[1] = PG_SP as u8; p[2] = PG_SP as u8; p[3] = PG_TCH as u8; p[4] = 0 as u8 61 return pg_count(buf, n, p) 62} 63func pg_run(subject: *u8, a1: *u8, a2: *u8, a3: *u8, out: *u8, olen: *i64) -> i64 { 64 let av: *i64 = sys_mmap(PG_ARGV_SLOTS * 8) as *i64 65 var k: i64 = 0 66 av[k] = subject as i64; k = k + 1 67 if (a1 as i64) != 0 { av[k] = a1 as i64; k = k + 1 } 68 if (a2 as i64) != 0 { av[k] = a2 as i64; k = k + 1 } 69 if (a3 as i64) != 0 { av[k] = a3 as i64; k = k + 1 } 70 av[k] = 0 71 out[0] = 0 as u8 72 let rc: i64 = tr_run_capture(subject, av, out, PG_CAP, olen) 73 var t: i64 = olen[0] 74 if t < 0 { t = 0 } 75 if t >= PG_CAP { t = PG_CAP - 1 } 76 out[t] = 0 as u8 77 return rc 78} 79func main(argc: i64, argv: *i64) -> i64 { 80 var subject: *u8 = PG_SUBJECT_DEFAULT 81 if argc >= 2 { subject = argv[1] as *u8 } 82 let ctr: *i64 = gv_ctr() 83 gv_head("nx_ppp_probe_gate -- the PUBLISHED person/product/place ruler, proven from OUTSIDE" as *u8) 84 85 let kb: *u8 = sys_mmap(PG_CAP) 86 let kl: *i64 = sys_mmap(8) as *i64 87 let krc: i64 = pg_run(subject, "--kat" as *u8, 0 as *u8, 0 as *u8, kb, kl) 88 var kn: i64 = kl[0] 89 if kn < 0 { kn = 0 } 90 gv_puts(" kat rc=" as *u8); gv_num(krc); gv_puts(" bytes=" as *u8); gv_num(kn); gv_puts("\n" as *u8) 91 gv_subjects("kat-output-bytes" as *u8, kn, ctr) 92 gv_check("capture-was-not-silently-truncated-at-the-bound" as *u8, (kn < PG_CAP) as i64, ctr) 93 gv_check("the-subject-self-test-exits-zero" as *u8, (krc == 0) as i64, ctr) 94 gv_check("the-subject-declares-VERDICT-GREEN" as *u8, pg_has(kb, kn, "VERDICT=GREEN" as *u8), ctr) 95 gv_check("the-subject-reports-zero-failed-checks" as *u8, pg_has(kb, kn, "checks failed=0" as *u8), ctr) 96 let teeth: i64 = pg_count_teeth(kb, kn) 97 gv_puts(" kat teeth=" as *u8); gv_num(teeth); gv_puts(" floor=" as *u8); gv_num(PG_KAT_MIN_TEETH); gv_puts("\n" as *u8) 98 gv_check("the-self-test-tooth-count-has-not-SHRUNK-a-tooth-that-stops-running-still-prints-green" as *u8, (teeth >= PG_KAT_MIN_TEETH) as i64, ctr) 99 gv_check("the-self-test-still-carries-its-single-quote-regression-tooth" as *u8, pg_has(kb, kn, "T16" as *u8), ctr) 100 gv_check("the-self-test-still-carries-its-own-neg-control" as *u8, pg_has(kb, kn, "T20 neg-control" as *u8), ctr) 101 102 let gb: *u8 = sys_mmap(PG_CAP) 103 let gl: *i64 = sys_mmap(8) as *i64 104 pg_run(subject, "url" as *u8, PG_URL_GOOD, PG_CONNECT, gb, gl) 105 var gn: i64 = gl[0] 106 if gn < 0 { gn = 0 } 107 let nb: *u8 = sys_mmap(PG_CAP) 108 let nl: *i64 = sys_mmap(8) as *i64 109 pg_run(subject, "url" as *u8, PG_URL_NOVP, PG_CONNECT, nb, nl) 110 var nn: i64 = nl[0] 111 if nn < 0 { nn = 0 } 112 gv_puts(" live good bytes=" as *u8); gv_num(gn); gv_puts(" novp bytes=" as *u8); gv_num(nn); gv_puts("\n" as *u8) 113 // FIXTURE REACHED THE CONDITION. Without this, a total fetch failure would make the bite below pass 114 // for the WRONG REASON -- neither page reporting a declaration is not the same as discriminating. 115 gv_check("fixture-reached-the-condition-both-live-pages-were-fetched-and-parsed" as *u8, 116 pg_has(gb, gn, "\"lang\":1" as *u8) * pg_has(nb, nn, "\"lang\":1" as *u8), ctr) 117 let bad: i64 = pg_has(nb, nn, "\"viewport\":0" as *u8) 118 let good: i64 = pg_has(gb, gn, "\"viewport\":0" as *u8) 119 gv_bite("neg-control-DISCRIMINATES-scores-zero-on-the-page-without-a-declaration-and-not-on-the-page-with-one" as *u8, bad, good, ctr) 120 gv_check("the-SINGLE-QUOTED-declaration-on-a-live-page-scores-ONE-the-2026-08-25-regression" as *u8, 121 pg_has(gb, gn, "\"viewport\":1" as *u8), ctr) 122 123 let rc: i64 = gv_verdict("PPP-PROBE-GATE", ctr, "the published person/product/place ruler: its self-test runs, has not shrunk, and still tells a single-quoted declaration from an absent one on live pages" as *u8) 124 sys_exit(rc) 125 return rc 126}