code wiki / _hdl_build / nx_ws_board_live_gate.nx
nx_ws_board_live_gate.nx
buildroot/runtime/_hdl_build/nx_ws_board_live_gate.nx
about
nx_ws_board_live_gate.nx -- THE REFEREE for the M2 board's LIVE-STREAM upgrade:
(a) the retired 512 enumeration cap, and (b) FRESH liveness (active=alive-NOW, not a
one-time ACTIVE stamp). Operator law for this rung: "the 2 is not a one-time thing
like energy -- the data must be fresh and alive." This gate proves the board honors it.
HERMETIC fixtures (controlled, NOT production claims):
prefix wsblive- : ws:empires=E-LIVE ; 5 named streams with KNOWN last_touched, so an
INJECTED now/window makes each verdict deterministic (no wall-clock):
FRESH-A ACTIVE lt=1000 -> @now=1010,win=60 age=10 -> ALIVE
STALE-A ACTIVE lt=100 -> @now=1010,win=60 age=910 -> STALLED
UNK-A ACTIVE lt=0 -> no activity -> UNKNOWN
HB-A ACTIVE lt=100 BUT a fresh heartbeat beat @1000 -> ALIVE (live channel wins)
BLK-A BLOCKED lt=1000 -> @now=1010,win=60 age=10 -> ALIVE
+ config key ws:cfg:fresh_window_sec=123 (proves the window is DATA, not baked).
prefix wsbcap- : 600 complete DONE streams in ONE empire -- > the old 512 cap.
POSITIVE (all must hold):
T1 named-count==5 T2 FRESH-A=ALIVE T3 STALE-A=STALLED
T4 UNK-A=UNKNOWN T5 HB-A=ALIVE (heartbeat overrides a stale last_touched)
T6 summary EXACT (active=4 alive=2 stalled=1 unknown=1 ; blocked=1 alive=1)
T7 cap-gone: wb_board_p(wsbcap-) total==600 (the 512 cap would have truncated)
T8 config: wb_cfg_int reads 123 from the store, returns the floor 999 when absent
NEGATIVE CONTROLS (a GREEN with no working neg-control is INVALID):
N1 threshold-is-REAL : re-run @win=2000 -> STALE-A flips ALIVE AND a_stalled==0
(proves the window is a live parameter, not a magic number).
N2 stale-active-NOT-counted-alive : @win=60, a_stalled>=1 AND a_alive < active_total
(the literal "an ACTIVE label alone is not 'alive'" control).
N3 detector-sees-diff : a_stalled differs across the two windows (1 vs 0).
GREEN only if T1..T8 AND N1..N3 all hold. Evidence rows + verdict -> knowledge/status/
ws_board_live_gate.log via the MANDATORY fa_appendz one-buffer-one-locked-write. Exit
0 GREEN / 1 RED. Sovereign: imports only the WMS/heartbeat stack + nx_syscalls (no gcc).
license_tier: ORIGINAL
dependencies 6 imports · 0 importers
imports: nx_ws_board.nxnx_workstream_store.nxnx_heartbeat_str.nxnx_seg_store.nxnx_framed_append.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
| 42 | const WBLG_LOG: *u8 = "knowledge/status/ws_board_live_gate.log" |
| 43 | const WBLG_LIVE: *u8 = "knowledge/store/wsblive-" |
| 44 | const WBLG_CAP: *u8 = "knowledge/store/wsbcap-" |
| 45 | const WBLG_RECCAP: i64 = 512 |
| 46 | const WBLG_NCAP: i64 = 600 // cap-fixture size: deliberately > the retired 512 cap |
functions
| 48 | func wblg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 50 | func wblg_streq(a: *u8, b: *u8) -> i64 called by 1: wblg_find |
| 57 | func wblg_cat(dst: *u8, off: i64, s: *u8) -> i64 |
| 62 | func wblg_catn(dst: *u8, off: i64, v: i64) -> i64 |
| 74 | func wblg_streq_store(prefix: *u8, key: *u8, val: *u8) -> i64 |
| 86 | func wblg_seed_one(prefix: *u8, key: *u8, val: *u8) -> i64 |
| 97 | func wblg_seed_cap(prefix: *u8, n: i64) -> i64 |
| 135 | func wblg_find(streams: *i64, n: i64, id: *u8) -> i64 |
| 146 | func wblg_tmppath(out: *u8, stem: *u8, epoch: i64, pid: i64) -> i64 |
| 158 | func wblg_row(name: *u8, pass: i64) -> i64 |
| 172 | func main() -> i64 |