code wiki / _hdl_build / nx_sheriff.nx
nx_sheriff.nx
buildroot/runtime/_hdl_build/nx_sheriff.nx
about
nx_sheriff.nx -- THE UAT/ACCEPTANCE SHERIFF (operator 2026-07-19: "workstreams say complete
and in compare there are massive gaps... a sheriff or guard as part of the pm/team capabilities
to make sure the work is truly user accepted"). DONE-ness is DERIVED FROM EVIDENCE, never
asserted (the same law as the conductor's phase derivation) -- applied to CLAIMED-COMPLETE work:
1) every /compare registry domain: coverage score vs the acceptance floor; a sub-floor domain
WITHOUT filed frontier rungs on its published surface = REJECTED-UNFILED-GAP (the
less-than-SOTA-is-never-design law, mechanized); WITH filed rungs = ACCEPTED-FILED-CLIMB
(the climb is the design).
2) every ws_sync DONE frame: open debt rows whose scope matches the ws = lane-local unfinished
work declared over = REJECTED-DONE-OVER-DEBT (scope-match-only, NOT the global sev floor,
so the verdict names the lane's OWN mess, not the tree's).
Rejections emit ready-to-file debt rows (proposed_debts) for nx_store_put -- the R2a scoped
debt gate then mechanically blocks new WORK in that lane until the last mile lands.
READ-ONLY organ: it proposes, never writes (provenance stays with the filer). Fail-closed:
unreadable registry = exit 1; unreadable debt store = REJECTED verdict, never a silent accept.
Envelope DECLARED in every output (scale law: no silent windowing/capping).
nx_sheriff seed [uatprefix] (CONFIG rows, idempotent)
nx_sheriff audit [registry] [journal] [debtprefix] [uatprefix] (JSON verdicts)
nx_sheriff page [registry] [journal] [debtprefix] [uatprefix] (HTML board)
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_store_seed_lib.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
| 24 | const SHF_MAGIC_4096: i64 = 4096 |
| 26 | const SHF_CAP: i64 = 1048576 |
| 27 | const SHF_SPAN: i64 = 16 |
| 28 | const SHF_ROWCAP: i64 = 512 |
| 29 | const SHF_WSCAP: i64 = 256 |
| 30 | const SHF_TAB: i64 = 9 |
| 31 | const SHF_NL: i64 = 10 |
| 32 | const SHF_PIPE: i64 = 124 |
| 33 | const SHF_HASH: i64 = 35 |
| 34 | const SHF_STDERR: i64 = 2 |
| 35 | const SHF_SEEK_SET: i64 = 0 |
| 36 | const SHF_SEEK_END: i64 = 2 |
| 37 | const SHF_EXIT_USAGE: i64 = 2 |
| 38 | const SHF_DEF_FLOOR: i64 = 700 |
| 41 | const SHF_DEF_SEV: i64 = 5 |
functions
| 43 | func shf_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } calls 1: sys_write |
| 44 | func shf_werr(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(SHF_STDERR, s, n); return 0 } |
| 45 | func shf_vlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: main |
| 46 | func shf_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { d[o] = s[i]; o = o + 1; i = i + 1 } return o } |
| 48 | func shf_catn(d: *u8, o: i64, v: i64) -> i64 |
| 63 | func shf_cat_esc_html(d: *u8, o: i64, q: *u8, s: i64, e: i64) -> i64 |
| 75 | func shf_cat_esc(d: *u8, o: i64, q: *u8, s: i64, e: i64) -> i64 called by 1: main |
| 89 | func shf_read(path: *u8, buf: *u8, cap: i64, sizep: *i64) -> i64 |
| 116 | func shf_le(q: *u8, i: i64, n: i64) -> i64 { var e: i64 = i; var s: i64 = 1; while s == 1 { if e >= n { s = 0 } else { if q[e] == (SHF_NL as u8) { s = 0 } else { e = e + 1 } } } return e } |
| 118 | func shf_colsep(q: *u8, ls: i64, le: i64, c: i64, sep: i64, out: *i64) -> i64 |
| 134 | func shf_colp(q: *u8, ls: i64, le: i64, c: i64, out: *i64) -> i64 { return shf_colsep(q, ls, le, c, SHF_PIPE, out) } |
| 135 | func shf_colt(q: *u8, ls: i64, le: i64, c: i64, out: *i64) -> i64 { return shf_colsep(q, ls, le, c, SHF_TAB, out) } |
| 136 | func shf_lit_eq(q: *u8, s: i64, e: i64, lit: *u8) -> i64 |
| 142 | func shf_span_eq(q: *u8, s1: i64, e1: i64, s2: i64, e2: i64) -> i64 |
| 148 | func shf_atoi_span(q: *u8, s: i64, e: i64) -> i64 { var v: i64 = 0; var i: i64 = s; while i < e { let c: i64 = q[i] as i64; if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } } i = i + 1 } return v } |
| 149 | func shf_isdig(c: i64) -> i64 { if c >= 48 { if c <= 57 { return 1 } } return 0 } |
| 151 | func shf_score(q: *u8, s: i64, e: i64) -> i64 |
| 190 | func shf_filed(q: *u8, s: i64, e: i64) -> i64 |
| 200 | func shf_verdict(score: i64, filed: i64, floor: i64) -> i64 called by 1: main |
| 206 | func shf_verdict_str(v: i64) -> *u8 called by 1: main |
| 213 | func shf_slug(q: *u8, s: i64, e: i64, dst: *u8, cap: i64) -> i64 called by 1: main |
| 233 | func shf_cfg(uprefix: *u8, key: *u8, defv: i64) -> i64 |
| 253 | func shf_row_legacy(q: *u8, ls: i64, le: i64, c0: *i64) -> i64 |
| 260 | func shf_scope_hits_ws(q: *u8, s: i64, e: i64, ws: *u8) -> i64 |
| 293 | func shf_debts_load(dprefix: *u8, buf: *u8) -> i64 |
| 303 | func shf_debts_count_ws(buf: *u8, n: i64, ws: *u8) -> i64 |
| 321 | func shf_has(q: *u8, n: i64, verb: *u8, ws_s: i64, ws_e: i64) -> i64 |
| 334 | func shf_first_kick(q: *u8, upto: i64, ws_s: i64, ws_e: i64) -> i64 |
| 347 | func shf_seed(prefix: *u8) -> i64 |
| 362 | func main(argc: i64, argv: *i64) -> i64 |