code wiki / _hdl_build / nx_uigen_site_gate.nx
nx_uigen_site_gate.nx source
↩ module page · 671 lines · 42428 B
1// nx_uigen_site_gate.nx -- MEASURES the prompt-to-site rung: one brief -> a linked MULTI-PAGE site. The
2// checks parse the emitted BYTES independently of the generator: (T1) the site PLAN matches intent for 3
3// held-out briefs, inappropriate pages ABSENT; (T2) every page carries the FULL cross-page nav + all
4// S-class craft markers; (T3) anti-fabrication -- every plain .html href on every page resolves to a page
5// the plan actually emits, and the checker itself is liar-killed with a fabricated link; (T4) per-page
6// structural appropriateness (form on contact, catalog+pricing on products, exactly one hero/final on
7// index, scorecard+dtable on status); (T5) ONE generated palette coheres across every page of a site,
8// differs across sites, matches the topic hue EXACTLY, and emission is deterministic; (T6) sitemap lists
9// exactly the plan and robots points at it. expect_exit: 0 license_tier: ORIGINAL
10import "nx_syscalls.nx"
11import "nx_uigen_site.nx"
12
13// one emit region per artifact under test; every offset is a region index (rule 11: one named size,
14// zero inline offsets). 16 regions x 256KiB = the whole scratch arena; a page is ~19KB so headroom is 13x.
15const K_REGION: i64 = 262144
16// how many teeth this gate carries -- declared, so the evidence line states its own coverage
17const GATE_TEETH: i64 = 16
18
19// append a decimal to a buffer (evidence line needs numbers; gn() writes to stdout)
20func he_putn(buf: *u8, off: i64, v: i64) -> i64 {
21 if v == 0 { buf[off] = 48 as u8; return off + 1 }
22 var m: i64 = v
23 var o: i64 = off
24 if m < 0 { buf[o] = 45 as u8; o = o + 1; m = 0 - m }
25 let t: *u8 = sys_mmap(28)
26 var k: i64 = 0
27 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }
28 while k > 0 { k = k - 1; buf[o] = t[k]; o = o + 1 }
29 return o
30}
31
32func gp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
33func gn(v: i64) -> i64 { if v==0 { sys_write(1,"0" as *u8,1); return 0 } var m: i64=v; if m<0 { sys_write(1,"-" as *u8,1); m=0-m } let t: *u8=sys_mmap(28); var k: i64=0; while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } while k>0 { k=k-1; sys_write(1,(((t as i64)+k) as *u8),1) } return 0 }
34func litlen(lit: *u8) -> i64 { var n: i64=0; while lit[n]!=(0 as u8){n=n+1} return n }
35func idxat(buf: *u8, base: i64, len: i64, lit: *u8) -> i64 {
36 let ll: i64=litlen(lit)
37 if ll==0 { return 0-1 }
38 var i: i64=base
39 while i+ll<=base+len { var j: i64=0; var ok: i64=1; while j<ll { if buf[i+j]!=lit[j] { ok=0; j=ll } else { j=j+1 } } if ok==1 { return i } i=i+1 }
40 return 0-1
41}
42func cntat(buf: *u8, base: i64, len: i64, lit: *u8) -> i64 {
43 let ll: i64=litlen(lit)
44 if ll==0 { return 0 }
45 var c: i64=0; var i: i64=base
46 while i+ll<=base+len { var j: i64=0; var ok: i64=1; while j<ll { if buf[i+j]!=lit[j] { ok=0; j=ll } else { j=j+1 } } if ok==1 { c=c+1; i=i+ll } else { i=i+1 } }
47 return c
48}
49// every plain (no '/' no ':') href="X.html" must resolve to a slug in the plan. Returns unresolved count.
50func href_bad(buf: *u8, base: i64, len: i64, plan: *i64, n: i64, tmp: *u8) -> i64 {
51 var bad: i64 = 0
52 let end: i64 = base + len
53 let lit: *u8 = "href=\"" as *u8
54 var i: i64 = base
55 while i + 6 <= end {
56 var ok: i64 = 1
57 var j: i64 = 0
58 while j < 6 { if buf[i+j] != lit[j] { ok = 0; j = 6 } else { j = j + 1 } }
59 if ok == 1 {
60 var m: i64 = i + 6
61 var tl: i64 = 0
62 var stop: i64 = 0
63 while stop == 0 {
64 if m >= end { stop = 1 } else {
65 if buf[m] == (34 as u8) { stop = 1 } else {
66 if tl < 120 { tmp[tl] = buf[m]; tl = tl + 1 }
67 m = m + 1
68 }
69 }
70 }
71 tmp[tl] = 0 as u8
72 var ishtml: i64 = 0
73 if tl > 5 {
74 if tmp[tl-5]==(46 as u8) { if tmp[tl-4]==(104 as u8) { if tmp[tl-3]==(116 as u8) { if tmp[tl-2]==(109 as u8) { if tmp[tl-1]==(108 as u8) { ishtml = 1 } } } } }
75 }
76 var plain: i64 = 1
77 var q: i64 = 0
78 while q < tl { if tmp[q]==(47 as u8) { plain=0 } if tmp[q]==(58 as u8) { plain=0 } q=q+1 }
79 if ishtml == 1 { if plain == 1 {
80 var found: i64 = 0
81 var p: i64 = 0
82 while p < n { if l3_streq(tmp, us_slug(plan[p])) == 1 { found = 1 } p = p + 1 }
83 if found == 0 { bad = bad + 1 }
84 } }
85 }
86 i = i + 1
87 }
88 return bad
89}
90// craft markers every generated page must carry (kit-by-construction)
91func craft_ok(buf: *u8, base: i64, len: i64) -> i64 {
92 var c: i64 = 1
93 if cntat(buf, base, len, "var(--nx-" as *u8) == 0 { c = 0 }
94 if cntat(buf, base, len, "skip-link" as *u8) == 0 { c = 0 }
95 if cntat(buf, base, len, "@media" as *u8) == 0 { c = 0 }
96 if cntat(buf, base, len, "focus-visible" as *u8) == 0 { c = 0 }
97 if cntat(buf, base, len, "prefers-reduced-motion" as *u8) == 0 { c = 0 }
98 return c
99}
100func plan_has(plan: *i64, n: i64, kind: i64) -> i64 {
101 var i: i64 = 0
102 while i < n { if plan[i] == kind { return 1 } i = i + 1 }
103 return 0
104}
105func sname(kind: i64) -> *u8 {
106 if kind == 0 { return "web_assets/uigen_site_a_index.html" as *u8 }
107 if kind == 1 { return "web_assets/uigen_site_a_products.html" as *u8 }
108 if kind == 4 { return "web_assets/uigen_site_a_about.html" as *u8 }
109 return "web_assets/uigen_site_a_contact.html" as *u8
110}
111
112func main() -> i64 {
113 let buf: *u8 = sys_mmap(K_REGION * 16)
114 let tmp: *u8 = sys_mmap(256)
115 let exp: *u8 = sys_mmap(256)
116 let planA: *i64 = sys_mmap(64) as *i64
117 let planB: *i64 = sys_mmap(64) as *i64
118 let planC: *i64 = sys_mmap(64) as *i64
119 let offs: *i64 = sys_mmap(64) as *i64
120 let lens: *i64 = sys_mmap(64) as *i64
121 var fails: i64 = 0
122
123 let briefA: *u8 = "Launch a coffee shop with an online store and a contact form" as *u8
124 let briefB: *u8 = "A health clinic patient portal with a metrics dashboard" as *u8
125 let briefC: *u8 = "Developer documentation and guides for the platform" as *u8
126
127 gp("=== NX-UIGEN-SITE GATE -- prompt-to-site: one brief -> a linked multi-page site ===\n" as *u8)
128
129 // ---- T1 site plans match intent; inappropriate pages ABSENT ----
130 let nA: i64 = us_plan(briefA, planA)
131 let nB: i64 = us_plan(briefB, planB)
132 let nC: i64 = us_plan(briefC, planC)
133 var t1: i64 = 1
134 if nA != 4 { t1 = 0 }
135 if plan_has(planA, nA, 1) == 0 { t1 = 0 }
136 if plan_has(planA, nA, 2) == 1 { t1 = 0 }
137 if plan_has(planA, nA, 5) == 0 { t1 = 0 }
138 if plan_has(planB, nB, 2) == 0 { t1 = 0 }
139 if plan_has(planB, nB, 1) == 1 { t1 = 0 }
140 if plan_has(planC, nC, 3) == 0 { t1 = 0 }
141 if plan_has(planC, nC, 1) == 1 { t1 = 0 }
142 gp("T1 plans: A n=" as *u8); gn(nA); gp(" (products yes, status no) B n=" as *u8); gn(nB); gp(" (status yes, products no) C docs yes -> " as *u8); gn(t1); gp("\n" as *u8)
143 if t1 == 0 { fails = fails + 1 }
144
145 // ---- emit ALL pages of site A (and keep offsets) ----
146 var i: i64 = 0
147 while i < nA {
148 offs[i] = i * K_REGION
149 lens[i] = us_emit_page(buf, offs[i], briefA, "Bean Corner" as *u8, "Bean Corner" as *u8, planA, nA, planA[i]) - offs[i]
150 i = i + 1
151 }
152 // B: index + status page
153 let bi_off: i64 = K_REGION * 5
154 let bi_len: i64 = us_emit_page(buf, bi_off, briefB, "Clinic Portal" as *u8, "Clinic Portal" as *u8, planB, nB, 0) - bi_off
155 let bs_off: i64 = K_REGION * 6
156 let bs_len: i64 = us_emit_page(buf, bs_off, briefB, "Clinic Portal" as *u8, "Clinic Portal" as *u8, planB, nB, 2) - bs_off
157
158 // ---- T2 every A page: full nav (every planned slug linked) + craft markers ----
159 var t2: i64 = 1
160 i = 0
161 while i < nA {
162 var p: i64 = 0
163 while p < nA {
164 var o2: i64 = 0
165 o2 = he_puts(tmp, 0, "href=\"" as *u8)
166 o2 = he_puts(tmp, o2, us_slug(planA[p]))
167 o2 = he_puts(tmp, o2, "\"" as *u8)
168 tmp[o2] = 0 as u8
169 if cntat(buf, offs[i], lens[i], tmp) == 0 { t2 = 0 }
170 p = p + 1
171 }
172 if craft_ok(buf, offs[i], lens[i]) == 0 { t2 = 0 }
173 gp(" page kind=" as *u8); gn(planA[i]); gp(" bytes=" as *u8); gn(lens[i]); gp(" nav+craft ok so far=" as *u8); gn(t2); gp("\n" as *u8)
174 i = i + 1
175 }
176 gp("T2 nav-complete + craft on every page -> " as *u8); gn(t2); gp("\n" as *u8)
177 if t2 == 0 { fails = fails + 1 }
178
179 // ---- T3 anti-fabrication: all plain .html hrefs resolve; checker liar-killed ----
180 var t3: i64 = 1
181 i = 0
182 while i < nA {
183 let bad: i64 = href_bad(buf, offs[i], lens[i], planA, nA, tmp)
184 if bad != 0 { t3 = 0 }
185 i = i + 1
186 }
187 let fk_off: i64 = K_REGION * 9
188 var fo: i64 = he_puts(buf, fk_off, "<p><a href=\"ghost.html\">nope</a></p>" as *u8)
189 let killed: i64 = href_bad(buf, fk_off, fo - fk_off, planA, nA, tmp)
190 if killed != 1 { t3 = 0 }
191 gp("T3 all hrefs resolve on every page; liar-kill (ghost.html) fired=" as *u8); gn(killed); gp(" -> " as *u8); gn(t3); gp("\n" as *u8)
192 if t3 == 0 { fails = fails + 1 }
193
194 // ---- T4 per-page structural appropriateness ----
195 var t4: i64 = 1
196 var ct_i: i64 = 0 - 1
197 var pr_i: i64 = 0 - 1
198 i = 0
199 while i < nA {
200 if planA[i] == 5 { ct_i = i }
201 if planA[i] == 1 { pr_i = i }
202 i = i + 1
203 }
204 // ★RE-BASELINED 08-05 (R0a, debt 1785883411): a form with no handler is a fake. The req-less
205 // contact page must carry NO form and NO dead anchor -- an honest coming-soon instead. The form's
206 // positive witness (req names a real action -> live form) moved to T15.
207 if cntat(buf, offs[ct_i], lens[ct_i], "class=\"nform\"" as *u8) != 0 { t4 = 0 }
208 if cntat(buf, offs[ct_i], lens[ct_i], "action=\"#\"" as *u8) != 0 { t4 = 0 }
209 if cntat(buf, offs[ct_i], lens[ct_i], "Coming soon" as *u8) == 0 { t4 = 0 }
210 if cntat(buf, offs[pr_i], lens[pr_i], "class=\"km-grid\"" as *u8) != 1 { t4 = 0 }
211 if cntat(buf, offs[pr_i], lens[pr_i], "class=\"sec priceband\"" as *u8) != 0 { t4 = 0 }
212 // ★RE-BASELINED 07-25: briefA ("...online store...") now routes to the MARKET family by design, so
213 // the index is a STOREFRONT, not a marketing hero. The default grammar keeps its own witness in T12.
214 if cntat(buf, offs[0], lens[0], "class=\"km-grid\"" as *u8) != 1 { t4 = 0 }
215 if cntat(buf, offs[0], lens[0], "class=\"km-price\"" as *u8) != 4 { t4 = 0 }
216 if cntat(buf, offs[0], lens[0], "class=\"km-add\"" as *u8) != 4 { t4 = 0 }
217 if cntat(buf, offs[0], lens[0], "class=\"km-trust\"" as *u8) != 1 { t4 = 0 }
218 if cntat(buf, offs[0], lens[0], "class=\"hero\"" as *u8) != 0 { t4 = 0 }
219 if cntat(buf, offs[0], lens[0], "class=\"nform\"" as *u8) != 0 { t4 = 0 }
220 // ★RE-BASELINED 08-05 (R0a, debt 1785934277): metrics are CLAIMS. A req-less status page must
221 // carry NO fabricated scorecard/table -- an honest coming-soon. Positive witness moved to T16.
222 if cntat(buf, bs_off, bs_len, "class=\"scorecard\"" as *u8) != 0 { t4 = 0 }
223 if cntat(buf, bs_off, bs_len, "class=\"dtable\"" as *u8) != 0 { t4 = 0 }
224 if cntat(buf, bs_off, bs_len, "Coming soon" as *u8) == 0 { t4 = 0 }
225 gp("T4 appropriateness: contact=no-dead-form(coming-soon), products=catalog+pricing, index storefront, status=no-fabricated-metrics(coming-soon) -> " as *u8); gn(t4); gp("\n" as *u8)
226 if t4 == 0 { fails = fails + 1 }
227
228 // ---- T5 palette: coheres across site A, EXACT topic hue, differs from site B, deterministic ----
229 var t5: i64 = 1
230 var eo: i64 = l1_tok(exp, 0, "--nx-color-primary:" as *u8, 30, 62, 46)
231 exp[eo] = 0 as u8
232 i = 0
233 while i < nA {
234 if idxat(buf, offs[i], lens[i], exp) < 0 { t5 = 0 }
235 i = i + 1
236 }
237 var eb: i64 = l1_tok(tmp, 0, "--nx-color-primary:" as *u8, 150, 62, 46)
238 tmp[eb] = 0 as u8
239 if idxat(buf, bi_off, bi_len, tmp) < 0 { t5 = 0 }
240 if idxat(buf, bi_off, bi_len, exp) >= 0 { t5 = 0 }
241 let d2_off: i64 = K_REGION * 4
242 let d2_len: i64 = us_emit_page(buf, d2_off, briefA, "Bean Corner" as *u8, "Bean Corner" as *u8, planA, nA, 0) - d2_off
243 var det: i64 = 1
244 if d2_len != lens[0] { det = 0 }
245 var b2: i64 = 0
246 if det == 1 {
247 while b2 < d2_len { if buf[d2_off + b2] != buf[offs[0] + b2] { det = 0; b2 = d2_len } else { b2 = b2 + 1 } }
248 }
249 if det == 0 { t5 = 0 }
250 gp("T5 palette site-coherent (hue 30 EXACT on all A pages), B=hue150 distinct, deterministic re-emit=" as *u8); gn(det); gp(" -> " as *u8); gn(t5); gp("\n" as *u8)
251 if t5 == 0 { fails = fails + 1 }
252
253 // ---- T6 sitemap/robots derive from the SAME plan ----
254 var t6: i64 = 1
255 let sm_off: i64 = K_REGION * 7
256 let sm_len: i64 = us_sitemap(buf, sm_off, "example.com" as *u8, planA, nA) - sm_off
257 if cntat(buf, sm_off, sm_len, "<loc>" as *u8) != nA { t6 = 0 }
258 if cntat(buf, sm_off, sm_len, "products.html" as *u8) == 0 { t6 = 0 }
259 if cntat(buf, sm_off, sm_len, "status.html" as *u8) != 0 { t6 = 0 }
260 let rb_off: i64 = K_REGION * 8
261 let rb_len: i64 = us_robots(buf, rb_off, "example.com" as *u8) - rb_off
262 if cntat(buf, rb_off, rb_len, "Sitemap: https://example.com/sitemap.xml" as *u8) == 0 { t6 = 0 }
263 gp("T6 sitemap urls=" as *u8); gn(cntat(buf, sm_off, sm_len, "<loc>" as *u8)); gp("/" as *u8); gn(nA); gp(" robots points at sitemap -> " as *u8); gn(t6); gp("\n" as *u8)
264 if t6 == 0 { fails = fails + 1 }
265
266 // ---- T7 requirements brief (R-content): real copy lands verbatim, defaults replaced, unspecified
267 // pages keep defaults, and req=0 is BYTE-NEUTRAL vs the req-less entry ----
268 var t7: i64 = 1
269 let reqA: *u8 = "index|promo|Fresh roasted daily\nproducts|1.t|Espresso Blend No. 4\nabout|lede|Family-run since 1987, still hand-roasting.\n" as *u8
270 let ri_off: i64 = K_REGION * 10
271 let ri_len: i64 = us_emit_page_req(buf, ri_off, briefA, "Bean Corner" as *u8, "Bean Corner" as *u8, planA, nA, 0, reqA) - ri_off
272 if cntat(buf, ri_off, ri_len, "<b>Fresh roasted daily</b>" as *u8) == 0 { t7 = 0 }
273 if cntat(buf, ri_off, ri_len, "Everything made in small batches" as *u8) != 0 { t7 = 0 }
274 let rp_off: i64 = K_REGION * 11
275 let rp_len: i64 = us_emit_page_req(buf, rp_off, briefA, "Bean Corner" as *u8, "Bean Corner" as *u8, planA, nA, 1, reqA) - rp_off
276 if cntat(buf, rp_off, rp_len, "Espresso Blend No. 4" as *u8) == 0 { t7 = 0 }
277 if cntat(buf, rp_off, rp_len, "The flagship" as *u8) != 0 { t7 = 0 }
278 let rc_off: i64 = K_REGION * 12
279 let rc_len: i64 = us_emit_page_req(buf, rc_off, briefA, "Bean Corner" as *u8, "Bean Corner" as *u8, planA, nA, 5, reqA) - rc_off
280 if cntat(buf, rc_off, rc_len, "How to reach us." as *u8) == 0 { t7 = 0 }
281 let rz_off: i64 = K_REGION * 13
282 let rz_len: i64 = us_emit_page_req(buf, rz_off, briefA, "Bean Corner" as *u8, "Bean Corner" as *u8, planA, nA, 0, 0 as *u8) - rz_off
283 var neut: i64 = 1
284 if rz_len != lens[0] { neut = 0 }
285 var nb2: i64 = 0
286 if neut == 1 {
287 while nb2 < rz_len { if buf[rz_off + nb2] != buf[offs[0] + nb2] { neut = 0; nb2 = rz_len } else { nb2 = nb2 + 1 } }
288 }
289 if neut == 0 { t7 = 0 }
290 gp("T7 req brief: verbatim copy lands, defaults replaced, unspecified page keeps defaults, req=0 byte-neutral=" as *u8); gn(neut); gp(" -> " as *u8); gn(t7); gp("\n" as *u8)
291 if t7 == 0 { fails = fails + 1 }
292
293 // ---- T8 site-level refine (R-refine-live): one command changes EXACTLY its axis on the emitted
294 // index; structure preserved; invalid commands REFUSED by the grammar ----
295 var t8: i64 = 1
296 let rspec: *i64 = sys_mmap(128) as *i64
297 us_spec(briefA, rspec)
298 if l3_refine(rspec, "hue 300" as *u8) != 1 { t8 = 0 }
299 if l3_refine(rspec, "accent complement" as *u8) != 1 { t8 = 0 }
300 let rf_off: i64 = K_REGION * 14
301 let rf_len: i64 = us_page_index(buf, rf_off, rspec, "Bean Corner" as *u8, "Bean Corner" as *u8, planA, nA, 0 as *u8) - rf_off
302 var e300: i64 = l1_tok(tmp, 0, "--nx-color-primary:" as *u8, 300, 62, 46)
303 tmp[e300] = 0 as u8
304 if idxat(buf, rf_off, rf_len, tmp) < 0 { t8 = 0 }
305 if idxat(buf, rf_off, rf_len, exp) >= 0 { t8 = 0 }
306 var eacc: i64 = l1_tok(tmp, 0, "--nx-color-accent:" as *u8, 120, 72, 50)
307 tmp[eacc] = 0 as u8
308 if idxat(buf, rf_off, rf_len, tmp) < 0 { t8 = 0 }
309 // baseline for preservation must be the SAME family the refine grammar acts on (the marketing
310 // composer). Comparing against site A's index broke when that brief moved to the Market family.
311 let rb2_off: i64 = K_REGION * 9
312 let bspec: *i64 = sys_mmap(128) as *i64
313 us_spec(briefA, bspec)
314 let rb2_len: i64 = us_page_index(buf, rb2_off, bspec, "Bean Corner" as *u8, "Bean Corner" as *u8, planA, nA, 0 as *u8) - rb2_off
315 var sp2: i64 = 0 var prsv: i64 = 1
316 while sp2 < 7 {
317 var mk: *u8 = "class=\"grid3\"" as *u8
318 if sp2 == 1 { mk = "class=\"sec splitband\"" as *u8 }
319 if sp2 == 2 { mk = "class=\"sec stepsband\"" as *u8 }
320 if sp2 == 3 { mk = "class=\"sec priceband\"" as *u8 }
321 if sp2 == 4 { mk = "class=\"sec quoteband\"" as *u8 }
322 if sp2 == 5 { mk = "class=\"sec faqband\"" as *u8 }
323 if sp2 == 6 { mk = "class=\"trust\"" as *u8 }
324 if cntat(buf, rf_off, rf_len, mk) != cntat(buf, rb2_off, rb2_len, mk) { prsv = 0 }
325 sp2 = sp2 + 1
326 }
327 if prsv == 0 { t8 = 0 }
328 if l3_refine(rspec, "add nosuchband" as *u8) != 0 { t8 = 0 }
329 gp("T8 refine at site level: hue+accent retargeted exactly, section structure preserved=" as *u8); gn(prsv); gp(", bogus command refused -> " as *u8); gn(t8); gp("\n" as *u8)
330 if t8 == 0 { fails = fails + 1 }
331
332 // ---- T9 design-family routing (R-family-pro): a professional brief gets the Counsel grammar
333 // (serif editorial, stats, ruled list, NO SaaS shapes); the coffee brief stays marketing;
334 // every link still resolves and craft holds ----
335 var t9: i64 = 1
336 let briefL: *u8 = "A family law firm offering estate planning, business counsel and civil litigation" as *u8
337 if us_family(briefL) != 1 { t9 = 0 }
338 if us_family(briefA) == 1 { t9 = 0 }
339 let planL: *i64 = sys_mmap(64) as *i64
340 let nL: i64 = us_plan(briefL, planL)
341 if nL != 3 { t9 = 0 }
342 let lw_off: i64 = K_REGION * 15
343 let lw_len: i64 = us_emit_page_req(buf, lw_off, briefL, "Andelin & West" as *u8, "Andelin & West" as *u8, planL, nL, 0, 0 as *u8) - lw_off
344 if cntat(buf, lw_off, lw_len, "kc-hero" as *u8) == 0 { t9 = 0 }
345 // ★RE-BASELINED 08-05 (R0a pre-live item 2): numbers/testimonials/accreditations are CLAIMS.
346 // A req-less emit carries NONE of them (markup-anchored -- the CSS rules legitimately remain);
347 // the ARMED emit below proves the bands still exist and take values verbatim.
348 if cntat(buf, lw_off, lw_len, "class=\"kc-stat\"" as *u8) != 0 { t9 = 0 }
349 if cntat(buf, lw_off, lw_len, "class=\"kc-quote\"" as *u8) != 0 { t9 = 0 }
350 if cntat(buf, lw_off, lw_len, "AV Preeminent" as *u8) != 0 { t9 = 0 }
351 if cntat(buf, lw_off, lw_len, "1,200" as *u8) != 0 { t9 = 0 }
352 if cntat(buf, lw_off, lw_len, "kc-final" as *u8) == 0 { t9 = 0 }
353 let reqS9: *u8 = "index|s1.n|2008\nindex|s1.l|serving Utah since\nindex|q|They explained every step before it happened.\nindex|qn|A client\nindex|qr|estate matter\nindex|a1|Utah State Bar\nindex|a2|Free consultation\nindex|a3|Since 2008\n" as *u8
354 let s9_off: i64 = K_REGION * 9
355 let s9_len: i64 = us_emit_page_req(buf, s9_off, briefL, "Andelin & West" as *u8, "Andelin & West" as *u8, planL, nL, 0, reqS9) - s9_off
356 if cntat(buf, s9_off, s9_len, "class=\"kc-stat\"" as *u8) == 0 { t9 = 0 }
357 if cntat(buf, s9_off, s9_len, "2008" as *u8) == 0 { t9 = 0 }
358 if cntat(buf, s9_off, s9_len, "class=\"kc-quote\"" as *u8) == 0 { t9 = 0 }
359 if cntat(buf, s9_off, s9_len, "Utah State Bar" as *u8) == 0 { t9 = 0 }
360 if cntat(buf, lw_off, lw_len, "ui-serif" as *u8) == 0 { t9 = 0 }
361 if cntat(buf, lw_off, lw_len, "class=\"hero\"" as *u8) != 0 { t9 = 0 }
362 if cntat(buf, lw_off, lw_len, "class=\"grid3\"" as *u8) != 0 { t9 = 0 }
363 if cntat(buf, lw_off, lw_len, "priceband" as *u8) != 0 { t9 = 0 }
364 if cntat(buf, lw_off, lw_len, "class=\"btn btn-primary\"" as *u8) != 0 { t9 = 0 }
365 if craft_ok(buf, lw_off, lw_len) == 0 { t9 = 0 }
366 if href_bad(buf, lw_off, lw_len, planL, nL, tmp) != 0 { t9 = 0 }
367 if cntat(buf, offs[0], lens[0], "kc-hero" as *u8) != 0 { t9 = 0 }
368 gp("T9 family routing: law brief -> Counsel grammar (serif+stats+quote+final, ZERO SaaS shapes), coffee stays marketing, links+craft hold -> " as *u8); gn(t9); gp("\n" as *u8)
369 if t9 == 0 { fails = fails + 1 }
370 let fdl: i64 = sys_openat_wr("web_assets/uigen_site_l_index.html" as *u8, 420)
371 if fdl >= 0 { sys_write(fdl, (((buf as i64) + lw_off) as *u8), lw_len); sys_close(fdl) }
372
373 // ---- T10 FAMILY CONSISTENCY: every page of a Counsel site carries the family (a site must never
374 // ship two design languages -- the 07-25 render found a serif ivory home next to a cool-grey
375 // SaaS contact page). Also asserts the coffee site's doc pages are UNCHANGED. ----
376 var t10: i64 = 1
377 var ci: i64 = 0
378 while ci < nL {
379 if planL[ci] != 0 {
380 let dp_off: i64 = K_REGION * 15
381 let dp_len: i64 = us_emit_page_req(buf, dp_off, briefL, "Andelin & West" as *u8, "Andelin & West" as *u8, planL, nL, planL[ci], 0 as *u8) - dp_off
382 if cntat(buf, dp_off, dp_len, "--kc-serif" as *u8) == 0 { t10 = 0 }
383 if cntat(buf, dp_off, dp_len, ".doc h1{font-family:var(--kc-serif)" as *u8) == 0 { t10 = 0 }
384 if cntat(buf, dp_off, dp_len, "header.site .brand .dot{display:none}" as *u8) == 0 { t10 = 0 }
385 if craft_ok(buf, dp_off, dp_len) == 0 { t10 = 0 }
386 gp(" counsel subpage kind=" as *u8); gn(planL[ci]); gp(" family-carried ok=" as *u8); gn(t10); gp("\n" as *u8)
387 }
388 ci = ci + 1
389 }
390 // the marketing family must be untouched: coffee contact re-emit byte-identical to the T2 capture
391 let cc_off: i64 = K_REGION * 14
392 let cc_len: i64 = us_emit_page_req(buf, cc_off, briefA, "Bean Corner" as *u8, "Bean Corner" as *u8, planA, nA, 5, 0 as *u8) - cc_off
393 var cneut: i64 = 1
394 if cc_len != lens[ct_i] { cneut = 0 }
395 var cb: i64 = 0
396 if cneut == 1 {
397 while cb < cc_len { if buf[cc_off + cb] != buf[offs[ct_i] + cb] { cneut = 0; cb = cc_len } else { cb = cb + 1 } }
398 }
399 if cneut == 0 { t10 = 0 }
400 if cntat(buf, cc_off, cc_len, "--kc-serif" as *u8) != 0 { t10 = 0 }
401 gp("T10 family consistency: every Counsel subpage carries the family; coffee doc pages byte-neutral=" as *u8); gn(cneut); gp(" -> " as *u8); gn(t10); gp("\n" as *u8)
402 if t10 == 0 { fails = fails + 1 }
403
404 // ---- T11 THREE-FAMILY ROUTING: an editorial brief gets Journal, and the three families stay
405 // MUTUALLY EXCLUSIVE (no family's markers leak into another's page) ----
406 var t11: i64 = 1
407 let briefJ: *u8 = "A weekly magazine and blog of essays about food and farming" as *u8
408 if us_family(briefJ) != 2 { t11 = 0 }
409 if us_family(briefL) != 1 { t11 = 0 }
410 if us_family(briefA) != 3 { t11 = 0 }
411 // "a legal journal" must read as a PUBLICATION, not a firm (ordering tooth)
412 if us_family("a legal journal of estate law commentary" as *u8) != 2 { t11 = 0 }
413 let planJ: *i64 = sys_mmap(64) as *i64
414 let nJ: i64 = us_plan(briefJ, planJ)
415 let jw_off: i64 = K_REGION * 13
416 let jw_len: i64 = us_emit_page_req(buf, jw_off, briefJ, "The Furrow" as *u8, "The Furrow" as *u8, planJ, nJ, 0, 0 as *u8) - jw_off
417 if cntat(buf, jw_off, jw_len, "kj-lead" as *u8) == 0 { t11 = 0 }
418 if cntat(buf, jw_off, jw_len, "kj-art" as *u8) == 0 { t11 = 0 }
419 if cntat(buf, jw_off, jw_len, "kj-sub" as *u8) == 0 { t11 = 0 }
420 if cntat(buf, jw_off, jw_len, "first-letter" as *u8) == 0 { t11 = 0 }
421 // mutual exclusion: no Counsel and no marketing markers on a Journal page, and vice versa
422 if cntat(buf, jw_off, jw_len, "kc-hero" as *u8) != 0 { t11 = 0 }
423 if cntat(buf, jw_off, jw_len, "class=\"hero\"" as *u8) != 0 { t11 = 0 }
424 if cntat(buf, jw_off, jw_len, "class=\"grid3\"" as *u8) != 0 { t11 = 0 }
425 if cntat(buf, lw_off, lw_len, "kj-lead" as *u8) != 0 { t11 = 0 }
426 if cntat(buf, offs[0], lens[0], "kj-lead" as *u8) != 0 { t11 = 0 }
427 if craft_ok(buf, jw_off, jw_len) == 0 { t11 = 0 }
428 if href_bad(buf, jw_off, jw_len, planJ, nJ, tmp) != 0 { t11 = 0 }
429 // the Journal doc tier carries the family too (round-9 lesson applied up front)
430 let jd_off: i64 = K_REGION * 12
431 let jd_len: i64 = us_emit_page_req(buf, jd_off, briefJ, "The Furrow" as *u8, "The Furrow" as *u8, planJ, nJ, 5, 0 as *u8) - jd_off
432 if cntat(buf, jd_off, jd_len, "--kj-serif" as *u8) == 0 { t11 = 0 }
433 if cntat(buf, jd_off, jd_len, "header.site .brand .dot{display:none}" as *u8) == 0 { t11 = 0 }
434 gp("T11 three-family routing: editorial brief -> Journal (lead+articles+subscribe+dropcap), families mutually exclusive, doc tier in-family, links+craft hold -> " as *u8); gn(t11); gp("\n" as *u8)
435 if t11 == 0 { fails = fails + 1 }
436 let fdj: i64 = sys_openat_wr("web_assets/uigen_site_j_index.html" as *u8, 420)
437 if fdj >= 0 { sys_write(fdj, (((buf as i64) + jw_off) as *u8), jw_len); sys_close(fdj) }
438
439 // ---- T12 the DEFAULT (marketing) family keeps a witness of its own, now that the coffee brief has
440 // moved to Market. Four families, and no family's markers may appear on another's page. ----
441 var t12: i64 = 1
442 let briefK: *u8 = "Launch a landing page for a new startup with a contact form" as *u8
443 if us_family(briefK) != 0 { t12 = 0 }
444 if us_family(briefA) != 3 { t12 = 0 }
445 // "a magazine about retail" must stay a PUBLICATION (Journal is checked before Market)
446 if us_family("a magazine about retail and shop culture" as *u8) != 2 { t12 = 0 }
447 let planK: *i64 = sys_mmap(64) as *i64
448 let nK: i64 = us_plan(briefK, planK)
449 let kw_off: i64 = K_REGION * 11
450 let kw_len: i64 = us_emit_page_req(buf, kw_off, briefK, "Northwind" as *u8, "Northwind" as *u8, planK, nK, 0, 0 as *u8) - kw_off
451 if cntat(buf, kw_off, kw_len, "class=\"hero\"" as *u8) != 1 { t12 = 0 }
452 if cntat(buf, kw_off, kw_len, "class=\"final\"" as *u8) != 1 { t12 = 0 }
453 if cntat(buf, kw_off, kw_len, "class=\"km-grid\"" as *u8) != 0 { t12 = 0 }
454 if cntat(buf, kw_off, kw_len, "kc-hero" as *u8) != 0 { t12 = 0 }
455 if cntat(buf, kw_off, kw_len, "kj-lead" as *u8) != 0 { t12 = 0 }
456 if craft_ok(buf, kw_off, kw_len) == 0 { t12 = 0 }
457 if href_bad(buf, kw_off, kw_len, planK, nK, tmp) != 0 { t12 = 0 }
458 // and the three authored families never leak into each other
459 if cntat(buf, lw_off, lw_len, "class=\"km-grid\"" as *u8) != 0 { t12 = 0 }
460 if cntat(buf, jw_off, jw_len, "class=\"km-grid\"" as *u8) != 0 { t12 = 0 }
461 if cntat(buf, offs[0], lens[0], "kc-hero" as *u8) != 0 { t12 = 0 }
462 if cntat(buf, offs[0], lens[0], "kj-lead" as *u8) != 0 { t12 = 0 }
463 // Market doc tier carries the family
464 let kd_off: i64 = K_REGION * 10
465 let kd_len: i64 = us_emit_page_req(buf, kd_off, briefA, "Bean Corner" as *u8, "Bean Corner" as *u8, planA, nA, 5, 0 as *u8) - kd_off
466 if cntat(buf, kd_off, kd_len, "--km-buy" as *u8) == 0 { t12 = 0 }
467 gp("T12 four-family map: default witness keeps hero+final, coffee=Market storefront, magazine-about-retail stays Journal, zero cross-family leakage -> " as *u8); gn(t12); gp("\n" as *u8)
468 if t12 == 0 { fails = fails + 1 }
469 let fdk: i64 = sys_openat_wr("web_assets/uigen_site_m_index.html" as *u8, 420)
470 if fdk >= 0 { sys_write(fdk, (((buf as i64) + offs[0]) as *u8), lens[0]); sys_close(fdk) }
471
472 // ---- T13 ANTI-LEAK: the GENERATOR'S OWN marketing copy must never appear on a generated client
473 // site. Found live: a coffee roastery's products page was selling "$19/mo Studio -- Unlimited
474 // generations, Refine loop included" because the marketing products page composed a pricing-TIER
475 // band whose default copy describes THIS TOOL. A shop sells the shop's products. ----
476 var t13: i64 = 1
477 var pi2: i64 = 0
478 while pi2 < nA {
479 if cntat(buf, offs[pi2], lens[pi2], "Unlimited generations" as *u8) != 0 { t13 = 0 }
480 if cntat(buf, offs[pi2], lens[pi2], "One generated site" as *u8) != 0 { t13 = 0 }
481 if cntat(buf, offs[pi2], lens[pi2], "Refine loop included" as *u8) != 0 { t13 = 0 }
482 if cntat(buf, offs[pi2], lens[pi2], "Multi-site fleets" as *u8) != 0 { t13 = 0 }
483 if cntat(buf, offs[pi2], lens[pi2], "class=\"sec priceband\"" as *u8) != 0 { t13 = 0 }
484 pi2 = pi2 + 1
485 }
486 // and the Market catalog page is a real catalog: 6 priced items, add-to-cart, trust row
487 if cntat(buf, offs[pr_i], lens[pr_i], "class=\"km-price\"" as *u8) != 6 { t13 = 0 }
488 if cntat(buf, offs[pr_i], lens[pr_i], "class=\"km-add\"" as *u8) != 6 { t13 = 0 }
489 if cntat(buf, offs[pr_i], lens[pr_i], "class=\"km-trust\"" as *u8) != 1 { t13 = 0 }
490 if craft_ok(buf, offs[pr_i], lens[pr_i]) == 0 { t13 = 0 }
491 if href_bad(buf, offs[pr_i], lens[pr_i], planA, nA, tmp) != 0 { t13 = 0 }
492 // liar-kill the checker itself: the leak string MUST still be detectable where it legitimately lives
493 let lk_off: i64 = K_REGION * 9
494 var lko: i64 = he_puts(buf, lk_off, "<li>Unlimited generations</li>" as *u8)
495 if cntat(buf, lk_off, lko - lk_off, "Unlimited generations" as *u8) != 1 { t13 = 0 }
496 gp("T13 anti-leak: ZERO generator-marketing strings on any client page, Market catalog = 6 priced items + cart + trust, checker liar-killed -> " as *u8); gn(t13); gp("\n" as *u8)
497 if t13 == 0 { fails = fails + 1 }
498
499 // ---- T14 REFINE IS SITE-WIDE: a refined site must not contradict itself. Refining only the index
500 // left every subpage on the OLD palette -- the exact site-wide coherence this lane advertises. ----
501 var t14: i64 = 1
502 let fspec: *i64 = sys_mmap(128) as *i64
503 us_spec(briefA, fspec)
504 if l3_refine(fspec, "hue 300" as *u8) != 1 { t14 = 0 }
505 var e300b: i64 = l1_tok(tmp, 0, "--nx-color-primary:" as *u8, 300, 62, 46)
506 tmp[e300b] = 0 as u8
507 var ri: i64 = 0
508 while ri < nA {
509 let rp_off2: i64 = K_REGION * 9
510 let rp_len2: i64 = us_emit_page_req_spec(buf, rp_off2, briefA, fspec, "Bean Corner" as *u8, "Bean Corner" as *u8, planA, nA, planA[ri], 0 as *u8) - rp_off2
511 // every page of the refined site carries the REFINED hue, and none carries the original
512 if idxat(buf, rp_off2, rp_len2, tmp) < 0 { t14 = 0 }
513 if idxat(buf, rp_off2, rp_len2, exp) >= 0 { t14 = 0 }
514 if craft_ok(buf, rp_off2, rp_len2) == 0 { t14 = 0 }
515 ri = ri + 1
516 }
517 gp("T14 refine is SITE-WIDE: all " as *u8); gn(nA); gp(" pages carry the refined palette, none keeps the old one -> " as *u8); gn(t14); gp("\n" as *u8)
518 if t14 == 0 { fails = fails + 1 }
519
520 // ---- T15 THE CONVERSION PATH IS REAL (R0a: a dead form is a fake -- debt 1785883411): the form
521 // renders ONLY when the req names a real POST target; req channels render as one-tap tel:/mailto
522 // links; and NO page of ANY family carries action="#" or the generator's own name (the
523 // badge-leak class). Both checkers are liar-killed so the tooth cannot pass by being blind. ----
524 var t15: i64 = 1
525 let req15: *u8 = "contact|phone|+18015550199\ncontact|phone_label|(801) 555-0199\ncontact|email|hello@beancorner.example\ncontact|action|/api/intake\ncontact|back|/factory/gen-coffee/contact#sent\n" as *u8
526 let q15_off: i64 = K_REGION * 10
527 let q15_len: i64 = us_emit_page_req(buf, q15_off, briefA, "Bean Corner" as *u8, "Bean Corner" as *u8, planA, nA, 5, req15) - q15_off
528 if cntat(buf, q15_off, q15_len, "href=\"tel:+18015550199\"" as *u8) == 0 { t15 = 0 }
529 if cntat(buf, q15_off, q15_len, "Call (801) 555-0199" as *u8) == 0 { t15 = 0 }
530 if cntat(buf, q15_off, q15_len, "href=\"mailto:hello@beancorner.example\"" as *u8) == 0 { t15 = 0 }
531 if cntat(buf, q15_off, q15_len, "action=\"/api/intake\"" as *u8) == 0 { t15 = 0 }
532 if cntat(buf, q15_off, q15_len, "class=\"nform\"" as *u8) == 0 { t15 = 0 }
533 if cntat(buf, q15_off, q15_len, "<label for=" as *u8) == 0 { t15 = 0 }
534 if cntat(buf, q15_off, q15_len, "action=\"#\"" as *u8) != 0 { t15 = 0 }
535 // the LIVE form's anatomy: honeypot invisible to people, back target verbatim, zero-JS confirmation
536 if cntat(buf, q15_off, q15_len, "name=\"website\" value=\"\" style=\"display:none\"" as *u8) == 0 { t15 = 0 }
537 if cntat(buf, q15_off, q15_len, "name=\"back\" value=\"/factory/gen-coffee/contact#sent\"" as *u8) == 0 { t15 = 0 }
538 if cntat(buf, q15_off, q15_len, "id=\"sent\"" as *u8) == 0 { t15 = 0 }
539 if cntat(buf, q15_off, q15_len, "#sent:target" as *u8) == 0 { t15 = 0 }
540 let reqp15: *u8 = "contact|phone|+18015550199\n" as *u8
541 let p15_off: i64 = K_REGION * 11
542 let p15_len: i64 = us_emit_page_req(buf, p15_off, briefA, "Bean Corner" as *u8, "Bean Corner" as *u8, planA, nA, 5, reqp15) - p15_off
543 if cntat(buf, p15_off, p15_len, "href=\"tel:+18015550199\"" as *u8) == 0 { t15 = 0 }
544 if cntat(buf, p15_off, p15_len, "class=\"nform\"" as *u8) != 0 { t15 = 0 }
545 if cntat(buf, p15_off, p15_len, "Coming soon" as *u8) != 0 { t15 = 0 }
546 // the doc-tier pages that carried the tool-name docfoot, re-emitted FRESH per family (never rely
547 // on a stale region): Counsel contact, Journal contact, and the default-family docs page
548 let lc15_off: i64 = K_REGION * 12
549 let lc15_len: i64 = us_emit_page_req(buf, lc15_off, briefL, "Andelin & West" as *u8, "Andelin & West" as *u8, planL, nL, 5, 0 as *u8) - lc15_off
550 let jc15_off: i64 = K_REGION * 13
551 let jc15_len: i64 = us_emit_page_req(buf, jc15_off, briefJ, "The Furrow" as *u8, "The Furrow" as *u8, planJ, nJ, 5, 0 as *u8) - jc15_off
552 let dc15_off: i64 = K_REGION * 14
553 let dc15_len: i64 = us_emit_page_req(buf, dc15_off, briefC, "Platform Docs" as *u8, "Platform Docs" as *u8, planC, nC, 3, 0 as *u8) - dc15_off
554 if cntat(buf, lc15_off, lc15_len, "action=\"#\"" as *u8) != 0 { t15 = 0 }
555 if cntat(buf, jc15_off, jc15_len, "action=\"#\"" as *u8) != 0 { t15 = 0 }
556 if cntat(buf, dc15_off, dc15_len, "action=\"#\"" as *u8) != 0 { t15 = 0 }
557 if cntat(buf, lc15_off, lc15_len, "nx_uigen" as *u8) != 0 { t15 = 0 }
558 if cntat(buf, jc15_off, jc15_len, "nx_uigen" as *u8) != 0 { t15 = 0 }
559 if cntat(buf, dc15_off, dc15_len, "nx_uigen" as *u8) != 0 { t15 = 0 }
560 if cntat(buf, lc15_off, lc15_len, "Coming soon" as *u8) == 0 { t15 = 0 }
561 // h2h v2 row (debt 1785953261): phone-at-top -- the Counsel INDEX carries the one-tap tel when the
562 // req names a phone, and NEVER fabricates one when it does not
563 let li15_off: i64 = K_REGION * 11
564 let li15_len: i64 = us_emit_page_req(buf, li15_off, briefL, "Andelin & West" as *u8, "Andelin & West" as *u8, planL, nL, 0, req15) - li15_off
565 if cntat(buf, li15_off, li15_len, "href=\"tel:+18015550199\"" as *u8) == 0 { t15 = 0 }
566 if cntat(buf, li15_off, li15_len, "Call (801) 555-0199" as *u8) == 0 { t15 = 0 }
567 let ln15_off: i64 = K_REGION * 10
568 let ln15_len: i64 = us_emit_page_req(buf, ln15_off, briefL, "Andelin & West" as *u8, "Andelin & West" as *u8, planL, nL, 0, 0 as *u8) - ln15_off
569 if cntat(buf, ln15_off, ln15_len, "href=\"tel:" as *u8) != 0 { t15 = 0 }
570 var pg15: i64 = 0
571 while pg15 < nA {
572 if cntat(buf, offs[pg15], lens[pg15], "action=\"#\"" as *u8) != 0 { t15 = 0 }
573 if cntat(buf, offs[pg15], lens[pg15], "nx_uigen" as *u8) != 0 { t15 = 0 }
574 pg15 = pg15 + 1
575 }
576 if cntat(buf, bs_off, bs_len, "nx_uigen" as *u8) != 0 { t15 = 0 }
577 // liar-kill BOTH checkers: plant the sins in scratch, each must be seen exactly once
578 let s15_off: i64 = K_REGION * 9
579 var s15: i64 = he_puts(buf, s15_off, "<form action=\"#\">made by nx_uigen_site</form>" as *u8)
580 if cntat(buf, s15_off, s15 - s15_off, "action=\"#\"" as *u8) != 1 { t15 = 0 }
581 if cntat(buf, s15_off, s15 - s15_off, "nx_uigen" as *u8) != 1 { t15 = 0 }
582 gp("T15 conversion path real: req action -> live form, req channels -> tel:/mailto one-tap, no dead anchor and no generator name on any family page, liar-kills fired -> " as *u8); gn(t15); gp("\n" as *u8)
583 if t15 == 0 { fails = fails + 1 }
584
585 // ---- T16 METRICS ARE CLAIMS (R0a, debt 1785934277): status values render ONLY from the req; the
586 // old fabricated defaults (99.9 uptime / 1,284 rpm / 'contact submissions accepted') must
587 // appear NOWHERE; docs/about defaults carry no generator process-talk. Liar-killed. ----
588 var t16: i64 = 1
589 let req16: *u8 = "status|score|99.98\nstatus|score.l|% uptime, measured 30d\nstatus|s1.v|412\nstatus|s1.l|requests / min\nstatus|r1.s|front door\nstatus|r1.c|have\nstatus|r1.st|healthy\nstatus|r1.n|serving every page\n" as *u8
590 let m16_off: i64 = K_REGION * 10
591 let m16_len: i64 = us_emit_page_req(buf, m16_off, briefB, "Clinic Portal" as *u8, "Clinic Portal" as *u8, planB, nB, 2, req16) - m16_off
592 if cntat(buf, m16_off, m16_len, "99.98" as *u8) == 0 { t16 = 0 }
593 if cntat(buf, m16_off, m16_len, "% uptime, measured 30d" as *u8) == 0 { t16 = 0 }
594 if cntat(buf, m16_off, m16_len, "class=\"scorecard\"" as *u8) == 0 { t16 = 0 }
595 if cntat(buf, m16_off, m16_len, "requests / min" as *u8) == 0 { t16 = 0 }
596 if cntat(buf, m16_off, m16_len, "class=\"dtable\"" as *u8) == 0 { t16 = 0 }
597 if cntat(buf, m16_off, m16_len, "serving every page" as *u8) == 0 { t16 = 0 }
598 if cntat(buf, m16_off, m16_len, "1,284" as *u8) != 0 { t16 = 0 }
599 if cntat(buf, m16_off, m16_len, "contact submissions accepted" as *u8) != 0 { t16 = 0 }
600 if cntat(buf, bs_off, bs_len, "1,284" as *u8) != 0 { t16 = 0 }
601 if cntat(buf, bs_off, bs_len, "42 ms" as *u8) != 0 { t16 = 0 }
602 if cntat(buf, bs_off, bs_len, "contact submissions accepted" as *u8) != 0 { t16 = 0 }
603 // docs + about defaults: zero process-talk (fresh emits: default-family docs, Counsel about)
604 let d16_off: i64 = K_REGION * 11
605 let d16_len: i64 = us_emit_page_req(buf, d16_off, briefC, "Platform Docs" as *u8, "Platform Docs" as *u8, planC, nC, 3, 0 as *u8) - d16_off
606 if cntat(buf, d16_off, d16_len, "Your brief" as *u8) != 0 { t16 = 0 }
607 if cntat(buf, d16_off, d16_len, "the generator" as *u8) != 0 { t16 = 0 }
608 if cntat(buf, d16_off, d16_len, "L4 rung" as *u8) != 0 { t16 = 0 }
609 let a16_off: i64 = K_REGION * 12
610 let a16_len: i64 = us_emit_page_req(buf, a16_off, briefL, "Andelin & West" as *u8, "Andelin & West" as *u8, planL, nL, 4, 0 as *u8) - a16_off
611 if cntat(buf, a16_off, a16_len, "design grammar" as *u8) != 0 { t16 = 0 }
612 if cntat(buf, a16_off, a16_len, "one-line brief" as *u8) != 0 { t16 = 0 }
613 if cntat(buf, a16_off, a16_len, "byte for byte" as *u8) != 0 { t16 = 0 }
614 if cntat(buf, a16_off, a16_len, "no cookies" as *u8) == 0 { t16 = 0 }
615 // index defaults of BOTH remaining families: zero process-talk on the Journal front page and the
616 // default-family hero (the 'composed by a design grammar' class, debt 1785935138)
617 let j16_off: i64 = K_REGION * 13
618 let j16_len: i64 = us_emit_page_req(buf, j16_off, briefJ, "The Furrow" as *u8, "The Furrow" as *u8, planJ, nJ, 0, 0 as *u8) - j16_off
619 let k16_off: i64 = K_REGION * 14
620 let k16_len: i64 = us_emit_page_req(buf, k16_off, briefK, "Northwind" as *u8, "Northwind" as *u8, planK, nK, 0, 0 as *u8) - k16_off
621 if cntat(buf, j16_off, j16_len, "design grammar" as *u8) != 0 { t16 = 0 }
622 if cntat(buf, j16_off, j16_len, "written brief" as *u8) != 0 { t16 = 0 }
623 if cntat(buf, j16_off, j16_len, "seed hue" as *u8) != 0 { t16 = 0 }
624 if cntat(buf, k16_off, k16_len, "design grammar" as *u8) != 0 { t16 = 0 }
625 if cntat(buf, k16_off, k16_len, "written brief" as *u8) != 0 { t16 = 0 }
626 if cntat(buf, k16_off, k16_len, "deterministic" as *u8) != 0 { t16 = 0 }
627 // liar-kill: the fabrication strings must still be detectable where they legitimately live
628 let f16_off: i64 = K_REGION * 9
629 var f16: i64 = he_puts(buf, f16_off, "<b>1,284</b> contact submissions accepted by a design grammar" as *u8)
630 if cntat(buf, f16_off, f16 - f16_off, "1,284" as *u8) != 1 { t16 = 0 }
631 if cntat(buf, f16_off, f16 - f16_off, "contact submissions accepted" as *u8) != 1 { t16 = 0 }
632 if cntat(buf, f16_off, f16 - f16_off, "design grammar" as *u8) != 1 { t16 = 0 }
633 gp("T16 metrics-are-claims: req values land verbatim, fabricated defaults appear NOWHERE, docs/about defaults carry no process-talk, liar-kill fired -> " as *u8); gn(t16); gp("\n" as *u8)
634 if t16 == 0 { fails = fails + 1 }
635
636 // ---- write site A samples for eyes + the independent judge ----
637 i = 0
638 while i < nA {
639 let fd: i64 = sys_openat_wr(sname(planA[i]), 420)
640 if fd >= 0 { sys_write(fd, (((buf as i64) + offs[i]) as *u8), lens[i]); sys_close(fd) }
641 i = i + 1
642 }
643 gp("-- sample site A (4 pages) -> web_assets/uigen_site_a_*.html\n" as *u8)
644
645 // ---- EVIDENCE TRAIL (the beat must be auditable): ONE O_APPEND verdict-anchored line per run.
646 // Without this a clock-fired run prints to a stdout nobody reads, so "the daily beat is armed"
647 // would be unfalsifiable -- you could never prove it fired, or that it passed. Conflict-free
648 // append, same pattern as the sentinel log. ----
649 let lg: *u8 = sys_mmap(512)
650 var lo: i64 = he_puts(lg, 0, "ts=" as *u8)
651 lo = he_putn(lg, lo, sys_now_realtime_sec())
652 lo = he_puts(lg, lo, " organ=nx_uigen_site_gate teeth=" as *u8)
653 lo = he_putn(lg, lo, GATE_TEETH)
654 lo = he_puts(lg, lo, " fails=" as *u8)
655 lo = he_putn(lg, lo, fails)
656 lo = he_puts(lg, lo, " families=4 verdict=" as *u8)
657 if fails == 0 { lo = he_puts(lg, lo, "GREEN" as *u8) } else { lo = he_puts(lg, lo, "RED" as *u8) }
658 lo = he_puts(lg, lo, "\n" as *u8)
659 let lfd: i64 = sys_openat_append("knowledge/status/uigen_gate.log" as *u8, 420)
660 if lfd >= 0 { sys_write(lfd, lg, lo); sys_close(lfd) }
661
662 if fails == 0 {
663 gp("=== UIGEN-SITE verdict=GREEN: one brief -> a linked multi-page site; plan matches intent, every\n" as *u8)
664 gp("link resolves, design coheres site-wide, metadata derives from the same plan. Deterministic.\n" as *u8)
665 sys_exit(0)
666 return 0
667 }
668 gp("=== UIGEN-SITE verdict=RED fails=" as *u8); gn(fails); gp("\n" as *u8)
669 sys_exit(1)
670 return 1
671}