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

14098 B309 linesdepth 6pulls 9 transitivereach 0 importersview sourcekind gate/prooftopic ws
docsdependenciesstructsconstsfunctions

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

nx_ws_board.nx nx_workstream_store.nx nx_heartbeat_str.nx nx_seg_store.nx nx_framed_append.nx nx_syscalls.nx nx_ws_board_live_gate.nx

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

main sys_now_realtime_sec sys_mmap sys_clock_gettime_real wblg_seed_one wblg_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 wblg_len ss_begin ss_begin_cap sys_mmap ↻ ss_add ss_add2 ss_w32 ss_len ↻ wblg_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

42const WBLG_LOG: *u8 = "knowledge/status/ws_board_live_gate.log"
43const WBLG_LIVE: *u8 = "knowledge/store/wsblive-"
44const WBLG_CAP: *u8 = "knowledge/store/wsbcap-"
45const WBLG_RECCAP: i64 = 512
46const WBLG_NCAP: i64 = 600 // cap-fixture size: deliberately > the retired 512 cap

functions

48func wblg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
50func wblg_streq(a: *u8, b: *u8) -> i64
called by 1: wblg_find
57func wblg_cat(dst: *u8, off: i64, s: *u8) -> i64
62func wblg_catn(dst: *u8, off: i64, v: i64) -> i64
74func wblg_streq_store(prefix: *u8, key: *u8, val: *u8) -> i64
86func wblg_seed_one(prefix: *u8, key: *u8, val: *u8) -> i64
97func wblg_seed_cap(prefix: *u8, n: i64) -> i64
135func wblg_find(streams: *i64, n: i64, id: *u8) -> i64
called by 1: main calls 1: wblg_streq
146func wblg_tmppath(out: *u8, stem: *u8, epoch: i64, pid: i64) -> i64
called by 1: main calls 2: wblg_catwblg_catn
158func wblg_row(name: *u8, pass: i64) -> i64
172func main() -> i64