code wiki / _hdl_build / nx_wiki_publish_guard.nx

nx_wiki_publish_guard.nx

buildroot/runtime/_hdl_build/nx_wiki_publish_guard.nx

14834 B275 linesdepth 7pulls 8 transitivereach 27 importersview sourcekind librarytopic wiki
docsdependenciesstructsconstsfunctions

about

nx_wiki_publish_guard.nx -- THE PRE-PUBLISH GUARD (the wiki's "liar-kill"): a fail-closed POLICY DECISION POINT that REFUSES to publish a wiki page unless it passes every integrity check. Mirrors the access-wall PDP discipline (nx_access_wall): DENY-BY-DEFAULT + FAIL-CLOSED -- a page is ALLOWed only when ALL checks pass; if a check cannot even be EVALUATED, the verdict is REJECT (never a silent pass). It is PURE, DETERMINISTIC and READ-ONLY: it only INSPECTS the page bytes (and the content-addressed archive, to test whether a citation RESOLVES); it does NOT push anything. THE CHECKS (ALL must pass to ALLOW; first failure wins, with a machine-readable reason code so the publisher/audit logs WHY a page was refused): PG_REJECT_NO_FRESHNESS the page has no freshness/epoch stamp in its footer (un-stamped page = we cannot prove it is fresh -> fail-closed REJECT). PG_REJECT_DANGLING_CITE a [[cite:<cid>]] token's cid does NOT resolve in the content-addressed archive (war_get_by_cid <= 0). The cite would render "(archiving pending)" -- a dangling source -> REJECT. (This REUSES the exact cite resolution mechanism nx_wiki_cite_render uses: war_get_by_cid.) PG_REJECT_DEAD_LINK an internal href to /wiki/<x>.html targets a slug NOT in the provided corpus set -> a broken on-site link -> REJECT. PG_REJECT_PLACEHOLDER the body is empty, or contains an obvious placeholder marker (TODO / PLACEHOLDER / lorem) -> not publish-ready -> REJECT. Conservative. PG_ALLOW every check passed. WHY THE CORPUS IS A SET PASSED IN (not the archive): a dead on-site link is about what pages WILL be PUBLISHED together (the live corpus), which the publisher knows; the archive is the cite substrate. corpus = parallel arrays (slug ptr[], slug len[], count) -- the same array idiom nx_access_wall_gate uses for policy (and NishiLang caps a call's arg count, so a set is passed as arrays). IMPORTS: nx_wiki_archive.nx (war_get_by_cid + WAR_PREFIX; transitively nx_seg_store + nx_canon_cid, each spliced ONCE by module-identity dedup) and nx_syscalls.nx. Pure NishiLang, NO SQL, no .sh/.py/.js, no new .tsv/.conf. license_tier: ORIGINAL

dependencies 2 imports · 4 importers

nx_wiki_archive.nx nx_syscalls.nx nx_wiki_publish_guard.nx nx_wiki_publish.nx nx_wiki_publish_guard_gate.nx nx_wiki_publish_guard_sanity.nx nx_wiki_structure_regen.nx

imports: nx_wiki_archive.nxnx_syscalls.nx

imported by: nx_wiki_publish.nxnx_wiki_publish_guard_gate.nxnx_wiki_publish_guard_sanity.nxnx_wiki_structure_regen.nx

structs

none

consts

34const PG_ALLOW: i64 = 1
35const PG_REJECT_NO_FRESHNESS: i64 = 0 - 1
36const PG_REJECT_DANGLING_CITE:i64 = 0 - 2
37const PG_REJECT_DEAD_LINK: i64 = 0 - 3
38const PG_REJECT_PLACEHOLDER: i64 = 0 - 4
42const PG_SCAN_CAP: i64 = 64
46const PG_MAX_CID: i64 = 128
49const PG_LBRACKET: i64 = 0x5B // '['
50const PG_RBRACKET: i64 = 0x5D // ']'
51const PG_COLON: i64 = 0x3A // ':'
52const PG_HASH: i64 = 0x23 // '#'
53const PG_DQUOTE: i64 = 0x22 // '"'

functions

56func pg_len(s: *u8) -> i64
64func pg_contains(buf: *u8, n: i64, needle: *u8) -> i64
84func pg_region_eq(buf: *u8, off: i64, rn: i64, key: *u8) -> i64
called by 1: pg_all_links_live
99func pg_has_freshness(body: *u8, n: i64) -> i64
called by 1: pg_decide calls 1: pg_contains
107func pg_is_placeholder(body: *u8, n: i64) -> i64
called by 1: pg_decide calls 1: pg_contains
122func pg_all_cites_resolve(prefix: *u8, body: *u8, n: i64) -> i64
called by 1: pg_decide calls 2: sys_mmapwar_get_by_cid
261func pg_decide(prefix: *u8, body: *u8, body_n: i64,
275func pg_allowed(verdict: i64) -> i64 { if verdict == PG_ALLOW { return 1 } return 0 }
called by 1: pub_publish_ex