code wiki / _hdl_build / nx_meet_about_gate.nx
nx_meet_about_gate.nx source
↩ module page · 90 lines · 5837 B
1import "nx_gate_gn.nx"
2// nx_meet_about_gate.nx -- liar-kill gate for R5 (about/proof page). Sovereign fork/exec: build the about
3// emitter, write a brand .meet + a testimonials .about fixture (incl. an '&' to test escaping), emit, assert:
4// sovereignty floor, token-driven+responsive, the mission + "how we keep it real" verification preview render,
5// testimonials render from data, and the ESCAPING TEETH (R&D Co -> R&D Co present, raw absent). expect_exit: 0
6import "nx_syscalls.nx"
7import "nx_gate_verdict.nx"
8
9func gp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
10func gslen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
11func gfind(hay: *u8, hl: i64, needle: *u8) -> i64 {
12 let nl: i64 = gslen(needle); if nl == 0 { return 0-1 }
13 var i: i64 = 0
14 while i + nl <= hl { var k: i64=0; var hit: i64=1; while k<nl { if hay[i+k]!=needle[k]{hit=0;k=nl}else{k=k+1} } if hit==1 {return i} i=i+1 }
15 return 0-1
16}
17func ghas(hay: *u8, hl: i64, needle: *u8) -> i64 { if gfind(hay, hl, needle) >= 0 { return 1 } return 0 }
18func gwrite(path: *u8, s: *u8) -> i64 {
19 let fd: i64 = sys_openat_wr(path, 0x1a4)
20 if fd < 0 { return 0 - 1 }
21 var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 }
22 sys_write(fd, s, n); sys_close(fd); return n
23}
24func spawn(path: *u8, a0: *u8, a1: *u8, redir: *u8) -> i64 {
25 let pid: i64 = sys_fork()
26 if pid == 0 {
27 let fd: i64 = sys_openat_wr(redir, 420)
28 if fd >= 0 { sys_dup3(fd, 1, 0); sys_dup3(fd, 2, 0) }
29 let argv: *i64 = sys_mmap(64) as *i64
30 var n: i64 = 0
31 argv[0] = path as i64; n = 1
32 if (a0 as i64) != 0 { argv[n] = a0 as i64; n = n + 1 }
33 if (a1 as i64) != 0 { argv[n] = a1 as i64; n = n + 1 }
34 argv[n] = 0
35 let envp: *i64 = sys_mmap(16) as *i64
36 envp[0] = "PATH=/usr/bin:/bin\x00" as *u8 as i64; envp[1] = 0
37 sys_execve(path, argv, envp)
38 sys_exit(127)
39 }
40 let st: *i64 = sys_mmap(16) as *i64
41 sys_wait4(pid, st, 0)
42 return (st[0] >> 8) & 0xff
43}
44
45func main() -> i64 {
46 gp("=== nx_meet_about_gate: R5 about/proof -- sovereign + mission + verify-preview + testimonials ===\n" as *u8)
47 let RUNNER: *u8 = "_offc/nx_sov_build_run.elf\x00" as *u8
48 let EMIT: *u8 = "/tmp/nx_meet_about.sov.elf\x00" as *u8
49 let SCRATCH: *u8 = "knowledge/status/meet_about_gate_scratch.log\x00" as *u8
50
51 spawn(RUNNER, "nx_meet_about\x00" as *u8, 0 as *u8, SCRATCH)
52 gwrite("web_assets/meet_gateabout.meet\x00" as *u8, "meet|brand|Community Meet -- McKinney & DFW\nmeet|region|McKinney & the Dallas metro\nmeet|zip|75071\nmeet|cta_href|/apply\n" as *u8)
53 gwrite("web_assets/meet_gateabout.about\x00" as *u8, "quote|We met real talent at R&D Co -- no fakes, no ghosts.|Dana K., founder\nquote|Curated and local. Worth it.|Sam P.\n" as *u8)
54 spawn(EMIT, "gateabout\x00" as *u8, 0 as *u8, SCRATCH)
55
56 let lp: *i64 = sys_mmap(16) as *i64; lp[0] = 0
57 let h: *u8 = sys_read_file("web_assets/site_gateabout/about.html\x00" as *u8, lp)
58 if (h as i64) == 0 { gp("MEET-ABOUT-GATE verdict=RED reason=output-missing\n" as *u8); sys_exit(1); return 1 }
59 let n: i64 = lp[0]
60 gp(" about bytes=" as *u8); gn(n); gp("\n" as *u8)
61
62 var pass: i64 = 0; var fail: i64 = 0
63 if gfind(h, n, "<script" as *u8) < 0 { pass=pass+1 } else { fail=fail+1; gp(" FAIL has-script\n" as *u8) }
64 if gfind(h, n, "onclick" as *u8) < 0 { pass=pass+1 } else { fail=fail+1; gp(" FAIL has-onclick\n" as *u8) }
65 if ghas(h, n, ":root{" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-tokens\n" as *u8) }
66 if ghas(h, n, "var(--nx-color-primary)" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL not-token-driven\n" as *u8) }
67 if ghas(h, n, "width=device-width" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL not-responsive\n" as *u8) }
68 if ghas(h, n, "class=\"nav\"" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-nav\n" as *u8) }
69 if ghas(h, n, "Community Meet -- McKinney & DFW" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-brand-escaped\n" as *u8) }
70 if ghas(h, n, "Our mission" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-mission\n" as *u8) }
71 if ghas(h, n, "How we keep it real" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-verify-section\n" as *u8) }
72 if ghas(h, n, "We screen for fakes" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-screen-card\n" as *u8) }
73 if ghas(h, n, "Dana K., founder" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-testimonial-author\n" as *u8) }
74 // ESCAPING TEETH
75 if ghas(h, n, "R&D Co" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL testimonial-not-escaped\n" as *u8) }
76 if gfind(h, n, "R&D Co" as *u8) < 0 { pass=pass+1 } else { fail=fail+1; gp(" FAIL raw-amp-leaked\n" as *u8) }
77 if ghas(h, n, "Ready to meet real people" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-cta-band\n" as *u8) }
78 if ghas(h, n, "a Nishi sovereign community" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-footer\n" as *u8) }
79
80 gp("MEET-ABOUT-GATE pass=" as *u8); gn(pass); gp(" fail=" as *u8); gn(fail)
81 // MIGRATED onto nx_gate_verdict by nx_gate_dry_apply (D001, minimal form): every check
82 // row above is untouched, so the PASS/FAIL vector cannot change; only the hand-rolled
83 // verdict emission is replaced by the ONE shared base class. Proven by nx_gate_migrate verify.
84 let ctr__dry: *i64 = gv_ctr()
85 ctr__dry[0] = pass
86 ctr__dry[1] = pass + fail
87 let rc__dry: i64 = gv_verdict("MEET-ABOUT-GATE" as *u8, ctr__dry, "sovereign 0-JS about/proof; mission + verify-preview + escaped testimonials)" as *u8)
88 sys_exit(rc__dry)
89 return rc__dry
90}