code wiki / _hdl_build / nx_ims_batch2_publish.nx

nx_ims_batch2_publish.nx source

↩ module page · 83 lines · 5429 B

1// nx_ims_batch2_publish.nx -- land batch #2 LIVE through the GUARDED + VERSIONED publish path 2// (vpub): first snapshot a content-addressed rollback version, then the A3 fail-closed guard must 3// ALLOW before the NAS push runs. ADDITIVE. Publishes, in order: the re-emitted START hub (so its 4// rendered tree's forward link to the new SUBSTRATE child is LIVE -> reachability=100), the re-emitted 5// PRODUCTS hub (its prev/next + the product children's chain), then the new SUBSTRATE hub and the 6 new 6// pages. The corpus set = EVERY slug any of these pages links to (all 20 wiki slugs); a missing slug => 7// the guard 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 = 1781870000 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 20 live wiki slugs (13 prior + substrate + 6 new). Every href in any page below 43 // must resolve to one of these or the A3 guard fail-closes the publish. 44 let cs_ptr: *i64 = sys_mmap(32 * 8) as *i64 45 let cs_len: *i64 = sys_mmap(32 * 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 cs_ptr[13] = "substrate" as *u8 as i64; cs_len[13] = 9 60 cs_ptr[14] = "nishi_os" as *u8 as i64; cs_len[14] = 8 61 cs_ptr[15] = "sovereign_email" as *u8 as i64; cs_len[15] = 15 62 cs_ptr[16] = "simd_backend" as *u8 as i64; cs_len[16] = 12 63 cs_ptr[17] = "neural_mt" as *u8 as i64; cs_len[17] = 9 64 cs_ptr[18] = "vision_fr" as *u8 as i64; cs_len[18] = 9 65 cs_ptr[19] = "voxelworld" as *u8 as i64; cs_len[19] = 10 66 let ncorpus: i64 = 20 67 68 p_w("=== IMS BATCH #2 PUBLISH: start+products hubs + substrate + 6 new -> LIVE (guarded+versioned) ===\n") 69 var ok: i64 = 0 70 // re-publish the two hubs FIRST so the live front door's tree links the new children. 71 if pb_publish("start" as *u8, "web_assets/ai_start.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 72 if pb_publish("products" as *u8, "web_assets/products.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 73 if pb_publish("substrate" as *u8, "web_assets/substrate.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 74 if pb_publish("nishi_os" as *u8, "web_assets/nishi_os.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 75 if pb_publish("sovereign_email" as *u8, "web_assets/sovereign_email.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 76 if pb_publish("simd_backend" as *u8, "web_assets/simd_backend.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 77 if pb_publish("neural_mt" as *u8, "web_assets/neural_mt.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 78 if pb_publish("vision_fr" as *u8, "web_assets/vision_fr.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 79 if pb_publish("voxelworld" as *u8, "web_assets/voxelworld.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 80 p_w("=== published "); p_num(ok); p_w("/9 LIVE (2 hubs + substrate + 6; rest fail-closed if any) ===\n") 81 if ok == 9 { sys_exit(0); return 0 } 82 sys_exit(1); return 1 83}