code wiki / _hdl_build / nx_genealogy_tree.nx

nx_genealogy_tree.nx source

↩ module page · 284 lines · 22875 B

1// nx_genealogy_tree.nx -- the REAL visual FAMILY TREE of the genealogy (operator 2026-06-22: "walk the 2// genealogy from god to the youngest child and back ... visually see like a family tree on familysearch.org 3// ... with hard evidence ... no link-rot"). Generated LIVE from knowledge/registry/genesis_lineage.tsv (the 4// god->...->endpoint tree) + knowledge/registry/build_registry.log (the ORGANS = youngest children under 5// DESC-ORGANS). Emits a nested, navigable HTML tree: each node anchored (id) + an UP-link to its parent (walk 6// back toward god) + nested children (walk down to the youngest). Then SELF-VERIFIES against the data so the 7// page CANNOT lie: every genesis node + every organ rendered, every node's parent present (rooted), and a leaf 8// organ walks parent->...->ORIGIN(god). HONEST: this WRITES the HTML file; publishing to nishifamily.com/wiki 9// is via the Nishi Publisher (operator-gated) -- this organ does NOT claim it is live. 10// 2026-06-25 (operator: "visual and the ability to see major callouts like orphans and other failures or 11// successes or gaps at a glance"): added an AT-A-GLANCE DASHBOARD (counts by sovereignty: sovereign successes / 12// third-party locks / building+future gaps / orphans) + a red ORPHAN-ALERT banner (orphans are otherwise 13// INVISIBLE -- render only recurses god->down, so an unrooted node never appears) + per-node colored STATUS 14// CHIPS (green=sovereign, red=third-party/locked, amber=building, grey=future, blue=emu) so problems pop. 15// Sovereign: imports only nx_syscalls. license_tier: ORIGINAL expect_exit: 0 16import "nx_syscalls.nx" 17const K_MAGIC_1024: i64 = 1024 18 19const GEN: *u8 = "knowledge/registry/genesis_lineage.tsv" 20const REG: *u8 = "knowledge/registry/build_registry.log" 21const OUT: *u8 = "web_assets/genealogy_tree.html" 22const FB: i64 = 262144 23const OB: i64 = 1048576 24const MAXN: i64 = 4096 25const SLOT: i64 = 200 26 27func tp(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } 28func tlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } 29func tpn(v: i64) -> i64 { 30 let bb: *u8 = sys_mmap(28); var m: i64 = v 31 if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m } 32 let t: *u8 = sys_mmap(28); var k: i64 = 0 33 if m == 0 { t[0] = 48 as u8; k = 1 } 34 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 35 var i: i64 = 0; while i < k { bb[i] = t[k - 1 - i]; i = i + 1 } 36 sys_write(1, bb, k); return 0 37} 38func tstreq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 } 39func tread(path: *u8, buf: *u8, cap: i64) -> i64 { 40 let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 - 1 } 41 var total: i64 = 0; var nrd: i64 = sys_read(fd, buf, cap) 42 while nrd > 0 { total = total + nrd; if total >= cap { nrd = 0 } else { nrd = sys_read(fd, ((buf as i64) + total) as *u8, cap - total) } } 43 sys_close(fd); return total 44} 45func tcat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64 = off; var i: i64 = 0; while s[i] != (0 as u8) { dst[o] = s[i]; o = o + 1; i = i + 1 } return o } 46// append the decimal digits of v into dst at off; returns new off (for the dashboard counts) 47func tcatn(dst: *u8, off: i64, v: i64) -> i64 { 48 var o: i64 = off; var m: i64 = v 49 if m < 0 { dst[o] = 45 as u8; o = o + 1; m = 0 - m } 50 let t: *u8 = sys_mmap(28); var k: i64 = 0 51 if m == 0 { t[0] = 48 as u8; k = 1 } 52 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } 53 var i: i64 = 0; while i < k { dst[o] = t[k - 1 - i]; o = o + 1; i = i + 1 } 54 return o 55} 56// sovereignty -> a CSS status class so the node chip + accent colour-code at a glance 57func sovcls(sov: *u8) -> *u8 { 58 if tstreq(sov, "sovereign" as *u8) == 1 { return "ss" as *u8 } 59 if tstreq(sov, "sovereign-emu" as *u8) == 1 { return "se" as *u8 } 60 if tstreq(sov, "building" as *u8) == 1 { return "sb" as *u8 } 61 if tstreq(sov, "future" as *u8) == 1 { return "sf" as *u8 } 62 if tstreq(sov, "third-party" as *u8) == 1 { return "s3" as *u8 } 63 if tstreq(sov, "origin" as *u8) == 1 { return "so" as *u8 } 64 return "sx" as *u8 65} 66func tfield(buf: *u8, ls: i64, le: i64, idx: i64, out: *u8) -> i64 { 67 var p: i64 = ls; var f: i64 = 0 68 while f < idx { var g: i64 = 1; while g == 1 { if p >= le { return 0 } if buf[p] == (9 as u8) { p = p + 1; g = 0 } else { p = p + 1 } } f = f + 1 } 69 var o: i64 = 0; var g2: i64 = 1 70 while g2 == 1 { if p >= le { g2 = 0 } else { if buf[p] == (9 as u8) { g2 = 0 } else { if o < SLOT - 1 { out[o] = buf[p]; o = o + 1 } p = p + 1 } } } 71 out[o] = 0 as u8; return 1 72} 73func tkv(buf: *u8, ls: i64, le: i64, key: *u8, out: *u8) -> i64 { 74 let pl: i64 = tlen(key); var i: i64 = ls; var pos: i64 = 0 - 1 75 while i + pl <= le { var j: i64 = 0; var ok: i64 = 1; while j < pl { if buf[i + j] != key[j] { ok = 0; j = pl } else { j = j + 1 } } if ok == 1 { pos = i; i = le } else { i = i + 1 } } 76 if pos < 0 { out[0] = 0 as u8; return 0 } 77 var v: i64 = pos + pl; var o: i64 = 0 78 while v < le { if buf[v] == (32 as u8) { v = le } else { if o < SLOT - 1 { out[o] = buf[v]; o = o + 1 } v = v + 1 } } 79 out[o] = 0 as u8; return 1 80} 81 82// emit a dashboard stat card: <div class="card {cls}"><span class=num>{v}</span><span class=lbl>{lbl}</span></div> 83func card(dst: *u8, off: i64, cls: *u8, v: i64, lbl: *u8) -> i64 { 84 var o: i64 = off 85 o = tcat(dst, o, "<div class=\x22card " as *u8); o = tcat(dst, o, cls); o = tcat(dst, o, "\x22><span class=num>" as *u8) 86 o = tcatn(dst, o, v); o = tcat(dst, o, "</span><span class=lbl>" as *u8); o = tcat(dst, o, lbl); o = tcat(dst, o, "</span></div>" as *u8) 87 return o 88} 89 90// render one node + its children recursively. returns new off. counts rendered nodes via cnt[0]. 91func render(dst: *u8, off: i64, node: *u8, 92 nid: *i64, npar: *i64, nlab: *i64, nsov: *i64, nn: i64, 93 oid: *i64, no: i64, cnt: *i64, depth: i64) -> i64 { 94 var o: i64 = off 95 if depth > 40 { return o } 96 // find this node's row to get label/sov/parent 97 var lab: *u8 = "" as *u8; var sov: *u8 = "" as *u8; var par: *u8 = "-" as *u8 98 var r: i64 = 0 99 while r < nn { if tstreq(nid[r] as *u8, node) == 1 { lab = nlab[r] as *u8; sov = nsov[r] as *u8; par = npar[r] as *u8; r = nn } else { r = r + 1 } } 100 // does this node have children? (genesis kids, or the organ cluster under DESC-ORGANS) 101 var haschild: i64 = 0 102 var c: i64 = 0 103 while c < nn { if tstreq(npar[c] as *u8, node) == 1 { haschild = 1; c = nn } else { c = c + 1 } } 104 var isorganparent: i64 = tstreq(node, "DESC-ORGANS" as *u8) 105 if isorganparent == 1 { if no > 0 { haschild = 1 } } 106 // collapsible <details> (native, NO JS): open by default EXCEPT the 102-organ cluster -> the god->spine reads clean, expand to walk down 107 o = tcat(dst, o, "<li>" as *u8) 108 if haschild == 1 { o = tcat(dst, o, "<details" as *u8); if isorganparent == 0 { o = tcat(dst, o, " open" as *u8) } o = tcat(dst, o, "><summary>" as *u8) } 109 o = tcat(dst, o, "<span class=\x22n " as *u8); o = tcat(dst, o, sovcls(sov)); o = tcat(dst, o, "\x22 id=\x22" as *u8); o = tcat(dst, o, node); o = tcat(dst, o, "\x22>" as *u8) 110 o = tcat(dst, o, "<b>" as *u8); o = tcat(dst, o, node); o = tcat(dst, o, "</b> &mdash; " as *u8); o = tcat(dst, o, lab) 111 o = tcat(dst, o, " <i class=\x22chip " as *u8); o = tcat(dst, o, sovcls(sov)); o = tcat(dst, o, "\x22>" as *u8); o = tcat(dst, o, sov); o = tcat(dst, o, "</i>" as *u8) 112 if tstreq(par, "-" as *u8) == 0 { o = tcat(dst, o, " <a class=up href=\x22#" as *u8); o = tcat(dst, o, par); o = tcat(dst, o, "\x22>&uarr; " as *u8); o = tcat(dst, o, par); o = tcat(dst, o, "</a>" as *u8) } 113 o = tcat(dst, o, "</span>" as *u8) 114 cnt[0] = cnt[0] + 1 115 if haschild == 1 { 116 o = tcat(dst, o, "</summary><ul>" as *u8) 117 var c2: i64 = 0 118 while c2 < nn { if tstreq(npar[c2] as *u8, node) == 1 { o = render(dst, o, nid[c2] as *u8, nid, npar, nlab, nsov, nn, oid, no, cnt, depth + 1) } c2 = c2 + 1 } 119 if isorganparent == 1 { 120 var k: i64 = 0 121 while k < no { o = tcat(dst, o, "<li><span class=\x22n ss organ\x22 id=\x22" as *u8); o = tcat(dst, o, oid[k] as *u8); o = tcat(dst, o, "\x22><b>" as *u8); o = tcat(dst, o, oid[k] as *u8); o = tcat(dst, o, "</b> <i class=\x22chip ss\x22>organ &middot; rooted&checkmark;</i> <a class=up href=\x22#DESC-ORGANS\x22>&uarr; DESC-ORGANS</a></span></li>" as *u8); cnt[0] = cnt[0] + 1; k = k + 1 } 122 } 123 o = tcat(dst, o, "</ul></details>" as *u8) 124 } 125 o = tcat(dst, o, "</li>" as *u8) 126 return o 127} 128 129func main() -> i64 { 130 tp("=== nx_genealogy_tree: visual family tree (god -> youngest) + at-a-glance dashboard, gate-verified ===\n" as *u8) 131 let gbuf: *u8 = sys_mmap(FB); let gn: i64 = tread(GEN, gbuf, FB) 132 let rbuf: *u8 = sys_mmap(FB); let rn: i64 = tread(REG, rbuf, FB) 133 if gn <= 0 { tp(" ERROR: no genesis tree\n" as *u8); sys_exit(2); return 2 } 134 135 // load genesis nodes 136 let nid: *i64 = sys_mmap(8 * MAXN) as *i64 137 let npar: *i64 = sys_mmap(8 * MAXN) as *i64 138 let nlab: *i64 = sys_mmap(8 * MAXN) as *i64 139 let nsov: *i64 = sys_mmap(8 * MAXN) as *i64 140 var nn: i64 = 0 141 var i: i64 = 0 142 while i < gn { 143 let ls: i64 = i; var le: i64 = ls; var g: i64 = 1 144 while g == 1 { if le >= gn { g = 0 } else { if gbuf[le] == (10 as u8) { g = 0 } else { le = le + 1 } } } 145 if le > ls { if gbuf[ls] != (35 as u8) { 146 let idb: *u8 = sys_mmap(SLOT); let pb: *u8 = sys_mmap(SLOT); let lb: *u8 = sys_mmap(SLOT); let sb: *u8 = sys_mmap(SLOT) 147 if tfield(gbuf, ls, le, 0, idb) == 1 { 148 tfield(gbuf, ls, le, 2, pb); tfield(gbuf, ls, le, 5, lb); tfield(gbuf, ls, le, 4, sb) 149 if tlen(idb) > 0 { if nn < MAXN { nid[nn] = idb as i64; npar[nn] = pb as i64; nlab[nn] = lb as i64; nsov[nn] = sb as i64; nn = nn + 1 } } 150 } 151 } } 152 i = le + 1 153 } 154 // load registry organs (distinct) 155 let oid: *i64 = sys_mmap(8 * MAXN) as *i64 156 var no: i64 = 0 157 if rn > 0 { 158 var j: i64 = 0 159 while j < rn { 160 let ls: i64 = j; var le: i64 = ls; var g: i64 = 1 161 while g == 1 { if le >= rn { g = 0 } else { if rbuf[le] == (10 as u8) { g = 0 } else { le = le + 1 } } } 162 let ob: *u8 = sys_mmap(SLOT) 163 if tkv(rbuf, ls, le, "organ=" as *u8, ob) == 1 { 164 var found: i64 = 0; var k: i64 = 0 165 while k < no { if tstreq(oid[k] as *u8, ob) == 1 { found = 1; k = no } else { k = k + 1 } } 166 if found == 0 { if no < MAXN { oid[no] = ob as i64; no = no + 1 } } 167 } 168 j = le + 1 169 } 170 } 171 172 // ---- AT-A-GLANCE CENSUS: counts by sovereignty + orphans (computed BEFORE emit so the dashboard is honest) ---- 173 var c_ss: i64 = 0; var c_se: i64 = 0; var c_sb: i64 = 0; var c_sf: i64 = 0; var c_s3: i64 = 0 174 var ci2: i64 = 0 175 while ci2 < nn { 176 let sv: *u8 = nsov[ci2] as *u8 177 if tstreq(sv, "sovereign" as *u8) == 1 { c_ss = c_ss + 1 } 178 if tstreq(sv, "sovereign-emu" as *u8) == 1 { c_se = c_se + 1 } 179 if tstreq(sv, "building" as *u8) == 1 { c_sb = c_sb + 1 } 180 if tstreq(sv, "future" as *u8) == 1 { c_sf = c_sf + 1 } 181 if tstreq(sv, "third-party" as *u8) == 1 { c_s3 = c_s3 + 1 } 182 ci2 = ci2 + 1 183 } 184 // orphans = a node whose parent_id is NOT present (these are INVISIBLE in the tree -> the banner is the only way to see them) 185 var c_orph: i64 = 0 186 var co: i64 = 0 187 while co < nn { 188 if tstreq(npar[co] as *u8, "-" as *u8) == 0 { 189 var fnd: i64 = 0; var k2: i64 = 0 190 while k2 < nn { if tstreq(nid[k2] as *u8, npar[co] as *u8) == 1 { fnd = 1; k2 = nn } else { k2 = k2 + 1 } } 191 if fnd == 0 { c_orph = c_orph + 1 } 192 } 193 co = co + 1 194 } 195 196 // ---- AI-ladder frontier (written by nx_cap_gap_sov) for the "next to build" callout ---- 197 let cfbuf: *u8 = sys_mmap(K_MAGIC_1024); let cfn: i64 = tread("knowledge/status/cap_frontier.txt" as *u8, cfbuf, K_MAGIC_1024) 198 let cf_built: *u8 = sys_mmap(SLOT); let cf_total: *u8 = sys_mmap(SLOT); let cf_next: *u8 = sys_mmap(SLOT) 199 var have_cf: i64 = 0 200 if cfn > 0 { 201 var cle: i64 = 0; var cgo: i64 = 1 202 while cgo == 1 { if cle >= cfn { cgo = 0 } else { if cfbuf[cle] == (10 as u8) { cgo = 0 } else { cle = cle + 1 } } } 203 if tfield(cfbuf, 0, cle, 0, cf_built) == 1 { tfield(cfbuf, 0, cle, 1, cf_total); tfield(cfbuf, 0, cle, 2, cf_next); if tlen(cf_built) > 0 { have_cf = 1 } } 204 } 205 206 // emit HTML 207 let dst: *u8 = sys_mmap(OB) 208 var o: i64 = 0 209 o = tcat(dst, o, "<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta name=viewport content=\x22width=device-width,initial-scale=1\x22>" as *u8) 210 o = tcat(dst, o, "<title>Nishi Genealogy &mdash; god to the youngest child (family tree)</title>" as *u8) 211 o = tcat(dst, o, "<style>body{font-family:-apple-system,Segoe UI,Roboto,sans-serif;max-width:1000px;margin:0 auto;padding:0 20px 6vh;color:#14141e}h1{font-size:1.8rem}.lede{background:#1b1b26;color:#e8eef8;border-radius:8px;padding:14px 18px}.lede b{color:#9ecbff}ul{list-style:none;border-left:2px solid #d6deea;margin-left:.5rem;padding-left:1rem}li{margin:.3rem 0}summary{cursor:pointer;outline:none}summary:hover{background:#f0f4fb;border-radius:4px}summary::marker{color:#8aa0b4}details{margin:0}.n b,.organ b{font-family:ui-monospace,Consolas,monospace}a.up{font-size:.8rem;color:#888;text-decoration:none;margin-left:.4rem}a.up:hover{color:#2a4d8f}.foot{margin-top:2rem;font-size:.8rem;color:#888;border-top:1px solid #eee;padding-top:1rem}.fresh{display:inline-block;background:#e8f6ea;border:1px solid #bfe3c5;color:#225522;border-radius:6px;padding:2px 8px;font-size:.78rem;margin-right:.4rem}" as *u8) 212 o = tcat(dst, o, ".dash{display:flex;flex-wrap:wrap;gap:8px;margin:16px 0}.card{flex:1;min-width:96px;background:#f4f6fb;border:1px solid #e0e6f0;border-radius:8px;padding:9px 12px;text-align:center}.card .num{display:block;font-size:1.6rem;font-weight:700;line-height:1.1}.card .lbl{font-size:.72rem;color:#5a6573}.card.ok{background:#e8f6ea;border-color:#bfe3c5}.card.ok .num{color:#1c7a32}.card.bad{background:#fdeaea;border-color:#f2c4c4}.card.bad .num{color:#c0392b}.card.gap{background:#fdf6e3;border-color:#efe0b0}.card.gap .num{color:#9a7d1a}.card.emu{background:#e8eefb;border-color:#c4d2f0}.card.emu .num{color:#2a4d8f}" as *u8) 213 o = tcat(dst, o, ".alert{background:#c0392b;color:#fff;padding:11px 15px;border-radius:8px;font-weight:600;margin:10px 0}.frontier{background:#1b1b26;color:#e8eef8;border-radius:8px;padding:11px 15px;margin:10px 0;font-size:.92rem}.frontier b{color:#9ecbff}.legend{font-size:.78rem;color:#667;margin:6px 0 0}.chip{font-size:.72rem;padding:1px 8px;border-radius:10px;margin-left:.45rem;font-style:normal;background:#eef;color:#446}.chip.ss{background:#d8f0db;color:#1c7a32}.chip.s3{background:#fadbdb;color:#c0392b}.chip.sb{background:#f7ecc8;color:#8a6d10}.chip.sf{background:#e8e8ee;color:#5a6573}.chip.se{background:#dde6f7;color:#2a4d8f}.chip.so{background:#f5e6b0;color:#7a5c00}.n{border-left:3px solid transparent;padding-left:7px;border-radius:2px}.n.ss{border-color:#2eb24d}.n.s3{border-color:#c0392b;background:#fdf3f3}.n.sb{border-color:#e0b020;background:#fdfaf0}.n.sf{border-color:#bbc1cc}.n.se{border-color:#4a7fd0}.n.so{border-color:#d4a017;background:#fdf8e8}.n{transition:opacity .12s}.filter input{position:absolute;left:-9999px}.fbar{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0 2px;align-items:center;font-size:.8rem}.fbar b{color:#5a6573}.fbar label{padding:4px 12px;border:1px solid #ccd;border-radius:14px;cursor:pointer;background:#f4f6fb;user-select:none}.fbar label:hover{background:#e8eefb}#f-all:checked~.fbar label[for=f-all],#f-s3:checked~.fbar label[for=f-s3],#f-gap:checked~.fbar label[for=f-gap],#f-ss:checked~.fbar label[for=f-ss],#f-se:checked~.fbar label[for=f-se]{background:#2a4d8f;color:#fff;border-color:#2a4d8f}#f-s3:checked~ul .n:not(.s3){opacity:.12}#f-gap:checked~ul .n:not(.sb):not(.sf){opacity:.12}#f-ss:checked~ul .n:not(.ss){opacity:.12}#f-se:checked~ul .n:not(.se){opacity:.12}</style>" as *u8) 214 o = tcat(dst, o, "</head><body><h1>Nishi Genealogy &mdash; god &rarr; youngest child</h1>" as *u8) 215 o = tcat(dst, o, "<p class=lede>Walk from <b>god (ORIGIN)</b> down to the youngest children (the <b>organs</b>), and back up via each node's &uarr; link. Generated LIVE from <code>genesis_lineage.tsv</code> + the build-registry &mdash; every node rooted to god, gate-verified (no link-rot: regenerate this organ to refresh).</p>" as *u8) 216 // ---- at-a-glance dashboard ---- 217 o = tcat(dst, o, "<div class=dash>" as *u8) 218 o = card(dst, o, "" as *u8, nn + no, "nodes" as *u8) 219 o = card(dst, o, "ok" as *u8, c_ss, "&checkmark; sovereign" as *u8) 220 o = card(dst, o, "ok" as *u8, no, "&checkmark; organs built" as *u8) 221 o = card(dst, o, "emu" as *u8, c_se, "emulated" as *u8) 222 o = card(dst, o, "gap" as *u8, c_sb, "building (gap)" as *u8) 223 o = card(dst, o, "gap" as *u8, c_sf, "future (gap)" as *u8) 224 o = card(dst, o, "bad" as *u8, c_s3, "&#10007; third-party / locked" as *u8) 225 if c_orph > 0 { o = card(dst, o, "bad" as *u8, c_orph, "&#10007; ORPHANS" as *u8) } else { o = card(dst, o, "ok" as *u8, 0, "&checkmark; orphans" as *u8) } 226 o = tcat(dst, o, "</div>" as *u8) 227 if c_orph > 0 { o = tcat(dst, o, "<div class=alert>&#9888; " as *u8); o = tcatn(dst, o, c_orph); o = tcat(dst, o, " ORPHAN(S) &mdash; node(s) whose parent is missing, NOT rooted to god (invisible in the tree below; fix the lineage).</div>" as *u8) } 228 if have_cf == 1 { o = tcat(dst, o, "<div class=frontier>&#127919; <b>DeepMind-ladder</b> (no-float AI, organ-grounded): <b>" as *u8); o = tcat(dst, o, cf_built); o = tcat(dst, o, "</b> / " as *u8); o = tcat(dst, o, cf_total); o = tcat(dst, o, " generations built &middot; NEXT missing generation: <b>" as *u8); o = tcat(dst, o, cf_next); o = tcat(dst, o, "</b> &mdash; the remaining gaps are hardware/compute-gated (operator's call).</div>" as *u8) } 229 o = tcat(dst, o, "<p class=legend>Status colours: <span class=\x22chip ss\x22>sovereign</span> success &middot; <span class=\x22chip se\x22>sovereign-emu</span> &middot; <span class=\x22chip sb\x22>building</span> gap &middot; <span class=\x22chip sf\x22>future</span> gap &middot; <span class=\x22chip s3\x22>third-party</span> lock/worklist. Scan for red (locks) and amber (gaps).</p>" as *u8) 230 // ---- pure-CSS filter bar (radios + sibling-combinator dimming; NO JavaScript) ---- 231 o = tcat(dst, o, "<form class=filter><input type=radio name=f id=f-all checked><input type=radio name=f id=f-s3><input type=radio name=f id=f-gap><input type=radio name=f id=f-ss><input type=radio name=f id=f-se>" as *u8) 232 o = tcat(dst, o, "<div class=fbar><b>Filter:</b><label for=f-all>All</label><label for=f-s3>&#128308; Locks (" as *u8); o = tcatn(dst, o, c_s3) 233 o = tcat(dst, o, ")</label><label for=f-gap>&#128993; Gaps (" as *u8); o = tcatn(dst, o, c_sb + c_sf) 234 o = tcat(dst, o, ")</label><label for=f-ss>&#128994; Sovereign (" as *u8); o = tcatn(dst, o, c_ss) 235 o = tcat(dst, o, ")</label><label for=f-se>&#128309; Emu (" as *u8); o = tcatn(dst, o, c_se) 236 o = tcat(dst, o, ")</label></div>" as *u8) 237 o = tcat(dst, o, "<ul>" as *u8) 238 let cnt: *i64 = sys_mmap(16) as *i64; cnt[0] = 0 239 o = render(dst, o, "ORIGIN" as *u8, nid, npar, nlab, nsov, nn, oid, no, cnt, 0) 240 o = tcat(dst, o, "</ul></form>" as *u8) 241 let nowsec: i64 = sys_now_realtime_sec() 242 o = tcat(dst, o, "<p class=foot><span class=fresh>&#10227; Banked LIVE by nx_genealogy_tree at epoch=" as *u8); o = tcatn(dst, o, nowsec); o = tcat(dst, o, "</span> &mdash; genesis nodes + organs rendered live from <code>genesis_lineage.tsv</code> + the build-registry; god=ORIGIN; youngest=organs under DESC-ORGANS; dashboard counts computed live; regenerate to refresh (no link-rot).</p></body></html>" as *u8) 243 dst[o] = 0 as u8 244 // write file 245 let wfd: i64 = sys_openat_wr(OUT, 420) 246 if wfd < 0 { tp(" ERROR: cannot write OUT\n" as *u8); sys_exit(3); return 3 } 247 sys_write(wfd, dst, o); sys_close(wfd) 248 249 // ---- HARD-EVIDENCE SELF-VERIFY (so the page cannot lie) ---- 250 // V1: ORIGIN(god) is present in the data (root, parent="-") 251 var v_god: i64 = 0 252 var r: i64 = 0 253 while r < nn { if tstreq(nid[r] as *u8, "ORIGIN" as *u8) == 1 { if tstreq(npar[r] as *u8, "-" as *u8) == 1 { v_god = 1 } r = nn } else { r = r + 1 } } 254 // V2: every genesis node's parent exists (rooted, no orphan) -- ORIGIN exempt (== c_orph, recomputed for the verdict) 255 var v_orphan: i64 = c_orph 256 // V3: rendered count == genesis nodes + organs (nothing dropped, nothing fabricated) 257 let expect: i64 = nn + no 258 // V4: walk a leaf (DESC-ORGANS, the organs' parent) UP to god 259 var hops: i64 = 0; let cur: *u8 = sys_mmap(SLOT); var ci: i64 = 0 260 let seed: *u8 = "DESC-ORGANS" as *u8; while seed[ci] != (0 as u8) { cur[ci] = seed[ci]; ci = ci + 1 } cur[ci] = 0 as u8 261 var reached: i64 = 0; var step: i64 = 0 262 while step < 64 { 263 var fr: i64 = 0; var pp: *u8 = "" as *u8; var rr: i64 = 0 264 while rr < nn { if tstreq(nid[rr] as *u8, cur) == 1 { pp = npar[rr] as *u8; fr = 1; rr = nn } else { rr = rr + 1 } } 265 if fr == 0 { step = 64 } else { 266 if tstreq(pp, "-" as *u8) == 1 { reached = 1; step = 64 } else { var z: i64 = 0; while pp[z] != (0 as u8) { cur[z] = pp[z]; z = z + 1 } cur[z] = 0 as u8; hops = hops + 1; step = step + 1 } 267 } 268 } 269 270 tp(" wrote " as *u8); tp(OUT); tp(" bytes=" as *u8); tpn(o); tp("\n" as *u8) 271 tp(" genesis nodes=" as *u8); tpn(nn); tp(" organs(youngest)=" as *u8); tpn(no); tp(" rendered=" as *u8); tpn(cnt[0]); tp(" expected=" as *u8); tpn(expect); tp("\n" as *u8) 272 tp(" DASHBOARD: sovereign=" as *u8); tpn(c_ss); tp(" emu=" as *u8); tpn(c_se); tp(" building=" as *u8); tpn(c_sb); tp(" future=" as *u8); tpn(c_sf); tp(" third-party(locks)=" as *u8); tpn(c_s3); tp(" orphans=" as *u8); tpn(c_orph); tp("\n" as *u8) 273 tp(" V1 god(ORIGIN root)=" as *u8); tpn(v_god); tp(" V2 orphans=" as *u8); tpn(v_orphan); tp(" V4 leaf->god reached=" as *u8); tpn(reached); tp(" hops=" as *u8); tpn(hops); tp("\n" as *u8) 274 275 var ok: i64 = 1 276 if v_god != 1 { ok = 0 } 277 if v_orphan != 0 { ok = 0 } 278 if cnt[0] != expect { ok = 0 } 279 if reached != 1 { ok = 0 } 280 tp(" verdict=" as *u8) 281 if ok == 1 { tp("GREEN (tree complete + rooted + leaf walks to god + render matches data + dashboard counts live = page does not lie). Publish via Publisher.\n" as *u8); sys_exit(0); return 0 } 282 tp("RED (render/data mismatch, orphan, or leaf does not reach god)\n" as *u8) 283 sys_exit(1); return 1 284}