nx_io_envelope_census.nx
buildroot/runtime/nx_io_envelope_census.nx
about
nx_io_envelope_census.nx -- EVERY CAPPED READER ANNOUNCES OR DERIVES (/compare/dataio DI2, 2026-09-05).
THE CLASS: a read into a buffer whose length is a CONSTANT silently returns a PREFIX of anything larger, and the
caller reports success. Measured on the day this was written: the literal 4194304 appears 1,430 times in 717 source
files; the action miner's mine/freq/harden verbs read a 54 MB journal through a 4 MiB head for weeks; the ledger lib
behind the estate's idempotency keys read its ledger through 262,144 bytes. Each was a correct program reading the
wrong amount and saying nothing. The fix for a file read is sys_read_file (it sizes from the file and cannot short-
read); the fix for a genuinely unknowable size (a stream) is a NAMED cap whose truncation ANNOUNCES itself.
THIS ORGAN MEASURES WHERE THE ESTATE STANDS ON THAT, whole population, and makes SILENT the worklist:
sys_read( fd, buf, LEN ) call sites, LEN classified as
LITERAL a decimal literal -> FIXED
NAMED an ALL-CAPS identifier declared `const NAME: i64 = <decimal>` in the same file -> FIXED
DYNAMIC anything else (a computed remainder, a variable, an unresolved name) -> NOT JUDGED here
a FIXED site is ANNOUNCING when its file carries an envelope token that tells the reader the read may be partial
(TRUNCATED, OUTPUT-IS-PARTIAL, coverage_complete, capture_cap, scan_cap, truncated=, partial=), else SILENT.
sys_read_file( call sites are counted on a SEPARATE axis as DERIVED (the remedy, adopted).
COMPOSES, NEVER DUPLICATES: the walk is nx_shelltool grep (the estate's budgeted, envelope-honest walker -- its own
coverage_complete / corpus_complete are read and PROPAGATED, so a partial walk yields UNPROVEN, never a smaller
number that reads as better news); code-vs-prose is jc_strip_noncode from nx_cap_detect_lib (the same stripper the
silent-cap detector uses), so a `sys_read(` inside a string or a comment is never a site.
LOOPED (DI12, 2026-09-06) a read INSIDE a while block, or one whose result variable is the subject of a
`while <v> > 0` / `while <v> != 0` in the same file: the streaming idiom that consumes to EOF -> NOT JUDGED.
The first census put nx_sizeguard's own read loop on the SILENT worklist -- a correct streaming reader named
as a capped one -- so the class is separated and counted, never acquitted (a loop that breaks early is
still a cap; the loop's exit is not inspected here).
RATCHET (DI12 ie_ratchet): the SILENT set is a NAMED SET in knowledge/status/io_envelope_silent.baseline, one row per
site, keyed `path<TAB>k<TAB>text<TAB>line` where text is the stripped, whitespace-collapsed source line and k its
ordinal among identical lines in that file -- so an edit ABOVE a site does not change its identity (a file:line key
turned every conversion into a spurious rise plus a spurious fall; the line number is carried for humans only).
A RISE (a silent site not in the baseline) is RED and NAMED, and the baseline is NOT rewritten (a ratchet that
rewrites its baseline on a rise launders itself green); a FALL (a baseline site no longer silent) is NAMED with what
it became now (converted / announced / dynamic / looped), journaled to knowledge/status/io_envelope_ratchet.jrnl, and
the baseline is TIGHTENED to the rows that remain (a ratchet that does not tighten when you improve is a threshold).
--accept rewrites the baseline to the current set deliberately. A legacy `path:line` baseline is matched by line once
and MIGRATED to the keyed form. A count-only ratchet on a shared tree reports a regression without saying whose.
FALSE-POSITIVE RATE (DI12): derived from the ledger, never asserted. A site that LEFT the set as converted/announced/
dynamic was a true positive (a real capped reader got fixed); one that left as `looped` was the OLD ruler's false
positive; a hand row `kind=false site=<path:line> reason=<why>` adjudicates a standing site as bounded by
construction. false_positive_permil = fp * 1000 / (tp + fp), printed UNMEASURED while nothing is adjudicated.
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_tool_run.nxnx_gate_verdict.nxnx_cap_detect_lib.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
| 52 | const IE_GREP_CAP: i64 = 8388608 // the walker's output is a STREAM of unknown size: a NAMED cap, and hitting it ANNOUNCES (cap_hit=1 -> UNPROVEN) |
| 53 | const IE_SILENT_CAP: i64 = 1048576 // the silent-site worklist buffer; overflow is COUNTED (silent_overflow), never dropped in silence |
| 54 | const IE_PATH_CAP: i64 = 1024 |
| 55 | const IE_NAME_CAP: i64 = 128 |
| 56 | const IE_MODE_644: i64 = 420 |
| 57 | const IE_EXIT_GREEN: i64 = 0 |
| 58 | const IE_EXIT_RED: i64 = 1 |
| 59 | const IE_EXIT_UNPROVEN: i64 = 3 |
| 60 | const IE_EXIT_USAGE: i64 = 2 |
| 61 | const IE_BASELINE: *u8 = "knowledge/status/io_envelope_silent.baseline" as *u8 |
| 62 | const IE_LEDGER: *u8 = "knowledge/status/io_envelope_ratchet.jrnl" as *u8 |
| 63 | const IE_STATUS: *u8 = "knowledge/status/io_envelope.status" as *u8 |
| 64 | const IE_TAB: i64 = 9 |
| 65 | const IE_TEXT_CAP: i64 = 1024 // a key's text field; a longer source line is cut here (the cut is deterministic, so the key still identifies the site) |
| 66 | const IE_ROW_CAP: i64 = 2048 |
| 67 | const IE_FIX_DIR: *u8 = "/tmp/nx_io_envelope_census" as *u8 |
| 68 | const IE_MODE_755: i64 = 493 |
| 69 | const IE_BS_CREATED: i64 = 0 |
| 70 | const IE_BS_PRESENT: i64 = 1 |
| 71 | const IE_BS_REWRITTEN: i64 = 2 |
| 72 | const IE_BS_TIGHTENED: i64 = 3 |
| 73 | const IE_BS_MIGRATED: i64 = 4 |
| 74 | const IE_FP_UNMEASURED: i64 = 0 - 1 |
| 75 | const IE_SHELLTOOL: *u8 = "./nx_shelltool.elf" as *u8 |
| 76 | const IE_DEFAULT_ROOT: *u8 = "buildroot/runtime" as *u8 |
| 79 | const IE_NOT_A_SITE: i64 = 0 // the hit was inside a string or a comment, or the line could not be located |
| 80 | const IE_LITERAL_ANN: i64 = 1 |
| 81 | const IE_LITERAL_SILENT: i64 = 2 |
| 82 | const IE_NAMED_ANN: i64 = 3 |
| 83 | const IE_NAMED_SILENT: i64 = 4 |
| 84 | const IE_DYNAMIC: i64 = 5 |
| 85 | const IE_LOOPED: i64 = 6 |
| 93 | const IE_LOOP_STREAMING: i64 = 1 |
| 94 | const IE_LOOP_CAPPED: i64 = 2 |
| 95 | const IE_LOOP_UNJUDGED: i64 = 3 |
| 96 | const IE_BOUND_CAP: i64 = 64 |
functions
| 98 | func ie_puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 99 | func ie_putn(v: i64) -> i64 |
| 112 | func ie_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 113 | func ie_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var oo: i64 = o; while s[i] != (0 as u8) { d[oo] = s[i]; oo = oo + 1; i = i + 1 } d[oo] = 0 as u8; return oo } |
| 114 | func ie_catn(d: *u8, o: i64, v: i64) -> i64 |
| 126 | func ie_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] == b[i] { if a[i] == (0 as u8) { return 1 } i = i + 1 } return 0 } |
| 127 | func ie_find(q: *u8, n: i64, lit: *u8) -> i64 { return jc_find_sub(q, n, lit, ie_slen(lit)) } |
| 128 | func ie_is_digit(c: i64) -> i64 { if c >= 48 { if c <= 57 { return 1 } } return 0 } |
| 129 | func ie_is_upper_ident(c: i64) -> i64 { if c >= 65 { if c <= 90 { return 1 } } if c == 95 { return 1 } return ie_is_digit(c) } |
| 131 | func ie_skip_spaces(buf: *u8, e: i64, p: i64) -> i64 { var i: i64 = p; var go: i64 = 1; while go == 1 { if i >= e { go = 0 } else { if buf[i] == (32 as u8) { i = i + 1 } else { go = 0 } } } return i } |
| 133 | func ie_line_end(buf: *u8, n: i64, p: i64) -> i64 { var i: i64 = p; var go: i64 = 1; while go == 1 { if i >= n { go = 0 } else { if buf[i] == (10 as u8) { go = 0 } else { i = i + 1 } } } return i } |
| 135 | func ie_line_off(buf: *u8, n: i64, ln: i64) -> i64 |
| 154 | func ie_walker_env(gout: *u8, gn: i64, out: *i64) -> i64 |
| 174 | func ie_int_after(buf: *u8, n: i64, needle: *u8) -> i64 |
| 191 | func ie_file_announces(raw: *u8, n: i64) -> i64 |
| 203 | func ie_const_value(code: *u8, n: i64, name: *u8, nl: i64) -> i64 |
| 243 | func ie_is_ident(c: i64) -> i64 { if c >= 97 { if c <= 122 { return 1 } } return ie_is_upper_ident(c) } |
| 245 | func ie_span_has(code: *u8, s: i64, e: i64, lit: *u8) -> i64 { if e <= s { return 0 } return jc_find_sub(((code as i64) + s) as *u8, e - s, lit, ie_slen(lit)) } called by 5: ie_in_whileie_enclosing_whileie_span_eofie_token_is_boundie_rate calls 2: jc_find_subie_slen |
| 247 | func ie_line_start(code: *u8, p: i64) -> i64 { var i: i64 = p; var go: i64 = 1; while go == 1 { if i <= 0 { go = 0 } else { if code[i - 1] == (10 as u8) { go = 0 } else { i = i - 1 } } } return i } |
| 251 | func ie_in_while(code: *u8, lo: i64) -> i64 |
| 269 | func ie_assigned_var(code: *u8, lo: i64, site: i64, name: *u8) -> i64 |
| 312 | func ie_read_args_running(code: *u8, n: i64, site: i64) -> i64 called by 1: ie_is_looped |
| 331 | func ie_is_looped(code: *u8, n: i64, lo: i64, site: i64) -> i64 |
| 360 | func ie_is_looped_src(raw: *u8, n: i64, ln: i64) -> i64 |
| 370 | func ie_site_on_line(code: *u8, n: i64, lo: i64) -> i64 |
| 378 | func ie_line_of(buf: *u8, at: i64) -> i64 called by 1: ie_loop_exit |
| 392 | func ie_canon_span(code: *u8, s: i64, e: i64, out: *u8) -> i64 |
| 438 | func ie_enclosing_while(code: *u8, lo: i64) -> i64 |
| 456 | func ie_block_end(code: *u8, n: i64, ob: i64) -> i64 called by 1: ie_loop_span_end |
| 468 | func ie_loop_span_end(code: *u8, n: i64, ws: i64) -> i64 |
| 476 | func ie_span_eof(code: *u8, s: i64, e: i64, name: *u8) -> i64 |
| 492 | func ie_is_lower(c: i64) -> i64 { if c >= 97 { if c <= 122 { return 1 } } return 0 } |
| 494 | func ie_token_is_bound(code: *u8, ts: i64, te: i64) -> i64 |
| 513 | func ie_span_bound(code: *u8, s: i64, e: i64, bound: *u8) -> i64 |
| 539 | func ie_loop_exit(code: *u8, n: i64, ln: i64, bound: *u8) -> i64 |
| 570 | func jc_find_sub_at(code: *u8, n: i64, pat: *u8, pl: i64) -> i64 |
| 575 | func ie_loop_exit_src(raw: *u8, n: i64, ln: i64, bound: *u8) -> i64 |
| 582 | func ie_loop_worklist(code: *u8, raw: *u8, n: i64, ln: i64, bound: *u8) -> i64 |
| 587 | func ie_loop_worklist_src(raw: *u8, n: i64, ln: i64, bound: *u8) -> i64 |
| 592 | func ie_loop_name(lx: i64) -> *u8 |
| 599 | func ie_key_text(code: *u8, n: i64, ln: i64, dst: *u8) -> i64 |
| 621 | func ie_field(buf: *u8, rs: i64, re: i64, idx: i64, sp: *i64) -> i64 |
| 637 | func ie_span_eq(buf: *u8, s: i64, e: i64, lit: *u8) -> i64 { let ll: i64 = ie_slen(lit); if e - s != ll { return 0 } return jc_match_at(buf, s, lit, ll) } |
| 639 | func ie_count_same(silent: *u8, so: i64, path: *u8, text: *u8) -> i64 |
| 655 | func ie_row_put(silent: *u8, so: i64, path: *u8, k: i64, text: *u8, ln: i64) -> i64 |
| 670 | func ie_classify(code: *u8, raw: *u8, n: i64, ln: i64, out_val: *i64) -> i64 |
| 737 | func ie_classify_src(raw: *u8, n: i64, ln: i64, out_val: *i64) -> i64 |
| 745 | func ie_file_len(path: *u8) -> i64 |
| 752 | func ie_file_eq(path: *u8, s: *u8, n: i64) -> i64 |
| 761 | func ie_write_file(path: *u8, s: *u8, n: i64) -> i64 |
| 768 | func ie_ledger_append(ledger: *u8, row: *u8) -> i64 |
| 776 | func ie_class_name(cls: i64) -> *u8 called by 1: ie_now_class |
| 786 | func ie_now_class(path: *u8, k: i64, text: *u8, ln: i64, legacy: i64) -> *u8 called by 1: ie_ratchet calls 8: sys_mmapsys_read_filejc_strip_noncodeie_class_nameie_classifyie_key_text+2 |
| 812 | func ie_rate(ledger: *u8, out: *i64) -> i64 |
| 835 | func ie_ratchet(silent: *u8, so: i64, baseline: *u8, ledger: *u8, accept: i64, out: *i64) -> i64 called by 2: ie_scanie_selftest calls 14: sys_mmapsys_read_filejc_find_subie_line_endie_fieldsys_now_realtime_sec+8 |
| 1043 | func ie_scan(root: *u8, accept: i64) -> i64 |
| 1263 | func ie_selftest() -> i64 |
| 1424 | func ie_worklist_scan(bb: *u8, n: i64, files: *i64, counts: *i64) -> i64 { return ie_worklist_group(bb, n, 0, files, counts) } |
| 1427 | func ie_worklist_group(bb: *u8, n: i64, field: i64, files: *i64, counts: *i64) -> i64 |
| 1456 | func ie_worklist(baseline: *u8) -> i64 |
| 1547 | func main(argc: i64, argv: *i64) -> i64 |