code wiki / _hdl_build / nx_root_trace.nx
nx_root_trace.nx
buildroot/runtime/_hdl_build/nx_root_trace.nx
about
nx_root_trace.nx -- THE ROOT-TRACE INSTRUMENT (Genealogist SIL metric), operator
2026-06-13: "make sure that we can go from spore up emitting all of our shapes that
have gotten us to where we are."
The no-floating LADDER (nx_capability_ladder) already proves every QUEUE row rests on a
DONE foundation. This is its GENEALOGY twin: it walks lineage.tsv's child<-parents edges
and proves every ORGAN traces UP, by an unbroken parent chain, to the SPORE -- the genesis
node rv64im_min_sim (BOOTSTRAP_MAP "god"). A node that CANNOT reach the spore is the
genealogical equivalent of a floating capability:
FLOATING-ROOT = parents "-" but the node is NOT the spore (claims no parent, yet isn't god)
BROKEN-LINK = a named parent has NO row in the tree (a dangling ancestor)
UNROOTED = all parents present but at least one does not itself reach the spore
Drives traced -> nodes, broken_links -> 0, floating_roots -> 1 (only the spore).
Mechanism mirrors the proven capability-ladder fixpoint, but over the lineage parents
column instead of the queue deps column (DRY of idiom, not of code -- the formats differ).
SELF-VALIDATING (no false-green): a baked pos control (child of the spore traces) and a
neg control (a non-spore "-" root + a child of an absent spore stays untraced) run on a
synthetic in-memory tree BEFORE the real lineage.tsv; controls wrong -> RED, exit 1.
Sovereign: raw syscalls, no shell/sed/awk, no third-party. license_tier: ORIGINAL
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_collision_watchdog.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 22 | const RT_MAGIC_1048576: i64 = 1048576 |
| 23 | const RT_MAGIC_1048575: i64 = 1048575 |
| 25 | const RT_MAX: i64 = 512 |
| 26 | const RT_IDCAP: i64 = 48 |
| 27 | const RT_PARCAP: i64 = 320 |
| 28 | const RT_LIN: *u8 = "knowledge/registry/lineage.tsv" |
| 29 | const RT_LOG: *u8 = "knowledge/status/root_trace.log" |
| 30 | const RT_SPORE: *u8 = "rv64im_min_sim" |
functions
| 32 | func rt_w(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 } |
| 33 | func rt_wn(fd: i64, v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64=v; if m<0 {m=0-m; sys_write(fd,"-" as *u8,1)}; let t: *u8 = sys_mmap(28); var k: i64=0; if m==0 {t[0]=48 as u8;k=1}; while m>0 {t[k]=(48+(m%10)) as u8; m=m/10; k=k+1}; var i: i64=0; while i<k {bb[i]=t[k-1-i]; i=i+1}; sys_write(fd, bb, k); return 0 } |
| 35 | func rt_streq(a: *u8, b: *u8) -> i64 |
| 47 | func rt_has_dot(s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { if s[i] == (46 as u8) { return 1 } i = i + 1 } return 0 } |
| 49 | func rt_id_at(base: i64, r: i64) -> *u8 { return (base + r * RT_IDCAP) as *u8 } |
| 50 | func rt_par_at(base: i64, r: i64) -> *u8 { return (base + r * RT_PARCAP) as *u8 } |
| 52 | func rt_set(base: i64, cap: i64, r: i64, s: *u8) -> i64 |
| 61 | func rt_find(idbase: i64, n: i64, name: *u8) -> i64 |
| 68 | func rt_load(path: *u8, idbase: i64, parbase: i64) -> i64 |
| 128 | func rt_trace(idbase: i64, parbase: i64, n: i64, spore: *u8, traced: *i64) -> i64 |
| 188 | func rt_has_missing(idbase: i64, parbase: i64, n: i64, r: i64) -> i64 |
| 211 | func rt_gap_line(fd: i64, idbase: i64, parbase: i64, n: i64, r: i64, traced: *i64) -> i64 |
| 249 | func rt_gate(fd: i64, cpos: i64, cneg: i64, present: i64, nodes: i64, traced: i64, broken: i64, froots: i64, epoch: i64, ok: i64) -> i64 |
| 265 | func main() -> i64 |