code wiki / (root) / nx_sizeguard.nx

nx_sizeguard.nx

buildroot/runtime/nx_sizeguard.nx

5861 B131 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_sizeguard.nx

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

main sg_puts sys_write sg_atoi sys_openat_rd sys_mmap sys_read sys_close sys_munmap sg_verdict sg_fill_permil sg_num sys_mmap ↻ sys_write ↻ sys_munmap ↻ sg_fill_permil ↻ sg_headroom

structs

none

consts

21const SG_READBUF: i64 = 65536
22const SG_PERMIL: i64 = 1000
23const SG_DEF_AMBER: i64 = 800
24const SG_NL: i64 = 10
25const SG_GREEN: i64 = 0
26const SG_AMBER: i64 = 1
27const SG_RED: i64 = 2
28const SG_UNMEASURED: i64 = 3

functions

31func sg_fill_permil(cur: i64, cliff: i64) -> i64
called by 2: sg_verdictmain
40func sg_verdict(bytes: i64, lines: i64, byte_cliff: i64, line_cliff: i64, amber_permil: i64) -> i64
called by 1: main calls 1: sg_fill_permil
55func sg_headroom(cur: i64, cliff: i64) -> i64
called by 1: main
61func 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 }
called by 1: main calls 1: sys_write
62func sg_num(v: i64) -> i64
called by 1: main calls 3: sys_mmapsys_writesys_munmap
78func sg_atoi(s: *u8) -> i64
called by 1: main
92func main(argc: i64, argv: *i64) -> i64