code wiki / _hdl_build / nx_role_audit.nx

nx_role_audit.nx source

↩ module page · 26 lines · 1414 B

1// nx_role_audit.nx -- the team AUDITS its own roster for MISSED and CONFLATED roles (operator: "it sounds 2// like you missed a bunch of roles like the racing team"). The criterion (the anti-conflation rule applied 3// to the org chart itself): each genuine role owns exactly ONE distinct VERB; a roster is broken if a 4// genuine verb has NO owner (MISSED) or if one role owns TWO distinct verbs (CONFLATED). My v1 roster 5// CONFLATED Racing(COMPETE) into Referee(JUDGE) and MISSED several -- this catches that. license_tier: ORIGINAL 6 7import "nx_syscalls.nx" 8 9// distinct verbs = distinct roles. two roles must not share a verb; one role must not own two. 10func ra_distinct(verb_a: i64, verb_b: i64) -> i64 { if verb_a != verb_b { return 1 } return 0 } 11 12// MISSED: a genuine role whose verb has no distinct owner in the roster. 13func ra_missed_count(present_flags: *i64, n: i64) -> i64 { 14 var c: i64 = 0; var i: i64 = 0 15 while i < n { if present_flags[i] == 0 { c = c + 1 } i = i + 1 } 16 return c 17} 18 19// CONFLATED: a single role assigned two DISTINCT verbs (e.g. Referee owning JUDGE *and* COMPETE). 20func ra_conflation(role_verb1: i64, role_verb2: i64) -> i64 { if role_verb1 != role_verb2 { return 1 } return 0 } 21 22// the roster is CLEAN iff nothing missed AND no conflations. 23func ra_roster_clean(missed: i64, conflations: i64) -> i64 { 24 if missed == 0 { if conflations == 0 { return 1 } } 25 return 0 26}