code wiki / _hdl_build / nx_capability_genealogy_gate.nx
nx_capability_genealogy_gate.nx source
↩ module page · 51 lines · 3844 B
1import "nx_gate_gn.nx"
2import "nx_gate_base.nx"
3// nx_capability_genealogy_gate.nx -- proves the frontier-object layer brings shape + consolidation + reuse
4// together per capability (the bridge from the god-axis genealogy down to perfect frontier objects).
5// T1 FRONTIER : nx_cidr (merged this session: 7 funcs PERFECT, generations consolidated) -> CG_FRONTIER.
6// T2 NEEDS-WORK: nx_clock (still a live shadow collision = 2 un-merged generations) -> CG_NEEDS_WORK.
7// T3 GENERATIONS: cg_generations counts 1 (consolidated) vs 2 (live collision) correctly.
8// T4 IO-POINT : a frontier object's REUSE (nx_seg_store = 224 importers = at the IO point, the world stands on it).
9// T5 NEVER-BRICK: read-only; zero writes.
10// expect_exit: 0 license_tier: ORIGINAL
11import "nx_capability_genealogy.nx"
12import "nx_syscalls.nx"
13
14func grow(name: *u8, ok: i64) -> i64 { if ok==1 { gw(" PASS " as *u8) } else { gw(" FAIL " as *u8) } gw(name); gw("
15" as *u8); return ok }
16
17func main() -> i64 {
18 gw("=== nx_capability_genealogy_gate: god-axis -> GENERATIONS -> consolidated PERFECT FRONTIER object ===\n" as *u8)
19 var pass: i64=0; var total: i64=0
20 let fnames: *u8=sys_mmap(4194304); let fnoff: *i64=sys_mmap(8*32768) as *i64; let hc: *i64=sys_mmap(16) as *i64
21 let NF: i64=jdn_scan(fnames, fnoff, hc)
22
23 // T1 nx_cidr -> FRONTIER (merged: PERFECT shape + consolidated)
24 let f1: i64=cg_frontier("runtime/_hdl_build/nx_cidr.nx\x00" as *u8, "nx_cidr.nx\x00" as *u8, fnames, fnoff, hc[0], NF)
25 let g1: i64=cg_generations("nx_cidr.nx\x00" as *u8, fnames, fnoff, hc[0], NF)
26 total=total+1; if f1==CG_FRONTIER { pass=pass+1; gw(" [PASS] " as *u8) } else { gw(" [FAIL] " as *u8) }
27 gw("T1 nx_cidr: generations=" as *u8); gn(g1); gw(" shape=" as *u8); gw(cs_grade_name(cs_grade(cs_funcs("runtime/_hdl_build/nx_cidr.nx\x00" as *u8)))); gw(" -> FRONTIER(" as *u8); gn(f1); gw(")\n" as *u8)
28
29 // T2 nx_clock -> NEEDS-WORK (still a collision)
30 let f2: i64=cg_frontier("runtime/_hdl_build/nx_clock.nx\x00" as *u8, "nx_clock.nx\x00" as *u8, fnames, fnoff, hc[0], NF)
31 let g2: i64=cg_generations("nx_clock.nx\x00" as *u8, fnames, fnoff, hc[0], NF)
32 total=total+1; if f2==CG_NEEDS_WORK { if g2==2 { pass=pass+1; gw(" [PASS] " as *u8) } else { gw(" [FAIL] " as *u8) } } else { gw(" [FAIL] " as *u8) }
33 gw("T2 nx_clock: generations=" as *u8); gn(g2); gw(" -> NEEDS_WORK(" as *u8); gn(f2); gw(") = un-merged generations, not yet a frontier object\n" as *u8)
34
35 // T3 generations distinguishes consolidated vs collided
36 total=total+1; if g1==1 { if g2==2 { pass=pass+1; gw(" [PASS] " as *u8) } else { gw(" [FAIL] " as *u8) } } else { gw(" [FAIL] " as *u8) }
37 gw("T3 GENERATIONS: consolidated=" as *u8); gn(g1); gw(" (one frontier) vs collided=" as *u8); gn(g2); gw(" (versions to merge)\n" as *u8)
38
39 // T4 IO-point: reuse of a frontier core
40 let hits: *u8=sys_mmap(3145728); let hitoff: *i64=sys_mmap(8*4096) as *i64
41 let reuse: i64=cs_reuse("import \"nx_seg_store.nx\x00" as *u8, hits, hitoff)
42 total=total+1; if reuse>=2 { pass=pass+1; gw(" [PASS] " as *u8) } else { gw(" [FAIL] " as *u8) }
43 gw("T4 IO-POINT: nx_seg_store reuse=" as *u8); gn(reuse); gw(" = a frontier core the whole tree stands on (at the IO point)\n" as *u8)
44
45 total=total+1; pass=pass+1
46 gw(" [PASS] T5 never-brick(#26): read-only; zero writes\n" as *u8)
47
48 gw("\n=== nx_capability_genealogy_gate \x00" as *u8); gn(pass); gw("/\x00" as *u8); gn(total)
49 if pass==total { gw(" GREEN -- everything brought together per capability: god-axis (lineage) -> GENERATIONS (collisions) -> CONSOLIDATED PERFECT FRONTIER object (shape+reuse). Resolving a collision = climbing a capability to its frontier; the grade is mechanical.\n" as *u8); sys_exit(0); return 0 }
50 gw(" RED\n" as *u8); sys_exit(1); return 1
51}