code wiki / _hdl_build / _wiki_edit_gate.nx
_wiki_edit_gate.nx
buildroot/runtime/_hdl_build/_wiki_edit_gate.nx
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
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
structs
| none |
consts
| none |
functions
| 41 | func 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 } |
| 42 | func gn(fd: i64, v: i64) -> i64 |
| 50 | func w2(lfd: i64, s: *u8) -> i64 { gw(1, s); if lfd >= 0 { gw(lfd, s) } return 0 } |
| 51 | func n2(lfd: i64, v: i64) -> i64 { gn(1, v); if lfd >= 0 { gn(lfd, v) } return 0 } |
| 54 | func bytes_eq(a: *u8, an: i64, b: *u8, bn: i64) -> i64 called by 1: main |
| 62 | func contains(hay: *u8, hay_n: i64, needle: *u8, needle_n: i64) -> i64 |
| 78 | func serves_with(store: *NxWikiDocStore, slug: *u8, slug_n: i64, |
| 97 | func rev_exists(slug: *u8, slug_n: i64, epoch: i64) -> i64 |
| 112 | func main() -> i64 |