code wiki / _hdl_build / _wiki_edit_gate.nx

_wiki_edit_gate.nx

buildroot/runtime/_hdl_build/_wiki_edit_gate.nx

12876 B258 linesdepth 17pulls 71 transitivereach 0 importersview sourcekind gate/prooftopic wiki
docsdependenciesstructsconstsfunctions

about

_wiki_edit_gate.nx -- unit gate PROVING the wiki R1 auth-gated page EDIT/SAVE backbone: an AUTHED save persists + renders + is an immutable revision, and an UNAUTH save is REFUSED with the store UNCHANGED (the liar-kill). NO mocks, NO live socket: drives the REAL save core (nx_wiki_page_save) + REAL doc store + the REAL reused auth (armed NxAuthContext: persistent key bundle + OPAQUE account store + argon2id KSF -- the exact production auth the wiki login uses) + the REAL append-only seg_store. Mirrors the proven shapes in nx_wiki_login_live_gate.nx (armed ctx + register + login -> real token) and _wiki_engine_gate.nx (doc-store serve as ground truth). Rows: save_ok : AUTHED nx_wiki_page_save(slug,"new content X",VALID token) -> ground truth = seg_store wikicur:<slug> reads back "new content X" AND the doc store serves "new content X". unauth_refused : nx_wiki_page_save(slug,"evil",EMPTY/INVALID token) -> returns REFUSED AND seg_store wikicur:<slug> is STILL "new content X" (the evil write never landed). rev_ok : a wikirev:<slug>:* revision row exists for the authed save. readback_ok : the wikicur:<slug> readback equaled the authed content. JUDGED by the printed WIKIEDIT marker (verdict=GREEN only if EVERY assertion holds), NOT by $?. Per the native-codegen desync landmine, every assertion is judged on a GROUND-TRUTH observable -- the BYTES read back out of the seg_store / served from the doc store -- never a bare returned status code. A UNIQUE slug per run (epoch-suffixed) keeps the shared append-only knowledge/store/wikipage- prefix from letting a PRIOR run's bytes answer for this one (the store is additive; latest-put wins per slug). Import set: nx_syscalls + wiki/nx_wiki_edit_handler (transitively pulls the save core -> the reused auth flow -> uas/opaque/bip39, base64, html_escape, index_builder, seg_store). Each base module splices exactly ONCE (path-dedup) to avoid the double-import nxasm rc6 trap. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_wiki_edit_handler.nx nx_wiki_doc_handler.nx _wiki_edit_gate.nx

imports: nx_syscalls.nxnx_wiki_edit_handler.nxnx_wiki_doc_handler.nx

imported by: nobody (leaf or entry point)

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

main gw sys_write sys_openat_wr sys_close sys_mmap nx_uas_server_keys_load_or sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ↻ _uas_hex_dec _uas_nib nx_csprng_fill sys_mmap ↻ nx_csprng_urandom_path sys_openat_rd ↻ sys_read ↻ sys_close ↻ nx_opq_derive_keypair sys_mmap ↻ _voprf_load_context_string u256_alloc nx_scratch nx_scratch_init sys_mmap ↻ nx_scratch_oom sys_write ↻ sys_exit sys_mmap ↻ nx_opq_hash_to_scalar sys_mmap ↻ nx_h2c_expand_message_xmd_ sys_mmap ↻ _h2c_i2osp_1 _h2c_i2osp_2 u256_alloc ↻

structs

none

consts

none

functions

41func gw(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 2: w2main calls 1: sys_write
42func gn(fd: i64, v: i64) -> i64
called by 2: n2main calls 2: sys_mmapsys_write
50func w2(lfd: i64, s: *u8) -> i64 { gw(1, s); if lfd >= 0 { gw(lfd, s) } return 0 }
called by 1: main calls 1: gw
51func n2(lfd: i64, v: i64) -> i64 { gn(1, v); if lfd >= 0 { gn(lfd, v) } return 0 }
called by 1: main calls 1: gn
54func bytes_eq(a: *u8, an: i64, b: *u8, bn: i64) -> i64
called by 1: main
62func contains(hay: *u8, hay_n: i64, needle: *u8, needle_n: i64) -> i64
78func serves_with(store: *NxWikiDocStore, slug: *u8, slug_n: i64,
called by 1: main calls 3: sys_mmapnx_wps_urlcontains
97func rev_exists(slug: *u8, slug_n: i64, epoch: i64) -> i64
112func main() -> i64