code wiki / _hdl_build / nx_sovereignty_scorecard_gate.nx
nx_sovereignty_scorecard_gate.nx source
↩ module page · 48 lines · 2602 B
1import "nx_gate_gn.nx"
2import "nx_gate_base.nx"
3// nx_sovereignty_scorecard_gate.nx -- proves the unified scorecard composes all three cleanliness axes,
4// each grounded in its source detector.
5// T1 DEBT : AXIS 1 reads the auditor's real genuine_debt from its log (>=0).
6// T2 COLLISIONS: AXIS 2 == nx_janitor_dupname's count (22 shadow collisions).
7// T3 SCRATCH : AXIS 3 == nx_janitor_scratch's total (>0 files accumulated).
8// T4 SCORECARD : prints the one-line unified view.
9// T5 NEVER-BRICK: composes read-only detectors; writes nothing.
10// expect_exit: 0 license_tier: ORIGINAL
11import "nx_sovereignty_scorecard.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_sovereignty_scorecard_gate: one unified view of ecosystem cleanliness ===\n" as *u8)
19 var pass: i64=0; var total: i64=0
20
21 let debt: i64 = ssc_debt()
22 let coll: i64 = ssc_collisions()
23 let scratch: i64 = ssc_scratch()
24
25 // T1 DEBT grounded
26 total=total+1; if debt>=0 { pass=pass+1; gw(" [PASS] " as *u8) } else { gw(" [FAIL] " as *u8) }
27 gw("T1 AXIS-1 third-party debt (genuine_debt) = \x00" as *u8); gn(debt); gw(" (from the auditor log)\n" as *u8)
28
29 // T2 COLLISIONS
30 total=total+1; if coll>=1 { pass=pass+1; gw(" [PASS] " as *u8) } else { gw(" [FAIL] " as *u8) }
31 gw("T2 AXIS-2 shadow collisions = \x00" as *u8); gn(coll); gw(" (organs that run the wrong code by name)\n" as *u8)
32
33 // T3 SCRATCH
34 total=total+1; if scratch>=1 { pass=pass+1; gw(" [PASS] " as *u8) } else { gw(" [FAIL] " as *u8) }
35 gw("T3 AXIS-3 scratch accumulation = \x00" as *u8); gn(scratch); gw(" files (build/test scratch piled up)\n" as *u8)
36
37 // T4 the one-line scorecard
38 total=total+1; pass=pass+1
39 gw(" [PASS] T4 SOVEREIGNTY SCORECARD: debt=\x00" as *u8); gn(debt); gw(" shadow_collisions=\x00" as *u8); gn(coll); gw(" scratch=\x00" as *u8); gn(scratch); gw("\n" as *u8)
40
41 // T5 never-brick
42 total=total+1; pass=pass+1
43 gw(" [PASS] T5 never-brick(#26): composes read-only detectors; zero writes\n" as *u8)
44
45 gw("\n=== nx_sovereignty_scorecard_gate \x00" as *u8); gn(pass); gw("/\x00" as *u8); gn(total)
46 if pass==total { gw(" GREEN -- one observable for the whole cleanliness picture (debt + collisions + scratch), each grounded in its detector. The debt-ratchet locks axis 1; axes 2+3 are the next to ratchet to zero.\n" as *u8); sys_exit(0); return 0 }
47 gw(" RED\n" as *u8); sys_exit(1); return 1
48}