code wiki / _hdl_build / nx_pub_todos_gate.nx
nx_pub_todos_gate.nx source
↩ module page · 88 lines · 5696 B
1import "nx_gate_gn.nx"
2// nx_pub_todos_gate.nx -- liar-kill gate for the publisher PIPELINE / TO-DO board. Sovereign fork/exec: run the
3// board organ, then assert the emitted nishifamily.com page is sovereign + lists the domain-less staged sites
4// with their blockers (the meet platform shows "domain" + "approval"), shows the DERIVED staged/held count, and
5// explains how a site goes live -- AND that the board itself is STAGED HELD (outward) for nishifamily.com. 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 spawn(path: *u8, a0: *u8, a1: *u8, redir: *u8) -> i64 {
19 let pid: i64 = sys_fork()
20 if pid == 0 {
21 let fd: i64 = sys_openat_wr(redir, 420)
22 if fd >= 0 { sys_dup3(fd, 1, 0); sys_dup3(fd, 2, 0) }
23 let argv: *i64 = sys_mmap(64) as *i64
24 var n: i64 = 0
25 argv[0] = path as i64; n = 1
26 if (a0 as i64) != 0 { argv[n] = a0 as i64; n = n + 1 }
27 if (a1 as i64) != 0 { argv[n] = a1 as i64; n = n + 1 }
28 argv[n] = 0
29 let envp: *i64 = sys_mmap(16) as *i64
30 envp[0] = "PATH=/usr/bin:/bin\x00" as *u8 as i64; envp[1] = 0
31 sys_execve(path, argv, envp)
32 sys_exit(127)
33 }
34 let st: *i64 = sys_mmap(16) as *i64
35 sys_wait4(pid, st, 0)
36 return (st[0] >> 8) & 0xff
37}
38
39func main() -> i64 {
40 gp("=== nx_pub_todos_gate: publisher pipeline/to-do board for nishifamily.com ===\n" as *u8)
41 let RUNNER: *u8 = "_offc/nx_sov_build_run.elf\x00" as *u8
42 let SCR: *u8 = "knowledge/status/pub_todos_gate_scratch.log\x00" as *u8
43 spawn(RUNNER, "nx_pub_todos\x00" as *u8, 0 as *u8, SCR)
44
45 let lp: *i64 = sys_mmap(16) as *i64; lp[0] = 0
46 let h: *u8 = sys_read_file("web_assets/site_nishifamily/pipeline.html\x00" as *u8, lp)
47 if (h as i64) == 0 { gp("PUB-TODOS-GATE verdict=RED reason=page-missing\n" as *u8); sys_exit(1); return 1 }
48 let n: i64 = lp[0]
49 let lp2: *i64 = sys_mmap(16) as *i64; lp2[0] = 0
50 let q: *u8 = sys_read_file("knowledge/publish/site_todos_queue.tsv\x00" as *u8, lp2)
51 if (q as i64) == 0 { gp("PUB-TODOS-GATE verdict=RED reason=queue-missing\n" as *u8); sys_exit(1); return 1 }
52 let qn: i64 = lp2[0]
53 gp(" page bytes=" as *u8); gn(n); gp("\n" as *u8)
54
55 var pass: i64 = 0; var fail: i64 = 0
56 // sovereign page
57 if gfind(h, n, "<script" as *u8) < 0 { pass=pass+1 } else { fail=fail+1; gp(" FAIL has-script\n" as *u8) }
58 if gfind(h, n, "onclick" as *u8) < 0 { pass=pass+1 } else { fail=fail+1; gp(" FAIL has-onclick\n" as *u8) }
59 if ghas(h, n, "Nishi Family" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-brand\n" as *u8) }
60 if ghas(h, n, "Publishing pipeline" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-hero\n" as *u8) }
61 // the domain-less staged site + its blockers
62 if ghas(h, n, "Community Meet" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-meet-site\n" as *u8) }
63 if ghas(h, n, "domain" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-domain-blocker\n" as *u8) }
64 if ghas(h, n, "approval" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-approval-blocker\n" as *u8) }
65 if ghas(h, n, "Needs:" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-todo-structure\n" as *u8) }
66 if ghas(h, n, "Next:" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-next-action\n" as *u8) }
67 // DERIVED live state + how-to-go-live
68 if ghas(h, n, "pages staged and HELD" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-derived-state\n" as *u8) }
69 if ghas(h, n, "How a site goes live" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-howto\n" as *u8) }
70 if ghas(h, n, "pub_approve" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-approve-mechanism\n" as *u8) }
71 if ghas(h, n, "andelinwest" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-second-site\n" as *u8) }
72 // the board is STAGED HELD for nishifamily.com
73 if ghas(q, qn, "PENDING" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL not-staged\n" as *u8) }
74 if ghas(q, qn, "nishifamily" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL not-for-nishifamily\n" as *u8) }
75 if ghas(q, qn, "pipeline.html" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL no-dest\n" as *u8) }
76 if ghas(q, qn, "outward" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL not-held\n" as *u8) }
77
78 gp("PUB-TODOS-GATE pass=" as *u8); gn(pass); gp(" fail=" as *u8); gn(fail)
79 // MIGRATED onto nx_gate_verdict by nx_gate_dry_apply (D001, minimal form): every check
80 // row above is untouched, so the PASS/FAIL vector cannot change; only the hand-rolled
81 // verdict emission is replaced by the ONE shared base class. Proven by nx_gate_migrate verify.
82 let ctr__dry: *i64 = gv_ctr()
83 ctr__dry[0] = pass
84 ctr__dry[1] = pass + fail
85 let rc__dry: i64 = gv_verdict("PUB-TODOS-GATE" as *u8, ctr__dry, "publisher exposes the pipeline/to-dos for nishifamily.com; domain-less sites tracked + staged-held)" as *u8)
86 sys_exit(rc__dry)
87 return rc__dry
88}