code wiki / _hdl_build / nx_ims_batch1_publish.nx

nx_ims_batch1_publish.nx source

↩ module page · 72 lines · 4341 B

1// nx_ims_batch1_publish.nx -- land batch #1 LIVE through the GUARDED + VERSIONED publish 2// path (vpub): first snapshot a content-addressed rollback version, then the A3 fail-closed 3// guard must ALLOW before the NAS push runs. ADDITIVE. Publishes, in order, the re-emitted 4// START hub (so its rendered tree's forward links to the 4 new children are LIVE -> keeps 5// reachability=100) then the 4 new real pages. The corpus set = EVERY slug any of these 6// pages links to (all 12 wiki slugs + the nav search target); a missing slug => the guard 7// rejects with PG_REJECT_DEAD_LINK (fail-closed), which is the safety property we want. 8// 9// REUSE (no publish/version/push substrate reinvented): nx_wiki_versioned_publish vpub. 10// license_tier: ORIGINAL 11import "nx_wiki_versioned_publish.nx" 12import "nx_syscalls.nx" 13 14func p_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 15func p_num(v: i64) -> i64 { 16 let bb: *u8 = sys_mmap(28); var m: i64 = v; if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m } 17 let t: *u8 = sys_mmap(28); var k: i64 = 0 18 if m == 0 { t[0] = 48 as u8; k = 1 } 19 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 20 var i: i64 = 0; while i < k { bb[i] = t[k - 1 - i]; i = i + 1 } 21 sys_write(1, bb, k); return 0 22} 23 24// fixed epoch for deterministic version records (NO wall-clock in the version index). 25const PB_EPOCH: i64 = 1781850000 26 27func pb_publish(slug: *u8, path: *u8, cs_ptr: *i64, cs_len: *i64, ncorpus: i64) -> i64 { 28 let res: *PubResult = sys_mmap(64) as *PubResult 29 let vout: *i64 = sys_mmap(16) as *i64 30 let rc: i64 = vpub(slug, path, cs_ptr, cs_len, ncorpus, PB_EPOCH, 1, res, vout) 31 p_w(" vpub("); p_w(slug); p_w(") rc="); p_w(vp_status_name(rc)) 32 p_w(" version#="); p_num(vout[0]) 33 p_w(" | push="); p_w(pub_status_name(res.status)) 34 p_w(" push_invoked="); p_num(res.push_invoked) 35 p_w(" push_rc="); p_num(res.push_rc) 36 p_w(" bytes="); p_num(res.bytes); p_w("\n") 37 if rc == VP_OK { if res.push_invoked == 1 { return 0 } } 38 return 0 - 1 39} 40 41func main() -> i64 { 42 // corpus set = all 12 live wiki slugs + the nav search target (13). Every href in any 43 // page below must resolve to one of these or the A3 guard fail-closes the publish. 44 let cs_ptr: *i64 = sys_mmap(24 * 8) as *i64 45 let cs_len: *i64 = sys_mmap(24 * 8) as *i64 46 cs_ptr[0] = "start" as *u8 as i64; cs_len[0] = 5 47 cs_ptr[1] = "charter" as *u8 as i64; cs_len[1] = 7 48 cs_ptr[2] = "nist_stem" as *u8 as i64; cs_len[2] = 9 49 cs_ptr[3] = "roadmap" as *u8 as i64; cs_len[3] = 7 50 cs_ptr[4] = "board" as *u8 as i64; cs_len[4] = 5 51 cs_ptr[5] = "devlog" as *u8 as i64; cs_len[5] = 6 52 cs_ptr[6] = "econsim" as *u8 as i64; cs_len[6] = 7 53 cs_ptr[7] = "products" as *u8 as i64; cs_len[7] = 8 54 cs_ptr[8] = "genesis_genealogy" as *u8 as i64; cs_len[8] = 17 55 cs_ptr[9] = "access_wall" as *u8 as i64; cs_len[9] = 11 56 cs_ptr[10] = "formats_uxf" as *u8 as i64; cs_len[10] = 11 57 cs_ptr[11] = "media_studio" as *u8 as i64; cs_len[11] = 12 58 cs_ptr[12] = "search" as *u8 as i64; cs_len[12] = 6 59 let ncorpus: i64 = 13 60 61 p_w("=== IMS BATCH #1 PUBLISH: start hub + 4 new pages -> LIVE (guarded+versioned) ===\n") 62 var ok: i64 = 0 63 // re-publish START first so the live front door's tree links the 4 new children. 64 if pb_publish("start" as *u8, "web_assets/ai_start.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 65 if pb_publish("genesis_genealogy" as *u8, "web_assets/genesis_genealogy.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 66 if pb_publish("access_wall" as *u8, "web_assets/access_wall.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 67 if pb_publish("formats_uxf" as *u8, "web_assets/formats_uxf.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 68 if pb_publish("media_studio" as *u8, "web_assets/media_studio.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 69 p_w("=== published "); p_num(ok); p_w("/5 LIVE (start + 4 new; rest fail-closed if any) ===\n") 70 if ok == 5 { sys_exit(0); return 0 } 71 sys_exit(1); return 1 72}