nx_accept_lib.nx
buildroot/runtime/nx_accept_lib.nx
about
nx_accept_lib.nx -- THE THREE-PARTY ACCEPTANCE LEDGER: the decision core behind every ACCEPTANCE cell on
/compare (2026-08-30). Operator standing order, verbatim: "doing it poorly isn't a complete and needs to be
shown as that on /compare and your work; it's not complete till you and I and the nishi team agree."
A subject is ACCEPTED iff ALL THREE signatures hold, each read from its own sovereign plane:
1. OPERATOR -- knowledge/store/accept- : the LATEST row whose actor is `operator` and whose targets field
carries the token ga_accept_<subject> says ACCEPT (REJECT, UNJUDGED, absent do not).
2. REFEREE -- knowledge/store/referee- : the LATEST row for <subject> says composite GOOD AND its percept is
at or above floor_percept_<tier> READ FROM knowledge/cjc_panel.conf (never a literal here), its
tier is in the panel receipt's tiers_admitted list, and that receipt says admitted=1. The row's
own word GOOD is necessary and NOT sufficient: the floor is re-derived so a row cannot lie.
3. SEAT -- knowledge/store/attest- : a row for <subject> naming the shipping seat and its stamp.
Anything less is INCOMPLETE, and INCOMPLETE names WHICH signature is missing and WHY.
HOW THE BOARD FLIPS. `nx_accept emit` regenerates buildroot/runtime/nx_accept_decl.nx from the planes: one
top-level declaration ga_accept_<subject> per ACCEPTED subject and NOTHING for any other. The /compare regen
measures that file exactly as it measures every organ (nx_symdecl_lib: a column-0 declaration), so an
ACCEPTANCE watch row lands only when the three-party rule holds. A hand-written declaration is a lie: the next
emit erases it and nx_accept_gate convicts it (re-derivation must equal the bytes on disk).
JOIN RULE, stated once: a plane row GOVERNS subject X iff its targets field carries the token ga_accept_X, bare
or domain-qualified (gameengine:ga_accept_X). The subject key IS the suffix of the acceptance symbol, so the
board and the ledger cannot name the same thing two ways. Rows with no such token are counted UNMAPPED and
printed, never silently dropped.
LIB+PROGRAM SPLIT ON PURPOSE: every rule is a function of caller-supplied plane prefixes, conf path and buffers,
so nx_accept_gate drives the SAME code over fixture planes under /tmp and never the production planes.
COMPOSES, NEVER RE-IMPLEMENTS: nx_seg_store's sequential cursor (plane iteration; ss_get point lookups are the
documented quadratic read), nx_comparewatch_lib (tab-field parsing + strict q:<n> keys), nx_lineconf_lib
(line-anchored key=value), nx_estate_path (CWD-independent artifact paths).
HONEST LIMIT: the actor column is caller-supplied. This ledger buys ATTRIBUTION and TAMPER-EVIDENCE through the
plane's own hist- provenance, not cryptographic proof of who the operator is; the signed-row rung (nx_evattest,
role=human key) is the named next step, not a claim made here.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 6 imports · 5 importers
imports: nx_syscalls.nxnx_seg_store.nxnx_comparewatch_lib.nxnx_lineconf_lib.nxnx_estate_path.nxnx_store_seed_lib.nx
imported by: nx_accept.nxnx_accept_candidate_t230.nxnx_accept_gate.nxnx_accept_ref_lib.nxnx_release_delta_lib.nx
structs
| none |
consts
| 43 | const AL_PFX_ACCEPT: *u8 = "knowledge/store/accept-" |
| 44 | const AL_PFX_REFEREE: *u8 = "knowledge/store/referee-" |
| 45 | const AL_PFX_ATTEST: *u8 = "knowledge/store/attest-" |
| 46 | const AL_PANEL_CONF: *u8 = "knowledge/cjc_panel.conf" |
| 47 | const AL_DECL_PATH: *u8 = "buildroot/runtime/nx_accept_decl.nx" |
| 48 | const AL_DECL_SIBLING: *u8 = "buildroot/runtime/nx_accept_lib.nx" |
| 49 | const AL_DECL_BASENAME: *u8 = "nx_accept_decl.nx" |
| 50 | const AL_DECL_ROW: *u8 = "runtime/nx_accept_decl.nx" |
| 51 | const AL_BOARDS_DIR: *u8 = "buildroot/knowledge/compare" |
| 52 | const AL_BOARDS_DIR_FROM_BUILDROOT: *u8 = "knowledge/compare" |
| 53 | const AL_SYM_PFX: *u8 = "ga_accept_" |
| 54 | const AL_WATCH_PFX: *u8 = "_ABSENT_:" |
| 55 | const AL_MATRIX_SFX: *u8 = ".matrix" |
| 56 | const AL_ACTOR_OPERATOR: *u8 = "operator" |
| 57 | const AL_KEY_RECEIPT: *u8 = "receipt" |
| 58 | const AL_KEY_ADMITTED: *u8 = "admitted" |
| 59 | const AL_KEY_TIERS_ADMITTED: *u8 = "tiers_admitted" |
| 60 | const AL_KEY_TIERS: *u8 = "tiers" |
| 61 | const AL_KEY_FLOOR_PFX: *u8 = "floor_percept_" |
| 62 | const AL_TMP_SFX: *u8 = ".tmp" |
| 65 | const AL_TAB: i64 = 9 |
| 66 | const AL_NL: i64 = 10 |
| 67 | const AL_CR: i64 = 13 |
| 68 | const AL_SPACE: i64 = 32 |
| 69 | const AL_BANG: i64 = 33 |
| 70 | const AL_HASH: i64 = 35 |
| 71 | const AL_COMMA: i64 = 44 |
| 72 | const AL_MINUS: i64 = 45 |
| 73 | const AL_DOT: i64 = 46 |
| 74 | const AL_SLASH: i64 = 47 |
| 75 | const AL_D0: i64 = 48 |
| 76 | const AL_D9: i64 = 57 |
| 77 | const AL_COLON: i64 = 58 |
| 78 | const AL_AT: i64 = 64 |
| 79 | const AL_LOWA: i64 = 97 |
| 80 | const AL_LOWZ: i64 = 122 |
| 81 | const AL_USCORE: i64 = 95 |
| 82 | const AL_PIPE: i64 = 124 |
| 83 | const AL_BASE10: i64 = 10 |
| 84 | const AL_KIND_TOMB: i64 = 2 // seg-store record kind 2 = tombstone (nx_seg_store contract) |
| 87 | const AL_MAX_SUBJ: i64 = 64 |
| 88 | const AL_MAX_TOK: i64 = 16 |
| 89 | const AL_MAX_WATCH: i64 = 64 |
| 90 | const AL_NAMEW: i64 = 64 |
| 91 | const AL_ORGW: i64 = 128 |
| 92 | const AL_REC: i64 = 512 |
| 93 | const AL_NUMCAP: i64 = 32 |
| 94 | const AL_PATHCAP: i64 = 1024 |
| 95 | const AL_LISTCAP: i64 = 256 |
| 96 | const AL_KEYCAP: i64 = 128 |
| 97 | const AL_DENTCAP: i64 = 65536 |
| 98 | const AL_DECL_CAP: i64 = 65536 |
| 99 | const AL_LINE_MAX: i64 = 1024 |
| 100 | const AL_DATECAP: i64 = 16 |
| 101 | const AL_SC_WORDS: i64 = 8 |
| 104 | const AL_F_NAME: i64 = 0 |
| 105 | const AL_W_NAME: i64 = 64 |
| 106 | const AL_F_OPID: i64 = 64 |
| 107 | const AL_W_OPID: i64 = 96 |
| 108 | const AL_F_OPDATE: i64 = 160 |
| 109 | const AL_W_DATE: i64 = 16 |
| 110 | const AL_F_OPACTOR: i64 = 176 |
| 111 | const AL_W_ACTOR: i64 = 32 |
| 112 | const AL_F_RTIER: i64 = 208 |
| 113 | const AL_W_TIER: i64 = 16 |
| 114 | const AL_F_RSHA: i64 = 224 |
| 115 | const AL_W_SHA: i64 = 72 |
| 116 | const AL_F_RSEAT: i64 = 296 |
| 117 | const AL_W_SEAT: i64 = 32 |
| 118 | const AL_F_RDATE: i64 = 328 |
| 119 | const AL_F_ASEAT: i64 = 344 |
| 120 | const AL_F_ASTAMP: i64 = 376 |
| 121 | const AL_W_STAMP: i64 = 64 |
| 122 | const AL_F_ADATE: i64 = 440 |
| 125 | const AL_IW: i64 = 16 |
| 126 | const AL_I_OPV: i64 = 0 // operator verdict code (actor == operator rows only) |
| 127 | const AL_I_ANYV: i64 = 1 // latest verdict of ANY actor (informational) |
| 128 | const AL_I_RCOMP: i64 = 2 // referee composite code |
| 129 | const AL_I_RPERCEPT: i64 = 3 |
| 130 | const AL_I_ATT: i64 = 4 // 1 = a usable attestation row exists |
| 131 | const AL_I_OPSEEN: i64 = 5 |
| 132 | const AL_I_RSEEN: i64 = 6 |
| 133 | const AL_I_ASEEN: i64 = 7 |
| 136 | const AL_BK_WORDS: i64 = 32 |
| 137 | const AL_B_N: i64 = 0 |
| 138 | const AL_B_INTS: i64 = 1 |
| 139 | const AL_B_STRS: i64 = 2 |
| 140 | const AL_B_OVERFLOW: i64 = 3 |
| 141 | const AL_B_ACC_ROWS: i64 = 4 |
| 142 | const AL_B_REF_ROWS: i64 = 5 |
| 143 | const AL_B_ATT_ROWS: i64 = 6 |
| 144 | const AL_B_UNMAPPED: i64 = 7 |
| 145 | const AL_B_MALFORMED: i64 = 8 |
| 146 | const AL_B_ACC_PLANE: i64 = 9 |
| 147 | const AL_B_REF_PLANE: i64 = 10 |
| 148 | const AL_B_ATT_PLANE: i64 = 11 |
| 149 | const AL_B_TOMB: i64 = 12 |
| 150 | const AL_B_FOREIGN: i64 = 13 |
| 151 | const AL_B_BADNAME: i64 = 14 |
| 152 | const AL_B_ACC_PATH: i64 = 16 |
| 153 | const AL_B_REF_PATH: i64 = 17 |
| 154 | const AL_B_ATT_PATH: i64 = 18 |
| 157 | const AL_AF_ID: i64 = 0 |
| 158 | const AL_AF_VERDICT: i64 = 2 |
| 159 | const AL_AF_DATE: i64 = 3 |
| 160 | const AL_AF_ACTOR: i64 = 4 |
| 161 | const AL_AF_TARGETS: i64 = 6 |
| 163 | const AL_RF_SUBJECT: i64 = 1 |
| 164 | const AL_RF_SHA: i64 = 2 |
| 165 | const AL_RF_COMP: i64 = 3 |
| 166 | const AL_RF_PERCEPT: i64 = 4 |
| 167 | const AL_RF_TIER: i64 = 5 |
| 168 | const AL_RF_DATE: i64 = 6 |
| 169 | const AL_RF_SEAT: i64 = 7 |
| 171 | const AL_TF_SUBJECT: i64 = 1 |
| 172 | const AL_TF_SEAT: i64 = 2 |
| 173 | const AL_TF_STAMP: i64 = 3 |
| 174 | const AL_TF_DATE: i64 = 5 |
| 177 | const AL_V_NONE: i64 = 0 |
| 178 | const AL_V_ACCEPT: i64 = 1 |
| 179 | const AL_V_REJECT: i64 = 2 |
| 180 | const AL_V_UNJUDGED: i64 = 3 |
| 181 | const AL_V_INVALID: i64 = 4 |
| 182 | const AL_R_NONE: i64 = 0 |
| 183 | const AL_R_GOOD: i64 = 1 |
| 184 | const AL_R_BAD: i64 = 2 |
| 185 | const AL_R_INVALID: i64 = 3 |
| 186 | const AL_RC_OK: i64 = 0 |
| 187 | const AL_RC_MISSING: i64 = 1 |
| 188 | const AL_RC_BAD: i64 = 2 |
| 189 | const AL_RC_INVALID: i64 = 3 |
| 190 | const AL_RC_TIER_UNADMITTED: i64 = 4 |
| 191 | const AL_RC_NO_FLOOR: i64 = 5 |
| 192 | const AL_RC_BELOW_FLOOR: i64 = 6 |
| 193 | const AL_RC_PANEL_UNADMITTED: i64 = 7 |
| 194 | const AL_ST_UNKNOWN: i64 = 0 |
| 195 | const AL_ST_ACCEPTED: i64 = 1 |
| 196 | const AL_ST_INCOMPLETE: i64 = 2 |
| 197 | const AL_DV_IDENTICAL: i64 = 0 |
| 198 | const AL_DV_DIFFERS: i64 = 1 |
| 199 | const AL_DV_ABSENT: i64 = 2 |
| 200 | const AL_DV_CAP: i64 = 3 |
| 202 | const AL_WHY_OP: i64 = 0 |
| 203 | const AL_WHY_REF: i64 = 1 |
| 204 | const AL_WHY_ATT: i64 = 2 |
| 205 | const AL_WHY_FLOOR: i64 = 3 |
| 206 | const AL_WHY_WORDS: i64 = 4 |
| 209 | const AL_CF_WORDS: i64 = 16 |
| 210 | const AL_C_BUF: i64 = 0 |
| 211 | const AL_C_LEN: i64 = 1 |
| 212 | const AL_C_ADMITTED: i64 = 2 |
| 213 | const AL_C_TADM: i64 = 3 |
| 214 | const AL_C_TIERS: i64 = 4 |
| 215 | const AL_C_CONF_OK: i64 = 5 |
| 216 | const AL_C_RCPT_OK: i64 = 6 |
| 217 | const AL_C_PATH: i64 = 7 |
| 218 | const AL_C_RPATH: i64 = 8 |
| 221 | const AL_SEC_PER_DAY: i64 = 86400 |
| 222 | const AL_EPOCH_SHIFT_DAYS: i64 = 719468 |
| 223 | const AL_DAYS_PER_ERA: i64 = 146097 |
| 224 | const AL_YEARS_PER_ERA: i64 = 400 |
| 225 | const AL_DAYS_4Y: i64 = 1460 |
| 226 | const AL_DAYS_100Y: i64 = 36524 |
| 227 | const AL_DAYS_400Y_LESS1: i64 = 146096 |
| 228 | const AL_DAYS_YEAR: i64 = 365 |
| 229 | const AL_LEAP_4: i64 = 4 |
| 230 | const AL_LEAP_100: i64 = 100 |
| 231 | const AL_MP_MUL: i64 = 5 |
| 232 | const AL_MP_ADD: i64 = 2 |
| 233 | const AL_MP_DIV: i64 = 153 |
| 234 | const AL_MONTH_WRAP: i64 = 10 |
| 235 | const AL_MONTH_ADD: i64 = 3 |
| 236 | const AL_MONTH_SUB: i64 = 9 |
| 237 | const AL_FEB: i64 = 2 |
| 238 | const AL_TWO_DIGITS: i64 = 10 |
| 503 | const AL_RS_WORDS: i64 = 4 |
| 504 | const AL_RS_BUF: i64 = 0 |
| 505 | const AL_RS_LEN: i64 = 1 |
| 506 | const AL_RS_POS: i64 = 2 |
functions
| 241 | func al_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 242 | func al_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var p: i64 = o; while s[i] != (0 as u8) { d[p] = s[i]; p = p + 1; i = i + 1 } return p } |
| 243 | func al_catsl(d: *u8, o: i64, s: *u8, so: i64, n: i64) -> i64 { var i: i64 = 0; var p: i64 = o; while i < n { d[p] = s[so + i]; p = p + 1; i = i + 1 } return p } |
| 244 | func al_catn(d: *u8, o: i64, v: i64) -> i64 |
| 256 | func al_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 } |
| 257 | func al_strcmp(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return (a[i] as i64) - (b[i] as i64) } i = i + 1 } return 0 - (b[i] as i64) } |
| 258 | func al_starts(s: *u8, p: *u8) -> i64 { var i: i64 = 0; while p[i] != (0 as u8) { if s[i] != p[i] { return 0 } i = i + 1 } return 1 } |
| 259 | func al_ends(s: *u8, sfx: *u8) -> i64 |
| 268 | func al_ident_char(c: i64) -> i64 |
| 274 | func al_ident_ok(s: *u8, so: i64, n: i64) -> i64 called by 9: acm_attestacm_refereeacm_attestacm_refereeal_targets_subjectsal_walk_referee+3 calls 1: al_ident_char |
| 284 | func al_setf(rec: *u8, off: i64, w: i64, src: *u8, so: i64, n: i64) -> i64 |
| 293 | func al_parse_int(v: *u8, o: i64, l: i64, ok: *i64) -> i64 |
| 315 | func al_list_has(list: *u8, tok: *u8) -> i64 |
| 340 | func al_civil_date(epoch_s: i64, out: *u8) -> i64 |
| 367 | func al_bk_new() -> *i64 |
| 378 | func al_bk_rec(bk: *i64, i: i64) -> *u8 { return (bk[AL_B_STRS] + i * AL_REC) as *u8 } |
| 379 | func al_bk_ints(bk: *i64, i: i64) -> *i64 { return (bk[AL_B_INTS] + i * AL_IW * 8) as *i64 } |
| 380 | func al_bk_name(bk: *i64, i: i64) -> *u8 { return (bk[AL_B_STRS] + i * AL_REC + AL_F_NAME) as *u8 } |
| 381 | func al_bk_find(bk: *i64, name: *u8, so: i64, n: i64) -> i64 |
| 390 | func al_bk_find_z(bk: *i64, z: *u8) -> i64 { return al_bk_find(bk, z, 0, al_slen(z)) } |
| 392 | func al_bk_get(bk: *i64, name: *u8, so: i64, n: i64) -> i64 |
| 410 | func al_targets_subjects(bk: *i64, v: *u8, o: i64, l: i64, idx: *i64, cap: i64) -> i64 called by 3: al_has_tokenal_walk_acceptacr_unmapped calls 4: al_slenal_ident_charal_ident_okal_bk_get |
| 447 | func al_has_token(targets: *u8, subject: *u8) -> i64 |
| 458 | func al_plane_resolve(rel: *u8, out: *u8) -> i64 |
| 476 | func al_next(bk: *i64, pfx: *u8, cur: *i64, sc: *i64) -> i64 |
| 507 | func al_rows_open(pfx: *u8) -> *i64 |
| 519 | func al_rows_next(rs: *i64, sc: *i64) -> i64 |
| 540 | func al_walk_accept(bk: *i64, pfx: *u8) -> i64 called by 1: al_load calls 9: al_rows_opensys_mmapal_rows_nextcw_fieldal_targets_subjectscw_field_eq+3 |
| 582 | func al_walk_referee(bk: *i64, pfx: *u8) -> i64 |
| 620 | func al_walk_attest(bk: *i64, pfx: *u8) -> i64 |
| 650 | func al_load(bk: *i64, pfx_acc: *u8, pfx_ref: *u8, pfx_att: *u8) -> i64 called by 3: acm_openacm_openacg_book calls 4: al_plane_resolveal_walk_acceptal_walk_refereeal_walk_attest |
| 662 | func al_conf_load(conf_rel: *u8) -> *i64 |
| 699 | func al_floor_for_tier(cf: *i64, tier: *u8) -> i64 |
| 709 | func al_ref_check(bk: *i64, cf: *i64, si: i64, floor_out: *i64) -> i64 |
| 727 | func al_state(bk: *i64, cf: *i64, si: i64, why: *i64) -> i64 |
| 737 | func al_vname(c: i64) -> *u8 called by 1: acr_status_line |
| 744 | func al_rname(c: i64) -> *u8 |
| 750 | func al_rcname(c: i64) -> *u8 called by 1: acr_status_line |
| 760 | func al_stname(c: i64) -> *u8 |
| 770 | func al_emit_buf(bk: *i64, cf: *i64, out: *u8, cap: i64) -> i64 called by 4: acm_emitacm_emitmainal_decl_verify calls 6: al_catsys_mmapal_stateal_strcmpal_bk_nameal_catn |
| 846 | func al_count_accepted(bk: *i64, cf: *i64) -> i64 |
| 854 | func al_decl_verify(bk: *i64, cf: *i64, path: *u8) -> i64 |
| 866 | func al_dvname(c: i64) -> *u8 |
| 873 | func al_write_atomic(path: *u8, buf: *u8, n: i64) -> i64 |
| 892 | func al_count_decls(b: *u8, n: i64) -> i64 |
| 915 | func al_decl_path(out: *u8) -> i64 |
| 925 | func al_boards_dir(out: *u8) -> i64 |
| 937 | func al_scan_one_board(dir: *u8, nm: *u8, subj: *u8, doms: *u8, orgs: *u8, cap: i64, count0: i64, over: *i64) -> i64 |
| 1010 | func al_scan_boards(dir: *u8, subj: *u8, doms: *u8, orgs: *u8, cap: i64, over: *i64) -> i64 |