code wiki / _hdl_build / nx_pub_ship_meet_gate.nx

nx_pub_ship_meet_gate.nx source

↩ module page · 71 lines · 5477 B

1import "nx_gate_gn.nx" 2// nx_pub_ship_meet_gate.nx -- proves the FULL governed WET SHIP of the meet bundle end-to-end. ENGINEER ROOT-CAUSE 3// (tech debt resolved): pub_run_governed is sound; the earlier crash was running the wet drain against the POLLUTED 4// shared knowledge/publish/ dir -- a CLEAN per-workstream dir (rp_path) works (proven by nx_pub_drain_diag G=3). So: 5// fresh isolated stage/live/appr -> submit 3 meet pages (outward) + operator pub_approve each by sha -> drain 6// (verify-sha + atomic-promote) -> the pages land LIVE, sovereign; the UNAPPROVED page is HELD (fail-closed). This 7// is the definitive "the meet site ships wet, end-to-end" proof -- exactly what the daemon does on the host. expect_exit: 0 8import "nx_syscalls.nx" 9import "nx_publisher.nx" 10import "nx_runpath.nx" 11import "nx_gate_verdict.nx" 12 13func gp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 14func dmk(p: *u8) -> i64 { __syscall(83, p as i64, 493, 0, 0, 0, 0); return 0 } 15func djoin(d: *u8, name: *u8) -> *u8 { let p: *u8 = sys_mmap(700); pub_join(d, name, p); return p } 16func dunlink(path: *u8) -> i64 { __syscall(87, path as i64, 0, 0, 0, 0, 0); return 0 } 17func gexists(path: *u8) -> i64 { let lp: *i64 = sys_mmap(16) as *i64; lp[0]=0; let d: *u8 = sys_read_file(path, lp); if (d as i64)==0 { return 0 } return 1 } 18func ghas(path: *u8, needle: *u8) -> i64 { let lp: *i64 = sys_mmap(16) as *i64; lp[0]=0; let d: *u8 = sys_read_file(path, lp); if (d as i64)==0 { return 0 } return pub_substr(d, lp[0], needle) } 19 20func main() -> i64 { 21 gp("=== nx_pub_ship_meet_gate: FULL governed WET SHIP of the meet bundle (submit -> approve -> drain -> LIVE) ===\n" as *u8) 22 let wsid: *u8 = sys_mmap(64); rp_wsid(wsid); rp_ensure(wsid) 23 let D: *u8 = sys_mmap(512); rp_path(wsid, "meetship" as *u8, D); dmk(D) 24 let stage: *u8 = djoin(D, "stage" as *u8); dmk(stage) 25 let live: *u8 = djoin(D, "live" as *u8); dmk(live) 26 let appr: *u8 = djoin(D, "appr" as *u8); dmk(appr) 27 let q: *u8 = djoin(D, "q.tsv" as *u8); dunlink(q) 28 let led: *u8 = djoin(D, "led.tsv" as *u8); dunlink(led) 29 30 // submit 3 representative meet pages (outward) + operator pub_approve each by content sha 31 var approved: i64 = 0 32 let s1: *u8 = "web_assets/site_demo/index.html" as *u8; let h1: *u8 = sys_mmap(72) 33 if pub_sha_file(s1, h1) == 1 { pub_submit_to(q, s1, "meet/index.html" as *u8, "meet" as *u8, "meet-ship" as *u8, "outward" as *u8); if pub_approve(h1, appr)==1 { approved=approved+1 } } 34 let s2: *u8 = "web_assets/site_demo/jobs.html" as *u8; let h2: *u8 = sys_mmap(72) 35 if pub_sha_file(s2, h2) == 1 { pub_submit_to(q, s2, "meet/jobs.html" as *u8, "meet" as *u8, "meet-ship" as *u8, "outward" as *u8); if pub_approve(h2, appr)==1 { approved=approved+1 } } 36 let s3: *u8 = "web_assets/site_demo/apply.html" as *u8; let h3: *u8 = sys_mmap(72) 37 if pub_sha_file(s3, h3) == 1 { pub_submit_to(q, s3, "meet/apply.html" as *u8, "meet" as *u8, "meet-ship" as *u8, "outward" as *u8); if pub_approve(h3, appr)==1 { approved=approved+1 } } 38 // an UNAPPROVED page (distinct src -> distinct sha, never approved) -> must be HELD 39 pub_submit_to(q, "web_assets/meet_demo.meet" as *u8, "meet/unapproved.html" as *u8, "meet" as *u8, "meet-ship" as *u8, "outward" as *u8) 40 41 gp(" approved=" as *u8); gn(approved); gp("/3 ; draining (clean isolated dir)...\n" as *u8) 42 let published: i64 = pub_run_governed(q, led, stage, live, "meetship_lock" as *u8, appr) 43 gp(" published=" as *u8); gn(published); gp("\n" as *u8) 44 45 let idx: *u8 = djoin(live, "meet/index.html" as *u8) 46 let jobs: *u8 = djoin(live, "meet/jobs.html" as *u8) 47 let apply: *u8 = djoin(live, "meet/apply.html" as *u8) 48 let unap: *u8 = djoin(live, "meet/unapproved.html" as *u8) 49 50 var pass: i64 = 0; var fail: i64 = 0 51 if approved == 3 { pass=pass+1 } else { fail=fail+1; gp(" FAIL not-all-approved\n" as *u8) } 52 if published == 3 { pass=pass+1 } else { fail=fail+1; gp(" FAIL not-3-published\n" as *u8) } 53 if gexists(idx) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL index-not-live\n" as *u8) } 54 if ghas(idx, "Community Meet" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL live-no-brand\n" as *u8) } 55 if ghas(idx, "<script" as *u8) == 0 { pass=pass+1 } else { fail=fail+1; gp(" FAIL live-has-script\n" as *u8) } 56 if gexists(jobs) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL jobs-not-live\n" as *u8) } 57 if gexists(apply) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL apply-not-live\n" as *u8) } 58 if gexists(unap) == 0 { pass=pass+1 } else { fail=fail+1; gp(" FAIL unapproved-leaked-live\n" as *u8) } 59 if ghas(led, "meet/index.html" as *u8) == 1 { pass=pass+1 } else { fail=fail+1; gp(" FAIL ledger-missing-entry\n" as *u8) } 60 61 gp("MEET-SHIP-GATE pass=" as *u8); gn(pass); gp(" fail=" as *u8); gn(fail) 62 // MIGRATED onto nx_gate_verdict by nx_gate_dry_apply (D001, minimal form): every check 63 // row above is untouched, so the PASS/FAIL vector cannot change; only the hand-rolled 64 // verdict emission is replaced by the ONE shared base class. Proven by nx_gate_migrate verify. 65 let ctr__dry: *i64 = gv_ctr() 66 ctr__dry[0] = pass 67 ctr__dry[1] = pass + fail 68 let rc__dry: i64 = gv_verdict("PUB-SHIP-MEET-GATE" as *u8, ctr__dry, "FULL WET SHIP: 3 approved -> verify-sha -> promoted LIVE + ledgered; unapproved HELD fail-closed)" as *u8) 69 sys_exit(rc__dry) 70 return rc__dry 71}