code wiki / _hdl_build / nx_janitor_sprawl_gate.nx
nx_janitor_sprawl_gate.nx
buildroot/runtime/_hdl_build/nx_janitor_sprawl_gate.nx
about
nx_janitor_sprawl_gate.nx -- proves the JANITOR sprawl/junk-cleanup organ (nx_janitor_sprawl):
an orphaned-registry-.tsv detector + REVERSIBLE quarantiner, with the cardinal NO-FALSE-POSITIVE law.
Builds a hermetic /tmp fixture (a scan tree + a registry of 6 .tsv files) and calls js_run directly,
so the gate never touches the real registry. The fixture is designed to DISCRIMINATE:
- 3 PROTECTED tsvs: one referenced by a real path const, one named as a substring of a referenced
longer name (boundary-protected), one mentioned ONLY in a // comment (over-protect law).
- 3 ORPHAN tsvs: two plain unreferenced, plus bcensus.tsv -- which is a SUBSTRING of the referenced
fix_bcensus.tsv and MUST STILL be quarantined (the left word-boundary must reject that shielding).
NEGATIVE CONTROLS (load-bearing): the referenced/comment/boundary-protected files MUST stay put -- a
false positive (quarantining a used file) flips the gate RED; the boundary orphan MUST move -- an
over-broad substring-protect flips it RED. Plus idempotency (a second run moves nothing new).
GREEN iff all 11 checks hold. Reversible: the action is rename(2) into quarantine, never delete.
Sovereign: imports nx_janitor_sprawl + nx_syscalls (nx_cc->nxasm, no gcc). license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_janitor_sprawl.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
| none |
functions
| 19 | func jg_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != 0 as u8 { n = n + 1 } sys_write(1, s, n); return 0 } |
| 20 | func jg_putn(v: i64) -> i64 |
| 29 | func jg_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != 0 as u8 { dst[off + i] = s[i]; i = i + 1 } return off + i } |
| 30 | func jg_catn(dst: *u8, off: i64, v: i64) -> i64 |
| 38 | func jg_join(out: *u8, a: *u8, b: *u8) -> i64 { var o: i64 = jg_cat(out, 0, a); o = jg_cat(out, o, b); out[o] = 0 as u8; return o } |
| 39 | func jg_mkdir(path: *u8) -> i64 { return sys_mkdir(path, 0x1ed) } |
| 40 | func jg_write(path: *u8, content: *u8) -> i64 |
| 46 | func jg_exists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 } |
| 48 | func jg_write_reg(dir: *u8, leaf: *u8, content: *u8) -> i64 |
| 52 | func jg_exists_in(dir: *u8, leaf: *u8) -> i64 |
| 55 | func jg_assert(label: *u8, cond: i64) -> i64 calls 1: jg_puts |
| 60 | func main() -> i64 |