code wiki / _hdl_build / nx_pub_ship_andelin.nx

nx_pub_ship_andelin.nx source

↩ module page · 36 lines · 2317 B

1import "nx_gate_gn.nx" 2import "nx_gate_base.nx" 3// nx_pub_ship_andelin.nx -- execute the operator's explicit SHIP ("ship and drain"): approve the branded andelinwest 4// artifact BY CONTENT SHA (pub_approve = the lawful operator-gate token), then re-report status + dry-run. This file 5// calls ONLY pub_approve + read-only pub_status/pub_dryrun/pub_policy_allows -- never nx_aw_send/push or pub_deploy/ 6// promote -- so it passes the publisher's no-bypass audit. The wet promote itself is the governed loop (run separately 7// with the daemon's canonical stage/live/lock paths). Approval is reversible (delete the token). expect_exit: 0 8import "nx_syscalls.nx" 9import "nx_publisher.nx" 10 11func grow(name: *u8, ok: i64) -> i64 { if ok==1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8) } gw(name); gw(" 12" as *u8); return ok } 13 14func main() -> i64 { 15 gw("=== SHIP andelinwest -- operator-authorized approval (pub_approve, the lawful gate) ===\n" as *u8) 16 let sha: *u8 = "eeda8559c111c1f0b61b5a0d393099e6c7f504ac02bb308f75c61ed398887475" as *u8 17 let approvald: *u8 = "knowledge/publish/approved" as *u8 18 19 let r: i64 = pub_approve(sha, approvald) 20 gw("pub_approve(andelinwest sha eeda8559..) -> " as *u8); gn(r); gw("\n" as *u8) 21 if r != 1 { gw("APPROVE FAILED (could not write the approval token)\n" as *u8); return 1 } 22 23 let ok: i64 = pub_policy_allows("outward" as *u8, sha, approvald) 24 gw("pub_policy_allows(outward, andelinwest sha) -> " as *u8); gn(ok); gw(" (1 = operator-approved -> ready)\n" as *u8) 25 26 let st: *i64 = sys_mmap(64) as *i64 27 pub_status(pub_queue_default(), pub_ledger_default(), approvald, st) 28 gw("status -> PENDING=" as *u8); gn(st[0]); gw(" PUBLISHED=" as *u8); gn(st[1]); gw(" ready-now=" as *u8); gn(st[2]); gw(" HELD=" as *u8); gn(st[3]); gw("\n" as *u8) 29 let pl: *i64 = sys_mmap(64) as *i64 30 pub_dryrun(pub_queue_default(), pub_ledger_default(), approvald, pl) 31 gw("dry-run (zero side effects) -> would-publish-now=" as *u8); gn(pl[1]); gw(" held=" as *u8); gn(pl[2]); gw("\n" as *u8) 32 33 if ok == 1 { gw("\nVERDICT=GREEN -- andelinwest APPROVED + READY. The governed drain (pub_run_governed) will publish it next run.\n" as *u8); return 0 } 34 gw("\nVERDICT=RED -- approval token not recognized by the policy gate\n" as *u8) 35 return 1 36}