code wiki / _hdl_build / nx_workstream_audit_gate.nx

nx_workstream_audit_gate.nx

buildroot/runtime/_hdl_build/nx_workstream_audit_gate.nx

12138 B215 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind gate/prooftopic workstream
docsdependenciesstructsconstsfunctions

about

nx_workstream_audit_gate.nx -- THE REFEREE for WMS-R4 (the boot-time completeness/crash audit). Structural twin of nx_workstream_registry_gate: that proves the registry is an internally-complete SSOT; THIS proves the registry is EXTERNALLY complete -- cross-checked against the real filesystem (memory .md + code .nx) and the assignment_queue, so a lost/moved/never-registered workstream is reported LOUDLY (orphan / untracked / unregistered) rather than silently dropped on crash recovery. HERMETIC: the gate seeds its OWN test store (knowledge/store/wsaudit-) with controlled fixtures (NOT production claims) AND builds tiny fixture dirs under knowledge/store/wsaudit_fix/{mem,code}/ so the FS walk runs over CONTROLLED data (a real DATA-driven walk, not one hardcoded branch). Assertions (flat pass-tally, avoids the LM-002 deep-nested-if landmine): T1 clean-store no-orphan : every fixture row's mem/code link resolves -> ws_audit_orphans_p==0 T2 orphan caught : one fixture row's memory_link points at a .md that was NOT created -> orphans>=1 AND that id in orphan_out T3 untracked NEG-CONTROL : a .nx organ dropped in wsaudit_fix/code/ with NO matching code_link in the registry -> ws_audit_untracked_p>=1 AND its basename reported. THE mandatory neg-control: a hidden workstream present in code but absent from the registry is CAUGHT. T4 no-false-positive : a fully-registered fixture organ (its basename IS a code_link) is NOT in untracked_out (proves T3 isn't a constant non-zero). T5 unregistered caught : a hermetic queue fixture row id T-PROSE-ONLY not in the registry -> ws_audit_unregistered_p>=1 with that id reported; a registered id NOT. T6 production roll-up : against the live ws- prefix + real memory/runtime/queue, ws_audit_complete_r4_p runs and PRINTS orphan/untracked/unregistered counts; GREEN-gate invariant = production ORPHANS==0 (the lost-things invariant, using the basename-resolving code check so the path-shifted links nx_geo/nx_drv_proto_emit/nx_root_trace do NOT false-orphan). GREEN only if T1..T6 all hold. Evidence -> knowledge/status/workstream_audit_gate.log. license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_workstream_audit.nx nx_workstream_store.nx nx_seg_store.nx nx_syscalls.nx nx_workstream_audit_gate.nx

imports: nx_workstream_audit.nxnx_workstream_store.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_mkdir wag_write_file sys_openat_wr sys_write wag_len sys_close wag_seed_one wag_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 wag_len ↻ ss_begin ss_begin_cap sys_mmap ↻ ss_add ss_add2 ss_w32 ss_len ↻ wag_len ↻ ws_seg_next ss_next_segid sys_mmap ↻ ss_cat ↻ ss_readall ↻ ss_segid_ok ss_commit ss_segid_ok ↻ sys_mmap ↻

structs

none

consts

34const WAG_LOG: *u8 = "knowledge/status/workstream_audit_gate.log"
35const WSAUDIT_PREFIX: *u8 = "knowledge/store/wsaudit-"
36const FIX_ROOT: *u8 = "knowledge/store/wsaudit_fix"
37const FIX_MEM: *u8 = "knowledge/store/wsaudit_fix/mem/" // ends '/'
38const FIX_CODE: *u8 = "knowledge/store/wsaudit_fix/code/" // ends '/'
39const FIX_QUEUE: *u8 = "knowledge/store/wsaudit_fix/queue.tsv"

functions

41func wag_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 2: wag_rowmain calls 1: sys_write
42func wag_n(fd: i64, v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64=v; if m<0 {m=0-m; sys_write(fd,"-" as *u8,1)}; let t: *u8 = sys_mmap(28); var k: i64=0; if m==0 {t[0]=48 as u8;k=1}; while m>0 {t[k]=(48+(m%10)) as u8; m=m/10; k=k+1}; var i: i64=0; while i<k {bb[i]=t[k-1-i]; i=i+1}; sys_write(fd, bb, k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
43func wag_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
45func wag_streq(a: *u8, b: *u8) -> i64
called by 1: wag_in_list
52func wag_row(fd: i64, name: *u8, pass: i64) -> i64
called by 1: main calls 1: wag_w
59func wag_streq_store(key: *u8, val: *u8) -> i64
called by 1: wag_seed_one calls 3: sys_mmapss_getwag_len
73func wag_seed_one(key: *u8, val: *u8) -> i64
82func wag_write_file(path: *u8, body: *u8) -> i64
91func wag_in_list(out: *i64, cnt: i64, tok: *u8) -> i64
called by 1: main calls 1: wag_streq
97func main() -> i64