code wiki / _hdl_build / _lawsweep_gate.nx

_lawsweep_gate.nx

buildroot/runtime/_hdl_build/_lawsweep_gate.nx

17280 B337 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

_lawsweep_gate.nx -- ESTATE-WIDE ANTI-PATTERN CENSUS. The standing enforcement of laws that were previously only written down in comments. WHY THIS EXISTS. On 2026-08-07 a defect class was found, fixed in TWO organs, and reported as handled. The full population turned out to be 394 sites across 339 live sources -- 84% of every number printer in the estate. Fixing the instances you happen to trip over is not fixing the class, and a law recorded in a comment is enforced by nobody. A LAW THAT IS NOT A RUNNING CHECK IS A COMMENT, AND A COMMENT IS NOT A CONTROL. It reuses nx_forkcensus's proven primitives rather than authoring a fourth directory walker -- crucially fc_in_comment(), which separates a STRING LITERAL from a COMMENT ABOUT one. That distinction is exactly what a grep cannot make: the first estate measurement of hardcoded laptop paths returned 154 files, but the extraction had captured prose from a comment where someone had already written the warning down. A GREP FINDS THE CLAIM; ONLY A STAT SETTLES IT -- AND ONLY A PARSER SEPARATES A LITERAL FROM A COMMENT ABOUT THE LITERAL. T1 SIGN-DROP == 0 -- the number-printer class, estate-wide, in code (not comments). T2 NEG CTL -- a fixture that CONTAINS the defect must be DETECTED. Without this the gate scores its loudest PASS when the scanner is broken and sees nothing. T3 NON-VACUOUS -- files and bytes actually scanned > 0. A zero census is not a clean census. T4 DISCRIMINATOR -- a fixture carrying the SAME token once as a literal and once in a comment must be reported as exactly 1 and 1. This proves the literal/comment split that every count below depends on. It also MEASURES (does not gate) the foreign-host absolute-path class, literal-only, so the unrunnable-by-construction population finally has an honest number instead of a grep upper bound. Evidence -> knowledge/status/lawsweep.log (LAWSWEEP row). Sovereign. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_forkcensus.nx nx_gate_verdict.nx _lawsweep_gate.nx

imports: nx_forkcensus.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

structs

none

consts

32const LS_DIRBUF: i64 = 1048640
33const LS_FILEBUF: i64 = 2097152
34const LS_PATHCAP: i64 = 1024
35const LS_FIX: *u8 = "/tmp/_lawsweep_fixture.nx"
36const LS_LOG: *u8 = "knowledge/status/lawsweep.log"
39const LS_FILES: i64 = 0
40const LS_BYTES: i64 = 1
41const LS_SIGN: i64 = 2 // sign-dropping printers, in CODE
42const LS_SIGNC: i64 = 3 // ... the same token inside a comment
43const LS_FPATH: i64 = 4 // foreign-host absolute paths, in CODE
44const LS_FPATHC: i64 = 5 // ... inside a comment
45const LS_SELF: i64 = 6 // this organ's own source, excluded and DECLARED (never silently dropped)
50const LS_FPATH_DEAD: i64 = 7
51const LS_FPATH_LIVE: i64 = 8
61const LS_BAREFAIL: i64 = 9 // "FAIL" immediately followed by newline -- no operands
62const LS_DIAGFAIL: i64 = 10 // "FAIL " followed by more text -- operands present
63const LS_NSLOTS: i64 = 14

functions

65func ls_p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
66func ls_fp(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 1: ls_write_fixture
67func ls_fn(fd: i64, v: i64) -> i64
86func ls_count(buf: *u8, n: i64, pat: *u8, code_out: *i64, com_out: *i64) -> i64
called by 1: ls_scan calls 2: fc_slenfc_in_comment
108func ls_count_paths(buf: *u8, n: i64, pat: *u8, ctr: *i64) -> i64
156func ls_pat_barefail(p: *u8) -> i64
called by 1: ls_scan
168func ls_scan(buf: *u8, n: i64, ctr: *i64) -> i64
188func ls_walk(dir: *u8, ctr: *i64) -> i64
244func ls_write_fixture() -> i64
calls 1: ls_fp
255func main(argc: i64, argv: *i64) -> i64