code wiki / _hdl_build / nx_raci_audit.nx

nx_raci_audit.nx source

↩ module page · 95 lines · 4898 B

1// nx_raci_audit.nx -- FULL TEAM RACI AUDIT (operator: "did you make sure all the raci makes sense and 2// is correctly partitioned?"). Not a claim -- a checkable partition. Every team ROLE is bound to ONE 3// distinct VERB (the work it owns); the audit proves no two roles share a verb (clean partition), the 4// known conflations are caught, every role is present, and the build pipeline keeps separation of 5// duties. Composes nx_role_audit (ra_distinct / ra_conflation / ra_roster_clean) + nx_build_raci 6// (br_separation_ok / br_roles_correct). LAWS: struct-free, integer-only. license_tier: ORIGINAL 7import "nx_role_audit.nx" 8import "nx_build_raci.nx" 9import "nx_syscalls.nx" 10 11// ---- the canonical role -> VERB table (each verb a distinct id = the work that role OWNS) ---- 12const RA_N_ROLES: i64 = 10 13const V_AUTHOR: i64 = 1 // BUILDER -- writes the module 14const V_TEST: i64 = 2 // ENGINEER -- verifies/tests it (the gate) (NOT the Doctor) 15const V_HEAL: i64 = 3 // DOCTOR -- fixes it when the test fails (NOT the Engineer) 16const V_RESEARCH: i64 = 4 // RESEARCHER-- gathers + corroborates evidence 17const V_SCORE: i64 = 5 // REFEREE -- objective scoring, no self-grade 18const V_PLAN: i64 = 6 // PM -- turns research into ranked assignments 19const V_ADMIT: i64 = 7 // COUNCIL -- the single Accountable; admits the proven cap 20const V_REGISTER: i64 = 8 // LIBRARIAN -- writes the registry entry 21const V_DOCUMENT: i64 = 9 // SCRIBE -- documents (catalog row) 22const V_GOVERN: i64 = 10 // WARDEN -- orchestrates / paces (governor, loop, polite-crawl) 23 24// fill out[0..RA_N_ROLES) with the role verbs in role order 25func raa_verbs(out: *i64) -> i64 { 26 out[0]=V_AUTHOR; out[1]=V_TEST; out[2]=V_HEAL; out[3]=V_RESEARCH; out[4]=V_SCORE 27 out[5]=V_PLAN; out[6]=V_ADMIT; out[7]=V_REGISTER; out[8]=V_DOCUMENT; out[9]=V_GOVERN 28 return RA_N_ROLES 29} 30 31// PARTITION CHECK: are all role verbs pairwise DISTINCT? (no two roles doing the same job) 32// returns the number of CONFLATING pairs (0 = clean partition). 33func raa_conflating_pairs(verbs: *i64, n: i64) -> i64 { 34 var c: i64 = 0 35 var i: i64 = 0 36 while i < n { 37 var j: i64 = i + 1 38 while j < n { 39 if ra_distinct(verbs[i], verbs[j]) == 0 { c = c + 1 } 40 j = j + 1 41 } 42 i = i + 1 43 } 44 return c 45} 46 47// every role present? (no missing role in the roster) 48func raa_all_present(present_flags: *i64, n: i64) -> i64 { 49 if ra_missed_count(present_flags, n) == 0 { return 1 } 50 return 0 51} 52 53// the OVERALL verdict: partition clean iff (a) all verbs distinct, (b) every role present, 54// (c) the build pipeline keeps separation (author!=tester!=healer) AND roles-correct 55// (tester==Engineer's V_TEST, healer==Doctor's V_HEAL). 56func raa_partition_clean(verbs: *i64, present: *i64, n: i64) -> i64 { 57 if raa_conflating_pairs(verbs, n) != 0 { return 0 } 58 if raa_all_present(present, n) == 0 { return 0 } 59 if br_separation_ok(V_AUTHOR, V_TEST, V_HEAL) == 0 { return 0 } 60 // tester must be the Engineer (V_TEST), healer the Doctor (V_HEAL) -- the exact blur we fixed 61 if br_roles_correct(BR_ENGINEER, BR_DOCTOR) == 0 { return 0 } 62 return 1 63} 64 65func raa_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 66func raa_wn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m} 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(1,bb,k); return 0 } 67 68func raa_role_name(i: i64) -> *u8 { 69 if i == 0 { return "BUILDER -> AUTHOR" as *u8 } 70 if i == 1 { return "ENGINEER -> TEST/VERIFY" as *u8 } 71 if i == 2 { return "DOCTOR -> HEAL/FIX" as *u8 } 72 if i == 3 { return "RESEARCHER-> RESEARCH" as *u8 } 73 if i == 4 { return "REFEREE -> SCORE (no self-grade)" as *u8 } 74 if i == 5 { return "PM -> PLAN/ASSIGN" as *u8 } 75 if i == 6 { return "COUNCIL -> ADMIT (Accountable)" as *u8 } 76 if i == 7 { return "LIBRARIAN -> REGISTER" as *u8 } 77 if i == 8 { return "SCRIBE -> DOCUMENT" as *u8 } 78 return "WARDEN -> GOVERN/ORCHESTRATE" as *u8 79} 80 81// emit the audit table (the deliverable the operator reviews) 82func raa_report(verbs: *i64, present: *i64, n: i64) -> i64 { 83 raa_w("=== FULL TEAM RACI AUDIT (role -> verb, partition) ===\n" as *u8) 84 var i: i64 = 0 85 while i < n { 86 raa_w(" ") ; raa_w(raa_role_name(i)) 87 if present[i] != 1 { raa_w(" [MISSING]") } 88 raa_w("\n" as *u8) 89 i = i + 1 90 } 91 raa_w(" conflating-pairs=" as *u8); raa_wn(raa_conflating_pairs(verbs, n)) 92 raa_w(" all-present=" as *u8); raa_wn(raa_all_present(present, n)) 93 raa_w(" partition-clean=" as *u8); raa_wn(raa_partition_clean(verbs, present, n)); raa_w(" (1=clean)\n" as *u8) 94 return 0 95}