code wiki / _hdl_build / nx_sov_guard.nx

nx_sov_guard.nx

buildroot/runtime/_hdl_build/nx_sov_guard.nx

4934 B89 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind tooltopic sov
docsdependenciesstructsconstsfunctions

about

nx_sov_guard.nx -- SOVEREIGNTY / NO-NEW-TSV guard (hardware-rung-up). Enumerates a data dir with its OWN getdents64 (no find/ls/grep = no non-nishi tooling) and flags every *.tsv file NOT in the allowlist (knowledge/registry/tsv_allow.list -- grandfathered legacy/other-ws stores, owner-noted). Enforces "stop the creation of new tsv": a NEW non-allowlisted .tsv -> VIOLATION -> RED. As a workstream migrates its tsv -> sovereign seg-store, it removes that line. The sovereign seg-store (knowledge/store/<ns>-*) is the preferred store; this guard is the ratchet that keeps it the default. usage: nx_sov_guard [dir=knowledge/status] [allowlist=knowledge/registry/tsv_allow.list] exit 0 GREEN (no new tsv) / 1 RED (a new unallowlisted tsv) / 2 ERROR (dir unopenable) license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_itoa_lib.nx nx_sov_guard.nx nx_sov_guard_gate.nx

imports: nx_syscalls.nxnx_itoa_lib.nx

imported by: nx_sov_guard_gate.nx

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

main sg_scan sys_mmap sg_read sys_openat_rd sys_read sys_close sg_w sys_write sg_ends sg_slen sg_line_in sg_slen ↻ sys_close ↻ sg_wn nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap sg_w ↻

structs

none

consts

12const SG_MAGIC_262144: i64 = 262144
13const SG_MAGIC_65536: i64 = 65536
15const SG_DIR_DEF: *u8 = "knowledge/status"
16const SG_ALLOW_DEF: *u8 = "knowledge/registry/tsv_allow.list"

functions

18func sg_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 2: sg_scanmain calls 1: sys_write
23func sg_wn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 2: sg_scanmain calls 1: nxi_out
24func sg_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 2: sg_endssg_line_in
25func sg_ends(name: *u8, suf: *u8) -> i64
called by 1: sg_scan calls 1: sg_slen
29func sg_read(path: *u8, buf: *u8, cap: i64) -> i64
36func sg_line_in(buf: *u8, n: i64, name: *u8) -> i64
called by 1: sg_scan calls 1: sg_slen
54func sg_scan(dir: *u8, allowpath: *u8) -> i64
82func main(argc: i64, argv: *i64) -> i64
calls 2: sg_scansg_w