code wiki / _hdl_build / nx_math_render_publish.nx

nx_math_render_publish.nx source

↩ module page · 77 lines · 4636 B

1// nx_math_render_publish.nx -- land /wiki/math_render.html LIVE through the GUARDED + VERSIONED 2// publish path (vpub): snapshot a content-addressed rollback version, then the A3 fail-closed guard 3// must ALLOW (every /wiki/ href resolves to a corpus slug) before the NAS push runs. ADDITIVE. 4// 5// Publishes, in order: the re-emitted formats_uxf hub + media_studio hub FIRST (their rendered 6// prev/next + related furniture now link to the new math_render child -> keeps reachability=100 on 7// the LIVE site), then math_render.html itself. The corpus set = all 21 live wiki slugs; a 8// missing/dead /wiki/ link => the guard rejects with a dead-link verdict (fail-closed) -- the safety 9// net that the walk gate proves GREEN locally before we ever push. 10// REUSE: nx_wiki_versioned_publish vpub (mirrors nx_ims_search_publish exactly). 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 MP_EPOCH: i64 = 1781950000 26 27func mp_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, MP_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 21 live wiki slugs. Every /wiki/ href in the published pages must resolve to 43 // 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] = "math_render" as *u8 as i64; cs_len[11] = 11 58 cs_ptr[12] = "media_studio" as *u8 as i64; cs_len[12] = 12 59 cs_ptr[13] = "search" as *u8 as i64; cs_len[13] = 6 60 cs_ptr[14] = "substrate" as *u8 as i64; cs_len[14] = 9 61 cs_ptr[15] = "nishi_os" as *u8 as i64; cs_len[15] = 8 62 cs_ptr[16] = "sovereign_email" as *u8 as i64; cs_len[16] = 15 63 cs_ptr[17] = "simd_backend" as *u8 as i64; cs_len[17] = 12 64 cs_ptr[18] = "neural_mt" as *u8 as i64; cs_len[18] = 9 65 cs_ptr[19] = "vision_fr" as *u8 as i64; cs_len[19] = 9 66 cs_ptr[20] = "voxelworld" as *u8 as i64; cs_len[20] = 10 67 let ncorpus: i64 = 21 68 69 p_w("=== MATH-RENDER PUBLISH: re-emit formats_uxf + media_studio hubs + math_render.html -> LIVE (guarded+versioned) ===\n") 70 var ok: i64 = 0 71 if mp_publish("formats_uxf" as *u8, "web_assets/formats_uxf.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 72 if mp_publish("media_studio" as *u8, "web_assets/media_studio.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 73 if mp_publish("math_render" as *u8, "web_assets/math_render.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 74 p_w("=== published "); p_num(ok); p_w("/3 LIVE (formats_uxf + media_studio + math_render; fail-closed if any) ===\n") 75 if ok == 3 { sys_exit(0); return 0 } 76 sys_exit(1); return 1 77}