code wiki / _hdl_build / nx_build_rooted_gate.nx

nx_build_rooted_gate.nx

buildroot/runtime/_hdl_build/nx_build_rooted_gate.nx

10210 B194 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/prooftopic build
docsdependenciesstructsconstsfunctions

about

nx_build_rooted_gate.nx -- ROBUST GENEALOGY: every organ ROOTED to god, NO floating mystery-kid orphans (operator 2026-06-21: "rooted from god so we can rebuild anything = true S-class exceed"). The genesis COMPLETENESS LAW (no orphans) from nx_genesis_trace, now enforced over EVERY built organ. Reads the REAL genesis tree (knowledge/registry/genesis_lineage.tsv) + the build-registry (knowledge/registry/ build_registry.log) + the organ tree (runtime/_hdl_build). Two directions, both proven: ANCESTORS (rebuild path): each registered organ's parent= anchor walks UP to ORIGIN(god); reaching god = ROOTED; not reaching = ORPHAN (the chain IS the rebuild order: build god's caps first, up to the organ). DESCENDANTS: organs anchored under a node (e.g. DESC-ORGANS) = its children. FLOATING census: organs on disk NOT in the registry = mystery kids with no anchor = the worklist to root. GATE w/ NEG-CONTROL: GREEN iff EVERY registered organ is rooted (0 registered-orphans) AND a bogus anchor is detected as orphan (-1) AND DESC-ORGANS roots to god. (Floating = reported worklist, shrunk by the R-LIVE-2 ratchet + coordinated migration -- not a hard fail since legacy migration is operator-paced.) Sovereign: imports only nx_syscalls. license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_build_rooted_gate.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main rp sys_write sys_mmap rread sys_openat_rd sys_read sys_close sys_exit kv_extract kv_find rlen rlen ↻ rstreq gen_hops sys_mmap ↻ rcpy gen_parent sys_mmap ↻ g_field rstreq ↻ rstreq ↻ rpn sys_mmap ↻ sys_write ↻ sys_openat_rd ↻ rgetdents r_isorgan rlen ↻ in_set rstreq ↻ sys_close ↻

structs

none

consts

16const GEN: *u8 = "knowledge/registry/genesis_lineage.tsv"
17const REG: *u8 = "knowledge/registry/build_registry.log"
18const ODIR: *u8 = "runtime/_hdl_build"
19const FB: i64 = 262144
20const MAXO: i64 = 8192
21const SLOT: i64 = 160

functions

23func rp(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 1: main calls 1: sys_write
24func rlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
25func rpn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
34func rstreq(a: *u8, b: *u8) -> i64
40func rcpy(dst: *u8, src: *u8) -> i64 { var i: i64 = 0; while src[i] != (0 as u8) { dst[i] = src[i]; i = i + 1 } dst[i] = 0 as u8; return 0 }
called by 1: gen_hops
41func rread(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
50func rgetdents(fd: i64, buf: *u8, count: i64) -> i64 { return __syscall(217, fd, buf, count, 0, 0, 0) }
called by 1: main
51func r_isorgan(name: *u8) -> i64
called by 1: main calls 1: rlen
63func g_field(buf: *u8, ls: i64, le: i64, idx: i64, out: *u8) -> i64
called by 1: gen_parent
70func kv_find(buf: *u8, from: i64, to: i64, pat: *u8) -> i64
called by 1: kv_extract calls 1: rlen
76func kv_extract(buf: *u8, ls: i64, le: i64, key: *u8, out: *u8) -> i64
called by 1: main calls 2: kv_findrlen
83func gen_parent(buf: *u8, n: i64, node: *u8, parent_out: *u8) -> i64
called by 1: gen_hops calls 3: sys_mmapg_fieldrstreq
94func gen_hops(buf: *u8, n: i64, node: *u8) -> i64
called by 1: main calls 4: sys_mmaprcpygen_parentrstreq
106func in_set(name: *u8, names: *i64, cnt: i64) -> i64
called by 1: main calls 1: rstreq
112func main() -> i64