code wiki / _hdl_build / _lawsweep_gate.nx
_lawsweep_gate.nx
buildroot/runtime/_hdl_build/_lawsweep_gate.nx
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
imports: nx_forkcensus.nxnx_gate_verdict.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 32 | const LS_DIRBUF: i64 = 1048640 |
| 33 | const LS_FILEBUF: i64 = 2097152 |
| 34 | const LS_PATHCAP: i64 = 1024 |
| 35 | const LS_FIX: *u8 = "/tmp/_lawsweep_fixture.nx" |
| 36 | const LS_LOG: *u8 = "knowledge/status/lawsweep.log" |
| 39 | const LS_FILES: i64 = 0 |
| 40 | const LS_BYTES: i64 = 1 |
| 41 | const LS_SIGN: i64 = 2 // sign-dropping printers, in CODE |
| 42 | const LS_SIGNC: i64 = 3 // ... the same token inside a comment |
| 43 | const LS_FPATH: i64 = 4 // foreign-host absolute paths, in CODE |
| 44 | const LS_FPATHC: i64 = 5 // ... inside a comment |
| 45 | const LS_SELF: i64 = 6 // this organ's own source, excluded and DECLARED (never silently dropped) |
| 50 | const LS_FPATH_DEAD: i64 = 7 |
| 51 | const LS_FPATH_LIVE: i64 = 8 |
| 61 | const LS_BAREFAIL: i64 = 9 // "FAIL" immediately followed by newline -- no operands |
| 62 | const LS_DIAGFAIL: i64 = 10 // "FAIL " followed by more text -- operands present |
| 63 | const LS_NSLOTS: i64 = 14 |
functions
| 65 | func 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 } |
| 66 | func 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 |
| 67 | func ls_fn(fd: i64, v: i64) -> i64 |
| 86 | func ls_count(buf: *u8, n: i64, pat: *u8, code_out: *i64, com_out: *i64) -> i64 |
| 108 | func ls_count_paths(buf: *u8, n: i64, pat: *u8, ctr: *i64) -> i64 |
| 156 | func ls_pat_barefail(p: *u8) -> i64 called by 1: ls_scan |
| 168 | func ls_scan(buf: *u8, n: i64, ctr: *i64) -> i64 |
| 188 | func ls_walk(dir: *u8, ctr: *i64) -> i64 |
| 244 | func ls_write_fixture() -> i64 calls 1: ls_fp |
| 255 | func main(argc: i64, argv: *i64) -> i64 |