code wiki / _hdl_build / nx_vsroll.nx
nx_vsroll.nx source
↩ module page · 87 lines · 3829 B
1// nx_vsroll.nx -- roll per-SCOPE comparative claims into a DOMAIN verdict, or refuse.
2//
3// argv: <domain> [roster] [claims]
4//
5// A domain earns a comparative rung only when EVERY scope its roster declares has an admitted
6// nx_vsbest claim; the level is the MIN across them. One missing scope refuses the whole roll and
7// prints exactly which are missing -- that refusal IS the work list.
8//
9// The verdict comes from vr_roll_buf, the SAME function the gate proves. The loop below only
10// renders rows; it never decides. A CLI that recomputed the verdict its own way would be an
11// untested second implementation of the thing that matters.
12// license_tier: ORIGINAL No hw writes (Rule 26).
13import "nx_vsroll_lib.nx"
14
15const VR_ROSTER: *u8 = "knowledge/status/domain_axes.conf"
16const VR_CLAIMS: *u8 = "knowledge/status/vsbest_claims.log"
17
18func main(argc: i64, argv: *i64) -> i64 {
19 if argc < 2 {
20 _p("usage: nx_vsroll <domain> [roster] [claims]\n" as *u8)
21 _p(" rolls per-scope comparative claims into a DOMAIN verdict by MIN, or refuses.\n" as *u8)
22 sys_exit(1)
23 return 1
24 }
25 let domain: *u8 = argv[1] as *u8
26 var roster: *u8 = VR_ROSTER
27 if argc >= 3 { roster = argv[2] as *u8 }
28 var claims: *u8 = VR_CLAIMS
29 if argc >= 4 { claims = argv[3] as *u8 }
30
31 _p("=== NX-VSROLL: does " as *u8); _p(domain); _p(" earn a comparative rung? ===\n" as *u8)
32 let rp: *i64 = sys_mmap(16) as *i64
33 let rb: *u8 = ss_readall(roster, rp)
34 let rn: i64 = rp[0]
35 if rn <= 0 {
36 _p("NX-VSROLL verdict=RED reason=roster-unreadable path=" as *u8); _p(roster); _p("\n" as *u8)
37 sys_exit(2)
38 return 2
39 }
40 let cp: *i64 = sys_mmap(16) as *i64
41 let cb: *u8 = ss_readall(claims, cp)
42 var cn: i64 = cp[0]
43 if cn < 0 { cn = 0 }
44
45 let scope: *u8 = sys_mmap(VR_SCOPE_CAP)
46 var idx: i64 = 0
47 var go: i64 = 1
48 while go == 1 {
49 let l: i64 = vr_scope_at(rb, rn, domain, idx, scope, VR_SCOPE_CAP)
50 if l <= 0 { go = 0 } else {
51 var lv: i64 = 0 - 1
52 if cn > 0 { lv = vr_claim_level(cb, cn, domain, scope) }
53 _p(" " as *u8); _p(scope)
54 var pad: i64 = el_len(scope)
55 while pad < 26 { _p(" " as *u8); pad = pad + 1 }
56 if lv < 0 { _p("UNMEASURED -- no admitted claim\n" as *u8) } else {
57 _p(mat_label(lv)); _p(" (claim admitted)\n" as *u8)
58 }
59 idx = idx + 1
60 }
61 }
62
63 let out: *i64 = sys_mmap(64) as *i64
64 let rc: i64 = vr_roll_buf(domain, rb, rn, cb, cn, out)
65 if rc == VR_NO_ROSTER {
66 _p("\n NO ROSTER for this domain. A domain with no declared axes cannot earn a comparative\n" as *u8)
67 _p(" rung -- there is nothing to be complete WITH. Declare its scopes in " as *u8); _p(roster); _p("\n" as *u8)
68 _p("NX-VSROLL verdict=RED reason=no-roster\n" as *u8)
69 sys_exit(3)
70 return 3
71 }
72 _p("\n scopes required=" as *u8); _fn(1, out[VRO_NREQ])
73 _p(" with an admitted claim=" as *u8); _fn(1, out[VRO_NHAVE]); _p("\n" as *u8)
74 if rc == VR_INCOMPLETE {
75 _p(" REFUSED: " as *u8); _fn(1, out[VRO_NREQ] - out[VRO_NHAVE])
76 _p(" scope(s) UNMEASURED. An unmeasured axis is never the min -- it refuses.\n" as *u8)
77 _p(" Those rows ARE the work list: run each comparison, admit it with nx_vsbest, re-roll.\n" as *u8)
78 _p("NX-VSROLL verdict=RED (domain does NOT earn a comparative rung)\n" as *u8)
79 sys_exit(4)
80 return 4
81 }
82 _p(" COMPLETE. Domain level = MIN across all declared scopes = " as *u8); _p(mat_label(out[VRO_MINLV])); _p("\n" as *u8)
83 _p(" It lifts on its WEAKEST leg, never its loudest.\n" as *u8)
84 _p("NX-VSROLL verdict=GREEN (roster complete; domain level rolled by MIN)\n" as *u8)
85 sys_exit(0)
86 return 0
87}