code wiki / _hdl_build / nx_content_publish_gate.nx

nx_content_publish_gate.nx

buildroot/runtime/_hdl_build/nx_content_publish_gate.nx

9125 B162 linesdepth 18pulls 72 transitivereach 0 importersview sourcekind gate/prooftopic content
docsdependenciesstructsconstsfunctions

about

nx_content_publish_gate.nx -- prove the OFF-LAN static-content publish rung on the mgmt API (2026-07-06): the /synth page + STL/PNG assets can be STAGED (/api/upload) and PROMOTED (/api/promote_content) over the authenticated public edge, never-brick, without SSH/LAN. In-process referee (no socket): crafts request BYTES and feeds the pure handlers. Auth is the SAME ma_level_of gate as /api/deploy (proven in nx_mgmt_api_gate T6), so this focuses on the NEW logic: T1 md_content_target_ok fail-closed table (valid .stl/.html; reject traversal/subdir/wrong-prefix/bad-ext/service) T2 /api/upload with a content target -> stages <target>.new (byte-exact) T3 /api/promote_content -> live file == body, prev=0 (no prior live) T4 second upload+promote -> live == new body AND .prev == old body (never-brick backup) T5 NEG /api/promote_content without confirm=yes -> 400, live UNCHANGED Self-cleaning (unlinks the gate_probe.* it writes under sites/nishifamily/synth/). license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_mgmt_api.nx nx_syscalls.nx nx_content_publish_gate.nx

imports: nx_mgmt_api.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main w sys_write sys_mkdir sys_chdir sys_mmap fio_unlink sys_mmap ↻ vcase md_content_target_ok md_content_pfx md_content_ext_ok glen w ↻ pn sys_mmap ↻ sys_write ↻ pn ↻ mkreq glen ↻ gcat sys_mmap ↻ gcatn ma_do_upload sd_find_path mau_query_off ma_emit_400 sd_cat ma_emit_json sd_cat ↻ sd_catn sys_mmap ↻ mau_qparam md_upload_target_ok md_slice_eq md_content_target_ok ↻ mau_qint mau_build_path mau_mkdirs sys_mkdir ↻

structs

none

consts

76const PROBE_A: *u8 = "<h1>PROBE-A synth</h1>" as *u8
77const PROBE_B: *u8 = "<h1>PROBE-B synth updated</h1>" as *u8
78const TGT: *u8 = "sites/nishifamily/synth/gate_probe.html" as *u8
79const TGT_NEW: *u8 = "sites/nishifamily/synth/gate_probe.html.new" as *u8
80const TGT_PREV: *u8 = "sites/nishifamily/synth/gate_probe.html.prev" as *u8

functions

16func w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 2: vcasemain calls 1: sys_write
17func pn(v: i64) -> i64
called by 2: vcasemain calls 2: sys_mmapsys_write
28func glen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
29func gcat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){d[o+i]=s[i]; i=i+1} return o+i }
called by 1: mkreq
30func gcatn(d: *u8, o: i64, s: *u8, n: i64) -> i64 { var i: i64=0; while i<n {d[o+i]=s[i]; i=i+1} return o+n }
called by 1: mkreq
31func gcontains(hay: *u8, n: i64, needle: *u8) -> i64
called by 1: main calls 1: glen
43func mkreq(dst: *u8, line: *u8, body: *u8) -> i64
called by 1: main calls 4: glengcatsys_mmapgcatn
58func file_eq(path: *u8, want: *u8) -> i64
called by 1: main calls 3: sys_mmapsys_read_fileglen
69func vcase(nm: *u8, expect: i64, fails: *i64) -> i64
called by 1: main calls 4: md_content_target_okglenwpn
82func main() -> i64