nx_board_idref_gate.nx
buildroot/runtime/nx_board_idref_gate.nx
about
nx_board_idref_gate.nx -- THE COMPARE BOARD'S REFERENTIAL INTEGRITY REFEREE (2026-09-04).
WHY THIS EXISTS, AND WHY IT IS A MECHANISM RATHER THAN ANOTHER LAW. On 2026-09-03 a seat appended a rung
as LN37 and four log rows as LN36 and BOTH ids were already taken by another lane the same day. It
journaled the finding, renumbered to LN41/LN42 after grepping for free ids, and wrote the durable remedy
in its own words: "the durable fix is a uniqueness tooth in the compare referee rather than a habit."
By 2026-09-04 LN41 AND LN42 had each collided AGAIN -- the renumbering itself landed on ids a third lane
had taken while it worked. That is the whole argument for this file: GREP-BEFORE-APPEND IS A HABIT, AND
A HABIT LOSES TO CONCURRENCY EVERY TIME. Only something in the path can hold this invariant.
WHAT IT JUDGES. A .plan is a board, and a board's ids are its addresses. Three ways an address goes bad:
DUPID two rung rows share an id, so the ranker, a watch flip and a done-rule all attach to whichever
the reader matches first. Measured live: lang carried one LANDED and one OPEN rung under LN42,
which is the dangerous shape -- the board can report the open work as finished.
DANGLOG a log row is journaled against a rung id no rung row declares, so the worked plan a crashed
session is supposed to inherit points at nothing.
DANGMS a milestone lists a member rung that does not exist, so its cumulative estimate is over a set
the board cannot enumerate.
IT RATCHETS RATHER THAN DEMANDING ZERO, AND THAT IS DELIBERATE. Real offenders already exist that belong
to other lanes, and a detector that is permanently RED is one everyone learns to ignore. The bar is
knowledge/status/board_idref.baseline; the gate goes RED only when the count RISES, and it TIGHTENS the
baseline when the count falls so a fix cannot be undone silently. EVERY OFFENDER IS NAMED IN THE OUTPUT
whatever the verdict, because a count without a worklist is not actionable.
COMPOSES nx_rowparse_lib for pipe-delimited column extraction rather than hand-rolling a fourth copy of
that arithmetic, and gk_* for directory and file access.
license_tier: ORIGINAL. Reads the compare trees, writes only its own baseline. No hw writes (Rule 26).
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.nxnx_gatekit_lib.nxnx_rowparse_lib.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 37 | const BI_FILECAP: i64 = 4194304 |
| 38 | const BI_NAMES: i64 = 262144 |
| 39 | const BI_NAMESTRIDE: i64 = 256 |
| 40 | const BI_MAXFILES: i64 = 512 |
| 41 | const BI_IDCAP: i64 = 32 |
| 42 | const BI_MAXIDS: i64 = 1024 |
| 43 | const BI_PATH: i64 = 1024 |
| 44 | const BI_OUT: i64 = 262144 |
| 45 | const BI_SPAN: i64 = 8 |
| 46 | const BI_BASEMAX: i64 = 64 |
| 47 | const BI_DIR_PRIMARY: *u8 = "buildroot/knowledge/compare/" |
| 48 | const BI_DIR_SECONDARY: *u8 = "knowledge/compare/" |
| 49 | const BI_BASELINE: *u8 = "knowledge/status/board_idref.baseline" |
| 50 | const BI_FLD_KIND: i64 = 0 |
| 51 | const BI_FLD_RUNGID: i64 = 1 |
| 52 | const BI_FLD_LOGID: i64 = 2 |
| 53 | const BI_FLD_MSMEMBERS: i64 = 4 |
| 54 | const BI_COMMA: i64 = 44 |
| 55 | const BI_SPACE: i64 = 32 |
| 56 | const BI_CR: i64 = 13 |
functions
| 60 | func bi_put_id(tab: *u8, n: i64, b: *u8, s: i64, l: i64) -> i64 called by 1: main |
| 69 | func bi_id_at(tab: *u8, i: i64) -> *u8 { return (tab as i64 + i * BI_IDCAP) as *u8 } |
| 75 | func bi_trim(b: *u8) -> i64 called by 1: main |
| 88 | func bi_count(tab: *u8, n: i64, k: i64) -> i64 |
| 97 | func bi_has_id(tab: *u8, n: i64, want: *u8) -> i64 |
| 106 | func bi_first(tab: *u8, k: i64) -> i64 |
| 115 | func main(argc: i64, argv: **u8) -> i64 |