code wiki / _hdl_build / nx_content_publish_gate.nx
nx_content_publish_gate.nx
buildroot/runtime/_hdl_build/nx_content_publish_gate.nx
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
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
structs
| none |
consts
| 76 | const PROBE_A: *u8 = "<h1>PROBE-A synth</h1>" as *u8 |
| 77 | const PROBE_B: *u8 = "<h1>PROBE-B synth updated</h1>" as *u8 |
| 78 | const TGT: *u8 = "sites/nishifamily/synth/gate_probe.html" as *u8 |
| 79 | const TGT_NEW: *u8 = "sites/nishifamily/synth/gate_probe.html.new" as *u8 |
| 80 | const TGT_PREV: *u8 = "sites/nishifamily/synth/gate_probe.html.prev" as *u8 |
functions
| 16 | func 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 | func pn(v: i64) -> i64 |
| 28 | func glen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 29 | func 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 |
| 30 | func 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 |
| 31 | func gcontains(hay: *u8, n: i64, needle: *u8) -> i64 |
| 43 | func mkreq(dst: *u8, line: *u8, body: *u8) -> i64 |
| 58 | func file_eq(path: *u8, want: *u8) -> i64 |
| 69 | func vcase(nm: *u8, expect: i64, fails: *i64) -> i64 |
| 82 | func main() -> i64 |