code wiki / _hdl_build / nx_wiki_publish.nx

nx_wiki_publish.nx

buildroot/runtime/_hdl_build/nx_wiki_publish.nx

10237 B205 linesdepth 8pulls 9 transitivereach 24 importersview sourcekind librarytopic wiki
docsdependenciesstructsconstsfunctions

about

nx_wiki_publish.nx -- A3: the ONE-CALL GUARDED PUBLISH WRAPPER (the enforcement point). EVERY page that goes live MUST flow through pub_publish(); nothing reaches the served wiki doc-root unless the A2 guard (nx_wiki_publish_guard pg_decide) returns PG_ALLOW. This is the wiki's publish PEP wrapped around the A2 PDP: same fail-closed / deny-by-default discipline as nx_access_pep around nx_access_wall. FLOW (composition, not reimplementation): 1. read the page bytes from local_html_path. 2. verdict = pg_decide(WAR_PREFIX, bytes, n, corpus...) -- the SOLE integrity authority (REUSED). 3. REJECT -> return {status=PUB_REJECTED, code=<the exact PG_REJECT_* reason>, push_invoked=0}. The push path is NEVER reached (fail-closed). This is THE safety property A3 exists to guarantee: a guard-rejected page can never be streamed to the live site. 4. ALLOW -> if do_push_flag == 0: return {status=PUB_ALLOW_NOPUSH, code=PG_ALLOW, push_invoked=0} (the guard verdict is reported, but nothing is pushed -- lets the gate prove the ALLOW path is reached WITHOUT touching the network). -> if do_push_flag == 1: write the awpush.src/awpush.dst staging files for /wiki/<slug>.html at the SERVED doc-root, then invoke the PROVEN push (nx_aw_push) as a separate run, and return {status=PUB_PUBLISHED, bytes=n, push_invoked=1}. HOW THE PUSH IS INVOKED: nx_aw_push's streaming logic lives in its main() (it reads awpush.src/awpush.dst, opens the vault, SSHes, streams) -- it is NOT an importable function. So A3 REUSES it the SAME way the rest of the stack does: write the two staging files, then fork+execve _offc/nx_aw_push.elf and wait. We do not re-implement vault auth or SSH (no rolled crypto, no copy-paste of the push spine). ADDITIVE-ONLY: the dst command is `mkdir -p <wikidir>; cat > <wikidir>/<slug>.html` -- it writes exactly ONE page and never touches any other file in the doc-root. corpus = parallel arrays (cs_ptr[i] = slug ptr, cs_len[i] = slug len, ncorpus) -- the SAME array idiom pg_decide / nx_access_wall_gate use (NishiLang caps a call's arg count, so a set is passed as arrays). Pure NishiLang, NO sql/.sh/.py/.js, no new .tsv/.conf. license_tier: ORIGINAL

dependencies 2 imports · 6 importers

nx_wiki_publish_guard.nx nx_syscalls.nx nx_wiki_publish.nx nx_genealogy_publish.nx nx_wiki_codec_status_page.nx nx_wiki_publish_gate.nx nx_wiki_publish_nist_stem.nx nx_wiki_restore.nx nx_wiki_versioned_publish.nx

imports: nx_wiki_publish_guard.nxnx_syscalls.nx

imported by: nx_genealogy_publish.nxnx_wiki_codec_status_page.nxnx_wiki_publish_gate.nxnx_wiki_publish_nist_stem.nxnx_wiki_restore.nxnx_wiki_versioned_publish.nx

structs

40struct PubResult

consts

31const PUB_MAGIC_1024: i64 = 1024
32const PUB_MAGIC_2048: i64 = 2048
36const PUB_PUBLISHED: i64 = 2 // ALLOW + do_push_flag=1 + push invoked
37const PUB_ALLOW_NOPUSH: i64 = 1 // ALLOW + do_push_flag=0 (guard passed; nothing pushed)
38const PUB_REJECTED: i64 = 0 // guard REJECT -> fail-closed, push never reached
49const PUB_AWPUSH_SRC: *u8 = "/mnt/c/Users/elder/AppData/Local/Temp/awpush.src" as *u8
50const PUB_AWPUSH_DST: *u8 = "/mnt/c/Users/elder/AppData/Local/Temp/awpush.dst" as *u8
52const PUB_WIKI_DIR: *u8 = "/volume1/homes/elderwesto/nishihost/sites/nishifamily/wiki" as *u8
54const PUB_AWPUSH_ELF: *u8 = "_offc/nx_aw_push.elf" as *u8
56const PUB_MODE_0644: i64 = 0x1a4

functions

58func pub_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
61func pub_cat(dst: *u8, off: i64, s: *u8) -> i64
called by 1: pub_publish_ex
69func pub_write_file(path: *u8, buf: *u8, n: i64) -> i64
79func pub_run(path: *u8, a1: *u8, a2: *u8) -> i64
103func pub_publish_ex(prefix: *u8, local_html_path: *u8, target_slug: *u8,
193func pub_publish(local_html_path: *u8, target_slug: *u8,
called by 3: mainmainmain calls 1: pub_publish_ex
200func pub_status_name(s: i64) -> *u8