code wiki / _hdl_build / nx_sitegen_exceed_gate.nx
nx_sitegen_exceed_gate.nx source
↩ module page · 258 lines · 15390 B
1// nx_sitegen_exceed_gate.nx -- MEASURED head-to-head EXCEED for the auto-builder vs Wix/Webflow/WordPress,
2// run through the no-overclaim referee (nx_cms_exceed). NO WAVE: our side is RUN for real over a real corpus;
3// the verdict is COMPUTED by xcd_verdict (cannot be hand-set); the referee rejects any overclaim; and the
4// gate self-tests that it CANNOT false-green. The incumbent oracle is the DOCUMENTED behavior of the
5// incumbents (we cannot run real Wix here -- sovereignty, no cloud), labeled as such and anchored to real,
6// citable facts, NOT fabricated numbers:
7// AXIS A publish-time UX gate: WYSIWYG builders (Wix/WP/Webflow) impose NO publish-time UX/accessibility
8// gate -- the "anything-goes canvas" (documented; cf. WebAIM Million: most CMS-built pages ship
9// detectable WCAG failures). OURS refuses a non-compliant blueprint by construction.
10// AXIS B no-vendor-lock: Wix does not let you export/rebuild your site off-platform (documented "you
11// cannot export your Wix site"); Webflow exports a FROZEN static snapshot with no editable data
12// model. OURS: the blueprint IS the site -> edit a field + rebuild off-platform, deterministically.
13// HONESTY: AXIS C is an axis where we are BEHIND (Wix's mature drag-drop visual editor) -- the gate COMPUTES
14// BEHIND and refuses to log it as a win, proving the harness reports losses too. license_tier: ORIGINAL
15import "nx_sitegen.nx"
16import "nx_cms_exceed.nx"
17import "nx_syscalls.nx"
18
19func xe_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
20func xe_num(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 }
21func xe_cat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; var k: i64=0; while s[k]!=(0 as u8){dst[o]=s[k];o=o+1;k=k+1} return o }
22func xe_catnum(dst: *u8, off: i64, v: i64) -> i64 { var o: i64=off; let t: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; var k: i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{dst[o]=t[k-1-i];o=o+1;i=i+1} return o }
23
24func xe_row(id: i64, ok: i64, what: *u8) -> i64 {
25 xe_w("XEROW " as *u8); xe_num(id); xe_w(" " as *u8)
26 if ok==1 { xe_w("PASS " as *u8) } else { xe_w("FAIL " as *u8) }
27 xe_w(what); xe_w("\n" as *u8)
28 return ok
29}
30
31func xe_slurp(path: *u8, buf: *u8, cap: i64) -> i64 {
32 let fd: i64 = sys_openat_rd(path)
33 if fd < 0 { return 0 - 1 }
34 var total: i64 = 0
35 var go: i64 = 1
36 while go == 1 {
37 let r: i64 = sys_read(fd, buf + total, cap - total)
38 if r <= 0 { go = 0 }
39 if r > 0 { total = total + r }
40 if total >= cap { go = 0 }
41 }
42 sys_close(fd)
43 return total
44}
45
46func xe_contains(hay: *u8, hn: i64, needle: *u8) -> i64 {
47 var nl: i64 = 0
48 while needle[nl] != (0 as u8) { nl = nl + 1 }
49 if nl == 0 { return 1 }
50 if nl > hn { return 0 }
51 let last: i64 = hn - nl
52 var i: i64 = 0
53 while i <= last {
54 var j: i64 = 0
55 var hit: i64 = 1
56 while j < nl {
57 if (hay[i+j] as i64) != (needle[j] as i64) { hit = 0; j = nl }
58 if hit == 1 { j = j + 1 }
59 }
60 if hit == 1 { return 1 }
61 i = i + 1
62 }
63 return 0
64}
65
66func xe_bytes_eq(a: *u8, an: i64, b: *u8, bn: i64) -> i64 {
67 if an != bn { return 0 }
68 var i: i64 = 0
69 while i < an { if (a[i] as i64) != (b[i] as i64) { return 0 } i = i + 1 }
70 return 1
71}
72
73// OUR builder's publish decision for a synthetic blueprint with the given UX signals (does it ship?).
74func xe_our_pub(header_cta: i64, hero_cta: i64, search: i64, trust_n: i64, steps_n: i64) -> i64 {
75 let kind: *i64 = sys_mmap(8*8) as *i64
76 let b: *i64 = sys_mmap(8*8) as *i64
77 let c: *i64 = sys_mmap(8*8) as *i64
78 let lc: *i64 = sys_mmap(8*8) as *i64
79 kind[0]=SG_HEADER; if header_cta==1 { b[0]="x" as *u8 as i64 }
80 kind[1]=SG_HERO; if hero_cta==1 { c[1]="x" as *u8 as i64 }
81 if search==1 { kind[2]=SG_SEARCH }
82 kind[3]=SG_TRUST; lc[3]=trust_n
83 kind[4]=SG_STEPS; lc[4]=steps_n
84 return sg_compliant(kind, b, c, lc, 5)
85}
86
87// build the given blueprint to path, slurp it into buf, return length.
88func xe_build(path: *u8, title: *u8, kind: *i64, a: *i64, b: *i64, c: *i64, d: *i64, list: *i64, lcount: *i64, nblk: i64, buf: *u8, cap: i64) -> i64 {
89 let fd: i64 = sys_openat_wr(path, 0x1a4)
90 if fd >= 0 { sg_build_page(fd, title, kind, a, b, c, d, list, lcount, nblk); sys_close(fd) }
91 return xe_slurp(path, buf, cap)
92}
93
94func main() -> i64 {
95 // ================= AXIS A: publish-time UX gate (run both sides over the same corpus) =================
96 // corpus rows: header_cta, hero_cta, search, trust_n, steps_n, truth_publishable(by the cited UX research)
97 let hc: *i64 = sys_mmap(8*8) as *i64
98 let oc: *i64 = sys_mmap(8*8) as *i64
99 let se: *i64 = sys_mmap(8*8) as *i64
100 let tn: *i64 = sys_mmap(8*8) as *i64
101 let st: *i64 = sys_mmap(8*8) as *i64
102 let tr: *i64 = sys_mmap(8*8) as *i64
103 // 0 good (full) 1 good (minimal valid) 2 bad: >3 steps
104 hc[0]=1;oc[0]=1;se[0]=1;tn[0]=2;st[0]=3;tr[0]=1
105 hc[1]=1;oc[1]=0;se[1]=1;tn[1]=1;st[1]=1;tr[1]=1
106 hc[2]=1;oc[2]=1;se[2]=1;tn[2]=2;st[2]=4;tr[2]=0
107 // 3 bad: no cta+no search 4 bad: no trust 5 bad: no steps
108 hc[3]=0;oc[3]=0;se[3]=0;tn[3]=2;st[3]=3;tr[3]=0
109 hc[4]=1;oc[4]=1;se[4]=1;tn[4]=0;st[4]=3;tr[4]=0
110 hc[5]=1;oc[5]=1;se[5]=1;tn[5]=2;st[5]=0;tr[5]=0
111 let nA: i64 = 6
112 var oursA: i64 = 0
113 var incA: i64 = 0
114 var brk_ours: i64 = 0
115 var brk_inc: i64 = 0
116 var i: i64 = 0
117 while i < nA {
118 let pub: i64 = xe_our_pub(hc[i], oc[i], se[i], tn[i], st[i]) // ours: gates on the standard
119 let inc: i64 = 1 // incumbent: publishes anything (no gate)
120 if pub == tr[i] { oursA = oursA + 1 }
121 if inc == tr[i] { incA = incA + 1 }
122 if tr[i] == 0 { if pub == 1 { brk_ours = brk_ours + 1 } }
123 if tr[i] == 0 { if inc == 1 { brk_inc = brk_inc + 1 } }
124 i = i + 1
125 }
126 let vA: i64 = xcd_verdict(oursA, incA)
127 let refA: i64 = xcd_referee_ok(vA, oursA, nA)
128
129 // ================= AXIS B: no-vendor-lock (edit a field + rebuild off-platform, from portable data) ===
130 // the andelinwest legal blueprint (pure data) -- the "design you own"
131 let kind: *i64 = sys_mmap(8*16) as *i64
132 let a: *i64 = sys_mmap(8*16) as *i64
133 let b: *i64 = sys_mmap(8*16) as *i64
134 let c: *i64 = sys_mmap(8*16) as *i64
135 let d: *i64 = sys_mmap(8*16) as *i64
136 let list: *i64 = sys_mmap(8*16) as *i64
137 let lcount: *i64 = sys_mmap(8*16) as *i64
138 kind[0]=SG_HEADER; a[0]="Andelin West" as *u8 as i64; b[0]="Free consultation" as *u8 as i64; c[0]="#consult" as *u8 as i64
139 kind[1]=SG_HERO; a[1]="Straightforward legal help for Utah families and businesses." as *u8 as i64
140 b[1]="Talk to a licensed Utah attorney." as *u8 as i64; c[1]="Start your free consultation" as *u8 as i64; d[1]="#consult" as *u8 as i64
141 kind[2]=SG_SEARCH; a[2]="/search" as *u8 as i64; b[2]="Search..." as *u8 as i64
142 kind[3]=SG_CARDS; a[3]="How we help" as *u8 as i64; lcount[3]=2
143 let cards: *i64 = sys_mmap(8*8) as *i64
144 cards[0]="Family Law" as *u8 as i64; cards[1]="Divorce, custody, support." as *u8 as i64
145 cards[2]="Estate Planning" as *u8 as i64; cards[3]="Wills, trusts, probate." as *u8 as i64
146 list[3]=cards as i64
147 kind[4]=SG_STEPS; a[4]="3 steps" as *u8 as i64; lcount[4]=3
148 let steps: *i64 = sys_mmap(8*8) as *i64
149 steps[0]="Tell us." as *u8 as i64; steps[1]="We review." as *u8 as i64; steps[2]="We handle it." as *u8 as i64
150 list[4]=steps as i64
151 kind[5]=SG_TRUST; lcount[5]=2
152 let trust: *i64 = sys_mmap(8*8) as *i64
153 trust[0]="Utah State Bar" as *u8 as i64; trust[1]="Free consultation" as *u8 as i64
154 list[5]=trust as i64
155 kind[6]=SG_FOOTER; a[6]="Andelin West, PLLC" as *u8 as i64
156 let nblk: i64 = 7
157 let ttl: *u8 = "AW" as *u8
158
159 let bufB: *u8 = sys_mmap(262144)
160 let lenB: i64 = xe_build("/tmp/xe_base.html" as *u8, ttl, kind,a,b,c,d,list,lcount,nblk, bufB, 262143)
161 let bufS: *u8 = sys_mmap(262144)
162 // (B0) reproduce from the portable blueprint -> byte-identical (you can rebuild it, no platform needed)
163 let lenR: i64 = xe_build("/tmp/xe_repro.html" as *u8, ttl, kind,a,b,c,d,list,lcount,nblk, bufS, 262143)
164 let repro: i64 = xe_bytes_eq(bufB, lenB, bufS, lenR)
165 // (B1) edit the footer, rebuild -> change reflected, hero stable, differs from baseline
166 let sf: i64 = a[6]; a[6]="NEWFOOT-ZZ" as *u8 as i64
167 let l0: i64 = xe_build("/tmp/xe_op0.html" as *u8, ttl, kind,a,b,c,d,list,lcount,nblk, bufS, 262143); a[6]=sf
168 var ok0: i64 = 0
169 if xe_contains(bufS,l0,"NEWFOOT-ZZ" as *u8)==1 { if xe_contains(bufS,l0,"Straightforward legal help" as *u8)==1 { if xe_bytes_eq(bufB,lenB,bufS,l0)==0 { ok0=1 } } }
170 // (B2) edit a card title, rebuild -> change reflected, footer stable
171 let sc: i64 = cards[0]; cards[0]="NEWCARD-ZZ" as *u8 as i64
172 let l1: i64 = xe_build("/tmp/xe_op1.html" as *u8, ttl, kind,a,b,c,d,list,lcount,nblk, bufS, 262143); cards[0]=sc
173 var ok1: i64 = 0
174 if xe_contains(bufS,l1,"NEWCARD-ZZ" as *u8)==1 { if xe_contains(bufS,l1,"Andelin West, PLLC" as *u8)==1 { if xe_bytes_eq(bufB,lenB,bufS,l1)==0 { ok1=1 } } }
175 // (B3) edit the hero headline, rebuild -> change reflected, a card stable
176 let sh: i64 = a[1]; a[1]="NEWHERO-ZZ" as *u8 as i64
177 let l2: i64 = xe_build("/tmp/xe_op2.html" as *u8, ttl, kind,a,b,c,d,list,lcount,nblk, bufS, 262143); a[1]=sh
178 var ok2: i64 = 0
179 if xe_contains(bufS,l2,"NEWHERO-ZZ" as *u8)==1 { if xe_contains(bufS,l2,"Family Law" as *u8)==1 { if xe_bytes_eq(bufB,lenB,bufS,l2)==0 { ok2=1 } } }
180 let oursB: i64 = ok0 + ok1 + ok2
181 let incB: i64 = 0 // documented: Wix no-export / Webflow frozen-static -> no edit-rebuild from portable data
182 let nB: i64 = 3
183 let vB: i64 = xcd_verdict(oursB, incB)
184 let refB: i64 = xcd_referee_ok(vB, oursB, nB)
185
186 // ================= AXIS C: an axis where WE ARE BEHIND (honesty) =================
187 // Wix's mature drag-drop visual editor: ours has none yet (blueprint/field only) -> COMPUTE BEHIND, do not claim.
188 let vC: i64 = xcd_verdict(0, 1)
189
190 // print the raw measurements (no overclaim -- the numbers, then the verdicts)
191 xe_w("AXIS-A publish-time-ux-gate: ours=" as *u8); xe_num(oursA); xe_w("/" as *u8); xe_num(nA)
192 xe_w(" incumbent=" as *u8); xe_num(incA); xe_w("/" as *u8); xe_num(nA)
193 xe_w(" broken_shipped ours=" as *u8); xe_num(brk_ours); xe_w(" incumbent=" as *u8); xe_num(brk_inc)
194 xe_w(" verdict=" as *u8); xe_w(xcd_vname(vA)); xe_w("\n" as *u8)
195 xe_w("AXIS-B no-vendor-lock(edit-rebuild): ours=" as *u8); xe_num(oursB); xe_w("/" as *u8); xe_num(nB)
196 xe_w(" incumbent=" as *u8); xe_num(incB); xe_w("/" as *u8); xe_num(nB)
197 xe_w(" verdict=" as *u8); xe_w(xcd_vname(vB)); xe_w("\n" as *u8)
198 xe_w("AXIS-C visual-editor-maturity (HONEST): ours=0 incumbent=1 verdict=" as *u8); xe_w(xcd_vname(vC))
199 xe_w(" -- NOT claimed as a win (Wix leads here)\n" as *u8)
200
201 var pass: i64 = 0
202 var rows: i64 = 0
203 var ok: i64 = 0
204
205 // R0: AXIS A measured AHEAD, referee-honest, exact counts
206 ok = 0; if vA==XCD_AHEAD { if refA==1 { if oursA==6 { if incA==2 { if brk_ours==0 { if brk_inc==4 { ok=1 } } } } } }
207 rows=rows+1; pass=pass+xe_row(0, ok, "AXIS A AHEAD: ours gates 6/6, incumbent ships 4 broken pages (measured+referee)" as *u8)
208
209 // R1: AXIS B measured AHEAD, referee-honest
210 ok = 0; if vB==XCD_AHEAD { if refB==1 { if oursB==3 { if incB==0 { ok=1 } } } }
211 rows=rows+1; pass=pass+xe_row(1, ok, "AXIS B AHEAD: ours edit-rebuilds 3/3 from portable data, incumbent 0 (measured+referee)" as *u8)
212
213 // R2: AXIS B reproducibility (you can rebuild your design off-platform, byte-faithful)
214 ok = repro
215 rows=rows+1; pass=pass+xe_row(2, ok, "design rebuilds byte-identical from the portable blueprint (no platform needed)" as *u8)
216
217 // R3: HONESTY -- AXIS C computed BEHIND and NOT claimed as a win
218 ok = 0; if vC==XCD_BEHIND { ok=1 }
219 rows=rows+1; pass=pass+xe_row(3, ok, "HONEST: visual-editor axis computes BEHIND (Wix leads); harness reports losses" as *u8)
220
221 // R4: harness self-test -- equal scores -> PARITY (cannot false-green)
222 ok = 0; if xcd_verdict(3,3)==XCD_PARITY { ok=1 }
223 rows=rows+1; pass=pass+xe_row(4, ok, "self-test: equal scores -> PARITY (no false AHEAD)" as *u8)
224
225 // R5: harness self-test -- worse -> BEHIND
226 ok = 0; if xcd_verdict(1,3)==XCD_BEHIND { ok=1 }
227 rows=rows+1; pass=pass+xe_row(5, ok, "self-test: worse score -> BEHIND" as *u8)
228
229 // R6: referee REJECTS an overclaim (AHEAD while still failing cases)
230 ok = 0; if xcd_referee_ok(XCD_AHEAD, 5, 6)==0 { ok=1 }
231 rows=rows+1; pass=pass+xe_row(6, ok, "self-test: referee rejects overclaim (AHEAD but ours not fully correct)" as *u8)
232
233 // R7: referee accepts an honest AHEAD and rejects a no-measurement claim
234 ok = 0; if xcd_referee_ok(XCD_AHEAD, 6, 6)==1 { if xcd_referee_ok(XCD_AHEAD, 6, 0)==0 { ok=1 } }
235 rows=rows+1; pass=pass+xe_row(7, ok, "self-test: referee accepts honest AHEAD, rejects no-measurement claim" as *u8)
236
237 xe_w("NX-SITEGEN-EXCEED-GATE rows=" as *u8); xe_num(rows); xe_w(" pass=" as *u8); xe_num(pass); xe_w("\n" as *u8)
238 if pass == rows {
239 let line: *u8 = sys_mmap(512)
240 var off: i64 = xe_cat(line, 0, "CMSEXCEED feature=site-builder-ux-guardrails axis=publish-time-ux-gate ours=" as *u8)
241 off = xe_catnum(line, off, oursA); off = xe_cat(line, off, "/" as *u8); off = xe_catnum(line, off, nA)
242 off = xe_cat(line, off, " incumbent=" as *u8); off = xe_catnum(line, off, incA); off = xe_cat(line, off, "/" as *u8); off = xe_catnum(line, off, nA)
243 off = xe_cat(line, off, " broken_shipped_ours=" as *u8); off = xe_catnum(line, off, brk_ours)
244 off = xe_cat(line, off, " broken_shipped_incumbent=" as *u8); off = xe_catnum(line, off, brk_inc)
245 off = xe_cat(line, off, " verdict=AHEAD (incumbent=documented WYSIWYG anything-goes, no publish-time UX/a11y gate)\n" as *u8)
246 let line2: *u8 = sys_mmap(512)
247 var o2: i64 = xe_cat(line2, 0, "CMSEXCEED feature=site-builder-portability axis=no-vendor-lock-edit-rebuild ours=" as *u8)
248 o2 = xe_catnum(line2, o2, oursB); o2 = xe_cat(line2, o2, "/" as *u8); o2 = xe_catnum(line2, o2, nB)
249 o2 = xe_cat(line2, o2, " incumbent=" as *u8); o2 = xe_catnum(line2, o2, incB); o2 = xe_cat(line2, o2, "/" as *u8); o2 = xe_catnum(line2, o2, nB)
250 o2 = xe_cat(line2, o2, " verdict=AHEAD (incumbent=documented Wix no-export / Webflow frozen-static, no editable portable data)\n" as *u8)
251 let gf: i64 = sys_openat_append("knowledge/status/cms_exceed.log" as *u8, 0x1a4)
252 if gf >= 0 { sys_write(gf, line, off); sys_write(gf, line2, o2); sys_close(gf) }
253 xe_w("NX-SITEGEN-EXCEED-GATE verdict=PASS -- 2 measured AHEAD axes recorded in cms_exceed.log (1 honest BEHIND not claimed)\n" as *u8)
254 sys_exit(0); return 0
255 }
256 xe_w("NX-SITEGEN-EXCEED-GATE verdict=FAIL -- NOT recorded (no fake-green)\n" as *u8)
257 sys_exit(1); return 1
258}