code wiki / _hdl_build / nx_figures_publish.nx

nx_figures_publish.nx source

↩ module page · 76 lines · 4734 B

1// nx_figures_publish.nx -- land /wiki/figures.html LIVE through the GUARDED + VERSIONED publish (vpub): 2// snapshot a content-addressed rollback version, then the A3 fail-closed guard must ALLOW (every 3// /wiki/<slug>.html href resolves to a corpus slug) before the NAS push runs. ADDITIVE. 4// 5// Publishes, in order: the re-emitted SEARCH page FIRST (its rendered prev/next furniture now links to 6// the new figures child -> keeps figures non-orphan + reachability=100 on the LIVE site), then 7// figures.html itself. Corpus set = all 22 live wiki slugs; a missing/dead /wiki/ link => the guard 8// rejects (fail-closed) -- the safety net the walk gate already proves GREEN locally before we push. 9// The 3 downloadable data files (figures_data.{csv,json,tsv}) are pushed by the SEPARATE process 10// nx_figures_data_push (each is a static asset, not a corpus page). 11// REUSE: nx_wiki_versioned_publish vpub (mirrors nx_math_render_publish exactly). license_tier: ORIGINAL 12import "nx_wiki_versioned_publish.nx" 13import "nx_itoa_lib.nx" // shared MSB-first emitter (zero-alloc) 14import "nx_syscalls.nx" 15 16func 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 } 17// MIGRATED to the shared emitter (debt 1785563586). The old body mmapped a scratch buffer 18// per call and never freed it. At PAGE granularity that is 4096B leaked PER CALL -- the 19// defect that took 28.5GB of a 36GB host in nx_ts_lumadiff (2MB input, ~3.66M calls). 20// nxi_* is MSB-first, allocates NOTHING, and emits identical bytes including the sign. 21func p_num(v: i64) -> i64 { nxi_out(v); return 0 } 22 23// fixed epoch for deterministic version records (NO wall-clock in the version index). 24const FQ_EPOCH: i64 = 1782000000 25 26func fq_publish(slug: *u8, path: *u8, cs_ptr: *i64, cs_len: *i64, ncorpus: i64) -> i64 { 27 let res: *PubResult = sys_mmap(64) as *PubResult 28 let vout: *i64 = sys_mmap(16) as *i64 29 let rc: i64 = vpub(slug, path, cs_ptr, cs_len, ncorpus, FQ_EPOCH, 1, res, vout) 30 p_w(" vpub("); p_w(slug); p_w(") rc="); p_w(vp_status_name(rc)) 31 p_w(" version#="); p_num(vout[0]) 32 p_w(" | push="); p_w(pub_status_name(res.status)) 33 p_w(" push_invoked="); p_num(res.push_invoked) 34 p_w(" push_rc="); p_num(res.push_rc) 35 p_w(" bytes="); p_num(res.bytes); p_w("\n") 36 if rc == VP_OK { if res.push_invoked == 1 { return 0 } } 37 return 0 - 1 38} 39 40func main() -> i64 { 41 // corpus set = all 22 live wiki slugs (the 21 + figures). Every /wiki/<x>.html href in the published 42 // pages must resolve to one of these or the A3 guard fail-closes the publish. 43 let cs_ptr: *i64 = sys_mmap(32 * 8) as *i64 44 let cs_len: *i64 = sys_mmap(32 * 8) as *i64 45 cs_ptr[0] = "start" as *u8 as i64; cs_len[0] = 5 46 cs_ptr[1] = "charter" as *u8 as i64; cs_len[1] = 7 47 cs_ptr[2] = "nist_stem" as *u8 as i64; cs_len[2] = 9 48 cs_ptr[3] = "roadmap" as *u8 as i64; cs_len[3] = 7 49 cs_ptr[4] = "board" as *u8 as i64; cs_len[4] = 5 50 cs_ptr[5] = "devlog" as *u8 as i64; cs_len[5] = 6 51 cs_ptr[6] = "econsim" as *u8 as i64; cs_len[6] = 7 52 cs_ptr[7] = "products" as *u8 as i64; cs_len[7] = 8 53 cs_ptr[8] = "genesis_genealogy" as *u8 as i64; cs_len[8] = 17 54 cs_ptr[9] = "access_wall" as *u8 as i64; cs_len[9] = 11 55 cs_ptr[10] = "formats_uxf" as *u8 as i64; cs_len[10] = 11 56 cs_ptr[11] = "math_render" as *u8 as i64; cs_len[11] = 11 57 cs_ptr[12] = "media_studio" as *u8 as i64; cs_len[12] = 12 58 cs_ptr[13] = "search" as *u8 as i64; cs_len[13] = 6 59 cs_ptr[14] = "substrate" as *u8 as i64; cs_len[14] = 9 60 cs_ptr[15] = "nishi_os" as *u8 as i64; cs_len[15] = 8 61 cs_ptr[16] = "sovereign_email" as *u8 as i64; cs_len[16] = 15 62 cs_ptr[17] = "simd_backend" as *u8 as i64; cs_len[17] = 12 63 cs_ptr[18] = "neural_mt" as *u8 as i64; cs_len[18] = 9 64 cs_ptr[19] = "vision_fr" as *u8 as i64; cs_len[19] = 9 65 cs_ptr[20] = "voxelworld" as *u8 as i64; cs_len[20] = 10 66 cs_ptr[21] = "figures" as *u8 as i64; cs_len[21] = 7 67 let ncorpus: i64 = 22 68 69 p_w("=== FIGURES PUBLISH: re-emit search hub + figures.html -> LIVE (guarded+versioned, additive) ===\n") 70 var ok: i64 = 0 71 if fq_publish("search" as *u8, "web_assets/search.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 72 if fq_publish("figures" as *u8, "web_assets/figures.html" as *u8, cs_ptr, cs_len, ncorpus) == 0 { ok = ok + 1 } 73 p_w("=== published "); p_num(ok); p_w("/2 LIVE (search + figures; fail-closed if any) ===\n") 74 if ok == 2 { sys_exit(0); return 0 } 75 sys_exit(1); return 1 76}