code wiki / _hdl_build / nx_ws_board_gate.nx
nx_ws_board_gate.nx
buildroot/runtime/_hdl_build/nx_ws_board_gate.nx
about
nx_ws_board_gate.nx -- THE REFEREE for WMS rung M2 (the live status board).
Proves nx_ws_board DERIVES the correct per-empire/per-stream view from the WMS-R1
registry, AND that it is NEVER silently wrong -- the four mandatory negative controls
prove the detector can actually SEE failure (no-false-green):
HERMETIC fixtures (controlled, NOT production claims):
prefix wsboard- : ws:empires = E-A,E-B,E-C ; ws:ids = B-1..B-4 ; 4 complete streams
B-1 E-A DONE / B-2 E-A ACTIVE / B-3 E-B BLOCKED / B-4 E-C DONE
prefix wsboard2- : ws:ids lists B2-1 + B2-LOST, but ws:B2-LOST is NEVER committed
(the lost-segment fault, twin of registry-gate T5).
POSITIVE (all must hold for GREEN):
T1 enumerate-exact : wb_board_p(wsboard-, refpath=0) returns empires=3.
T2 per-empire counts EXACT : E-A streams=2 done=1 active=1 blocked=0 ;
E-B streams=1 blocked=1 ; E-C streams=1 done=1.
T3 summary EXACT : total=4 done=2 active=1 blocked=1.
T4 clean-reflog overlay : a /tmp reflog of good ledger_append records (flagged=0)
-> wb_board_p(..., refpath=good) returns >=0 (accepted).
NEGATIVE CONTROLS (a GREEN with no working neg-control is INVALID):
N1 unregistered-absent : ws_get_p(wsboard-, ws:B-NEVER) == WS_UNKNOWN(-1) AND
"B-NEVER" appears in ZERO board empire rows.
N2 torn-reflog REJECTED : a /tmp reflog = good records + one raw line MISSING the
" END" sentinel -> wb_board_p(..., refpath=torn) == -3
(rejected, NOT silently rendered). >=0 => RED.
N3 incomplete-registry REJECTED : wb_board_p(wsboard2-, 0) == -1 (lost segment ->
board refuses). >=0 => RED.
N4 detector-sees-difference : N2's -3 and T4's >=0 are DIFFERENT return values on
contrasting inputs (proves the guard is not a constant).
GREEN only if T1..T4 AND N1..N4 all hold. Evidence rows + verdict go to
knowledge/status/ws_board_gate.log via the MANDATORY fa_appendz one-buffer-one-locked-
write discipline (eat-own-dogfood); fixture /tmp reflogs use epoch+pid-suffixed names
so concurrent gate runs never collide. Exit 0 GREEN / 1 RED.
Sovereign: imports only the WMS stack + nx_syscalls (no gcc). license_tier: ORIGINAL
dependencies 6 imports · 0 importers
imports: nx_ws_board.nxnx_workstream_store.nxnx_ws_ledger.nxnx_framed_append.nxnx_seg_store.nxnx_syscalls.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
| 44 | const WBG_LOG: *u8 = "knowledge/status/ws_board_gate.log" |
| 45 | const WBG_PREFIX: *u8 = "knowledge/store/wsboard-" |
| 46 | const WBG_PREFIX2: *u8 = "knowledge/store/wsboard2-" |
| 47 | const WBG_RECCAP: i64 = 512 |
functions
| 49 | func wbg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 51 | func wbg_streq(a: *u8, b: *u8) -> i64 |
| 59 | func wbg_streq_store(prefix: *u8, key: *u8, val: *u8) -> i64 |
| 73 | func wbg_seed_one(prefix: *u8, key: *u8, val: *u8) -> i64 |
| 82 | func wbg_find(rows: *i64, ecount: i64, name: *u8) -> i64 |
| 93 | func wbg_catn(dst: *u8, off: i64, v: i64) -> i64 |
| 103 | func wbg_cat(dst: *u8, off: i64, s: *u8) -> i64 |
| 110 | func wbg_tmppath(out: *u8, stem: *u8, epoch: i64, pid: i64) -> i64 |
| 123 | func wbg_row(name: *u8, pass: i64) -> i64 |
| 138 | func main() -> i64 |