code wiki / _hdl_build / nx_compare_registry_assemble.nx

nx_compare_registry_assemble.nx

buildroot/runtime/_hdl_build/nx_compare_registry_assemble.nx

11834 B187 linesdepth 21pulls 146 transitivereach 0 importersview sourcekind tooltopic compare
docsdependenciesstructsconstsfunctions

about

nx_compare_registry_assemble.nx -- SOTA durability: the /compare registry SELF-ASSEMBLES from ground truth so the multi-session-contention staleness bug (a stale local subset regenerates a hub that DROPS other sessions' cards) CANNOT recur (operator 2026-07-10: "do sota"). Reconciles against the LIVE hub (fetched over sovereign TLS = the real 41-card ground truth), extracting every card back into a registry line (title|kind|href|radar| stat), then UNIONs any local *.matrix domain not already present. The result can only GROW. LIAR-KILL: the assembled registry MUST carry >= the live hub's card count (a regression aborts, never writes). Writes knowledge/compare/registry_full (candidate SSOT). Downstream: regen hub FROM it, verify >= live, publish w/ rollback. license_tier: ORIGINAL expect_exit: 0

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_x509_trust_store.nx nx_trust_store_load_from_certdata. nx_https_fetch_follow.nx nx_compare_registry_assemble.n

imports: nx_syscalls.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_https_fetch_follow.nx

imported by: nobody (leaf or entry point)

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

main nx_trust_store_load_from_c sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_nss_certdata_parse sys_mmap ↻ _pat_class_cert _pat_value_octal _pat_end _find_newline _starts_with _parse_octal_line sys_mmap ↻ _is_space _decode_octal_escape _is_octal trust_store_alloc sys_mmap ↻ nx_x509_trust_store_load sys_mmap ↻ x509_parse sys_mmap ↻ asn1_cursor_init asn1_expect_tag sys_mmap ↻ asn1_read_tlv_header asn1_read_tag asn1_read_length asn1_read_length ↻ x509_read_tlv sys_mmap ↻ asn1_expect_tag ↻ x509_read_alg_id sys_mmap ↻ asn1_expect_tag ↻

structs

none

consts

13const K_MAGIC_4194304: i64 = 4194304
14const K_MAGIC_262144: i64 = 262144
15const K_MAGIC_4096: i64 = 4096
16const K_MAGIC_8192: i64 = 8192
17const K_MAGIC_16384: i64 = 16384

functions

19func 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 }
called by 1: main calls 1: sys_write
20func 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 }
21func slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: findf
23func findf(hay: *u8, from: i64, n: i64, needle: *u8) -> i64
called by 1: count_in calls 1: slen
29func count_in(hay: *u8, n: i64, needle: *u8) -> i64 { var c: i64=0; var p: i64=0; var q: i64=findf(hay,p,n,needle); while q>=0 { c=c+1; q=findf(hay,q+1,n,needle) } return c }
calls 1: findf
31func app(dst: *u8, off: i64, src: *u8, s: i64, len: i64) -> i64 { var i: i64=0; while i<len { dst[off+i]=src[s+i]; i=i+1 } return off+len }
32func apstr(dst: *u8, off: i64, str: *u8) -> i64 { var i: i64=0; while str[i]!=(0 as u8){dst[off+i]=str[i];i=i+1} return off+i }
33func write_file(path: *u8, buf: *u8, n: i64) -> i64 { let fd: i64=sys_openat_wr(path,420); if fd<0{return 0-1} sys_write(fd,buf,n); sys_close(fd); return n }
34func read_file(path: *u8, buf: *u8, cap: i64) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0{return 0-1} var tot: i64=0; while tot<cap { let r: i64=sys_read(fd,(buf as i64+tot) as *u8,cap-tot); if r<=0{break} tot=tot+r } sys_close(fd); return tot }
36func main() -> i64