code wiki / _hdl_build / nx_meet_about_gate.nx
nx_meet_about_gate.nx source
↩ module page · 82 lines · 5448 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"
7
8func gp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
9func gslen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
10func gfind(hay: *u8, hl: i64, needle: *u8) -> i64 {
11 let nl: i64 = gslen(needle); if nl == 0 { return 0-1 }
12 var i: i64 = 0
13 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 }
14 return 0-1
15}
16func ghas(hay: *u8, hl: i64, needle: *u8) -> i64 { if gfind(hay, hl, needle) >= 0 { return 1 } return 0 }
17func gwrite(path: *u8, s: *u8) -> i64 {
18 let fd: i64 = sys_openat_wr(path, 0x1a4)
19 if fd < 0 { return 0 - 1 }
20 var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 }
21 sys_write(fd, s, n); sys_close(fd); return n
22}
23func spawn(path: *u8, a0: *u8, a1: *u8, redir: *u8) -> i64 {
24 let pid: i64 = sys_fork()
25 if pid == 0 {
26 let fd: i64 = sys_openat_wr(redir, 420)
27 if fd >= 0 { sys_dup3(fd, 1, 0); sys_dup3(fd, 2, 0) }
28 let argv: *i64 = sys_mmap(64) as *i64
29 var n: i64 = 0
30 argv[0] = path as i64; n = 1
31 if (a0 as i64) != 0 { argv[n] = a0 as i64; n = n + 1 }
32 if (a1 as i64) != 0 { argv[n] = a1 as i64; n = n + 1 }
33 argv[n] = 0
34 let envp: *i64 = sys_mmap(16) as *i64
35 envp[0] = "PATH=/usr/bin:/bin\x00" as *u8 as i64; envp[1] = 0
36 sys_execve(path, argv, envp)
37 sys_exit(127)
38 }
39 let st: *i64 = sys_mmap(16) as *i64
40 sys_wait4(pid, st, 0)
41 return (st[0] >> 8) & 0xff
42}
43
44func main() -> i64 {
45 gp("=== nx_meet_about_gate: R5 about/proof -- sovereign + mission + verify-preview + testimonials ===\n" as *u8)
46 let RUNNER: *u8 = "_offc/nx_sov_build_run.elf\x00" as *u8
47 let EMIT: *u8 = "/tmp/nx_meet_about.sov.elf\x00" as *u8
48 let SCRATCH: *u8 = "knowledge/status/meet_about_gate_scratch.log\x00" as *u8
49
50 spawn(RUNNER, "nx_meet_about\x00" as *u8, 0 as *u8, SCRATCH)
51 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)
52 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)
53 spawn(EMIT, "gateabout\x00" as *u8, 0 as *u8, SCRATCH)
54
55 let lp: *i64 = sys_mmap(16) as *i64; lp[0] = 0
56 let h: *u8 = sys_read_file("web_assets/site_gateabout/about.html\x00" as *u8, lp)
57 if (h as i64) == 0 { gp("MEET-ABOUT-GATE verdict=RED reason=output-missing\n" as *u8); sys_exit(1); return 1 }
58 let n: i64 = lp[0]
59 gp(" about bytes=" as *u8); gn(n); gp("\n" as *u8)
60
61 var pass: i64 = 0; var fail: i64 = 0
62 if gfind(h, n, "<script" as *u8) < 0 { pass=pass+1 } else { fail=fail+1; gp(" FAIL has-script\n" as *u8) }
63 if gfind(h, n, "onclick" as *u8) < 0 { pass=pass+1 } else { fail=fail+1; gp(" FAIL has-onclick\n" as *u8) }
64 if ghas(h, n, ":root{" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-tokens\n" as *u8) }
65 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) }
66 if ghas(h, n, "width=device-width" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL not-responsive\n" as *u8) }
67 if ghas(h, n, "class=\"nav\"" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-nav\n" as *u8) }
68 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) }
69 if ghas(h, n, "Our mission" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-mission\n" as *u8) }
70 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) }
71 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) }
72 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) }
73 // ESCAPING TEETH
74 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) }
75 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) }
76 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) }
77 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) }
78
79 gp("MEET-ABOUT-GATE pass=" as *u8); gn(pass); gp(" fail=" as *u8); gn(fail)
80 if fail == 0 { gp(" verdict=GREEN (sovereign 0-JS about/proof; mission + verify-preview + escaped testimonials)\n" as *u8); sys_exit(0); return 0 }
81 gp(" verdict=RED\n" as *u8); sys_exit(1); return 1
82}