nx_sizeguard.nx
buildroot/runtime/nx_sizeguard.nx
about
nx_sizeguard.nx -- FAIL LOUD BEFORE A READER SILENTLY TRUNCATES (seq1469 root fix #1).
THE CLASS: MEMORY.md is read by a loader that takes the first ~200 lines / ~25KB and DROPS THE REST
SILENTLY, TAIL-FIRST. No error, no marker, no count -- so the dropped lines are precisely the ones you
would need in order to learn they were dropped. That is the partial-as-complete defect this ecosystem
has banned repeatedly (L011 scancap, seq646, nx_debt truncation), sitting in the BOOT PATH.
AND IT IS NOT ONE FILE. Append-only artefacts grow forever by design: knowledge/status/*.jrnl,
law_warden.jrnl, and -- MY OWN DEBT FROM THIS SESSION -- procchurn.jrnl and adopt_census.txt, both of
which I created with no size discipline while filing debt about exactly this.
LAW: AN APPEND-ONLY FILE WITH NO SIZE DISCIPLINE IS A FUTURE SILENT TRUNCATION.
THE FIX IS A REFUSAL, NOT A REMINDER. Compaction is a workaround every session must repeat forever on
files that grow by design; a guard converts an invisible cliff into a loud verdict BEFORE it is crossed.
Lives in runtime/ (the PRIMITIVE layer) so any organ can reach it -- seq1450: build the primitive in the
layer its consumers can reach; imports nothing above its own layer.
argv: <path> <byte-cliff> <line-cliff> [amber-permil]
exit 0=GREEN 1=AMBER 2=RED(over cliff) 3=UNMEASURED. license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 1 imports · 0 importers
imports: nx_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
| 21 | const SG_READBUF: i64 = 65536 |
| 22 | const SG_PERMIL: i64 = 1000 |
| 23 | const SG_DEF_AMBER: i64 = 800 |
| 24 | const SG_NL: i64 = 10 |
| 25 | const SG_GREEN: i64 = 0 |
| 26 | const SG_AMBER: i64 = 1 |
| 27 | const SG_RED: i64 = 2 |
| 28 | const SG_UNMEASURED: i64 = 3 |
functions
| 31 | func sg_fill_permil(cur: i64, cliff: i64) -> i64 |
| 40 | func sg_verdict(bytes: i64, lines: i64, byte_cliff: i64, line_cliff: i64, amber_permil: i64) -> i64 |
| 55 | func sg_headroom(cur: i64, cliff: i64) -> i64 called by 1: main |
| 61 | func sg_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 62 | func sg_num(v: i64) -> i64 |
| 78 | func sg_atoi(s: *u8) -> i64 called by 1: main |
| 92 | func main(argc: i64, argv: *i64) -> i64 |