code wiki / _hdl_build / nx_ws_board_gate.nx

nx_ws_board_gate.nx

buildroot/runtime/_hdl_build/nx_ws_board_gate.nx

13859 B304 linesdepth 6pulls 9 transitivereach 0 importersview sourcekind gate/prooftopic ws
docsdependenciesstructsconstsfunctions

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

nx_ws_board.nx nx_workstream_store.nx nx_ws_ledger.nx nx_framed_append.nx nx_seg_store.nx nx_syscalls.nx nx_ws_board_gate.nx

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

main sys_now_realtime_sec sys_mmap sys_clock_gettime_real wbg_seed_one wbg_streq_store sys_mmap ↻ ss_get sys_mmap ↻ ss_scan sys_mmap ↻ ss_manifest_dyn ss_manifest_file_dyn ss_scan_seglist ss_len sys_mmap ↻ ss_cat ss_readall ss_r32 wbg_len ss_begin ss_begin_cap sys_mmap ↻ ss_add ss_add2 ss_w32 ss_len ↻ wbg_len ↻ ws_seg_next ss_next_segid sys_mmap ↻ ss_cat ↻ ss_readall ↻ ss_segid_ok ss_commit ss_segid_ok ↻ sys_mmap ↻ ss_cat ↻ ss_catn sys_mmap ↻

structs

none

consts

44const WBG_LOG: *u8 = "knowledge/status/ws_board_gate.log"
45const WBG_PREFIX: *u8 = "knowledge/store/wsboard-"
46const WBG_PREFIX2: *u8 = "knowledge/store/wsboard2-"
47const WBG_RECCAP: i64 = 512

functions

49func wbg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
51func wbg_streq(a: *u8, b: *u8) -> i64
called by 2: wbg_findmain
59func wbg_streq_store(prefix: *u8, key: *u8, val: *u8) -> i64
called by 1: wbg_seed_one calls 3: sys_mmapss_getwbg_len
73func wbg_seed_one(prefix: *u8, key: *u8, val: *u8) -> i64
82func wbg_find(rows: *i64, ecount: i64, name: *u8) -> i64
called by 1: main calls 1: wbg_streq
93func wbg_catn(dst: *u8, off: i64, v: i64) -> i64
called by 2: wbg_tmppathmain calls 1: sys_mmap
103func wbg_cat(dst: *u8, off: i64, s: *u8) -> i64
110func wbg_tmppath(out: *u8, stem: *u8, epoch: i64, pid: i64) -> i64
called by 1: main calls 2: wbg_catwbg_catn
123func wbg_row(name: *u8, pass: i64) -> i64
138func main() -> i64