code wiki / _hdl_build / nx_stderronly.nx
nx_stderronly.nx
buildroot/runtime/_hdl_build/nx_stderronly.nx
about
nx_stderronly.nx -- THE SILENT-STDERR-GUARD DETECTOR.
THE DEFECT. A guard that detects a fault, writes its refusal ONLY to the error channel, and then
leaves the enclosing status function on a SUCCESS path reaches its caller as SILENCE: the caller
reads a success code, sees nothing, and proceeds. Measured live 2026-08-20 in nx_clockjob, where a
refused write was indistinguishable from a successful one.
SCOPE, STATED PLAINLY -- THIS IS SOURCE-SHAPE ANALYSIS, NOT RUNTIME.
It cannot observe which channel a message actually took at run time, because the estate has no
fd-capture primitive: a sibling proved that nx_job_run MERGES fd1 and fd2 (one refusing write
appeared exactly twice in a single capture), so a runtime channel test is currently unwritable.
That missing primitive is filed separately as nx_fdcapture. Everything below is decided from the
bytes of the source with comment bodies and string bodies masked out of the code view.
WHAT IT THEREFORE CANNOT SEE: a verdict carried through a flag variable that is returned later; a
refusal whose message is built across several lines; a condition spread over several lines; a
caller that already holds the failure code (a reason-printer); any refusal worded outside the
published vocabulary; anything at all at run time.
THE SIGNAL IS A CONJUNCTION, AND EVERY CONJUNCT IS PUBLISHED AS ITS OWN BUCKET SO THE FUNNEL CAN BE
AUDITED RATHER THAN TRUSTED:
1. the site is an fd-2 emission -- a write whose fd argument is the literal 2 OR a file-level
const whose VALUE is 2 (THE SAME CONSTANT IN TWO SPELLINGS IS TWO CONSTANTS TO EVERY SCANNER:
the estate writes both, so resolving by value is the only complete rule), OR a call to a
same-file UNCONDITIONAL stderr helper
2. it is NOT inside such a helper's own body (a printer is not a guard)
3. its innermost enclosing block is an `if` guard, not a function body / else / loop
4. the emitted literal carries a REFUSAL token from the published vocabulary
5. the guard block carries NO non-zero verdict (no non-zero return, no non-zero sys_exit)
6. the enclosing function PROVES IT USES EXIT CODES -- it carries a non-zero verdict SOMEWHERE
7. the guard block does no other work (no assignment, so it cannot be setting a failure flag)
CONJUNCT 6 IS THE DISCRIMINATOR AND IT WAS EARNED, NOT GUESSED. Without it the rule fires on every
reason-printer in the estate (nx_gunzip.gu_reason, nx_refcorpus.rc_reason: a fan of
`if rc == -N { emit(...) }` lines whose CALLER already holds the failure code). Such a function has
no non-zero verdict anywhere, so it is not a status function at all, and its silence is correct by
design. A FUNCTION THAT NEVER RETURNS A NON-ZERO CODE IS NOT FAILING TO REPORT -- IT WAS NEVER THE
REPORTER.
CONJUNCT 7 WAS EARNED THE SAME WAY: the corpus is full of `if x < 0 { write(fd2,"-"); x = 0 - x }`
number formatters and `if p2 == 0 { werr("T2 ...") }` selftest teeth whose verdict lives in a
dependencies 2 imports · 0 importers
imports: nx_memplane_lib.nxnx_gatekit_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
| 68 | const SO_MAXF: i64 = 32768 // corpus is ~18,600; a smaller cap would REFUSE, never truncate |
| 69 | const SO_FBUF: i64 = 4194304 |
| 70 | const SO_FNMAX: i64 = 2048 // functions per file |
| 71 | const SO_EMMAX: i64 = 64 // unconditional stderr helpers per file |
| 72 | const SO_CNMAX: i64 = 512 // file-level consts whose value is 2 |
| 73 | const SO_W2MAX: i64 = 8192 // fd-2 write positions per file |
| 74 | const SO_SITEF: i64 = 16384 // emission sites per file |
| 75 | const SO_ENCLMAX: i64 = 64 // enclosing block levels walked outward from a site |
| 76 | const SO_WLB: i64 = 4194304 // per-bucket worklist buffer |
| 77 | const SO_WLRES: i64 = 4096 // headroom kept free so a row is never half-written |
| 78 | const SO_MSG: i64 = 65536 |
| 79 | const SO_KEYB: i64 = 4194304 |
| 80 | const SO_VOCB: i64 = 65536 |
| 81 | const SO_VOCMAX: i64 = 256 |
| 82 | const SO_PATHB: i64 = 4096 |
| 84 | const SO_NL: i64 = 10 |
| 85 | const SO_SP: i64 = 32 |
| 86 | const SO_TABCH: i64 = 9 |
| 87 | const SO_CR: i64 = 13 |
| 88 | const SO_QUOTE: i64 = 34 |
| 89 | const SO_HASH: i64 = 35 |
| 90 | const SO_BSLASH: i64 = 92 |
| 91 | const SO_SLASH: i64 = 47 |
| 92 | const SO_LBRACE: i64 = 123 |
| 93 | const SO_RBRACE: i64 = 125 |
| 94 | const SO_LPAREN: i64 = 40 |
| 95 | const SO_RPAREN: i64 = 41 |
| 96 | const SO_COMMA: i64 = 44 |
| 97 | const SO_EQ: i64 = 61 |
| 98 | const SO_BANG: i64 = 33 |
| 99 | const SO_LT: i64 = 60 |
| 100 | const SO_GT: i64 = 62 |
| 101 | const SO_PLUS: i64 = 43 |
| 102 | const SO_STAR: i64 = 42 |
| 103 | const SO_PCT: i64 = 37 |
| 104 | const SO_D0: i64 = 48 |
| 105 | const SO_D9: i64 = 57 |
| 106 | const SO_MINUS: i64 = 45 |
| 107 | const SO_UPA: i64 = 65 |
| 108 | const SO_UPZ: i64 = 90 |
| 109 | const SO_LOA: i64 = 97 |
| 110 | const SO_LOZ: i64 = 122 |
| 111 | const SO_USCORE: i64 = 95 |
| 112 | const SO_CASEGAP: i64 = 32 |
| 113 | const SO_BASE10: i64 = 10 |
| 114 | const SO_FD2VAL: i64 = 2 // the error channel; the whole subject of this organ |
| 116 | const SO_MK_CODE: i64 = 0 |
| 117 | const SO_MK_CMT: i64 = 1 |
| 118 | const SO_MK_STR: i64 = 2 |
| 121 | const SO_B_EMIT: i64 = 0 // inside an unconditional stderr helper's own body -- a printer |
| 122 | const SO_B_NOGUARD: i64 = 1 // enclosing block is a function body / else / loop, not an `if` |
| 123 | const SO_B_NOVOCAB: i64 = 2 // guarded, but the literal carries no refusal token |
| 124 | const SO_B_CARRIES: i64 = 3 // guarded refusal, and the block carries a non-zero verdict <-- GOOD |
| 125 | const SO_B_NOSTATUS: i64 = 4 // enclosing function has no non-zero verdict anywhere -- reason-printer |
| 126 | const SO_B_HASWORK: i64 = 5 // block assigns something -- the verdict may live in a flag |
| 127 | const SO_B_SILENT: i64 = 6 // <-- THE SIGNAL |
| 128 | const SO_B_UNKNOWN: i64 = 7 // could not resolve the enclosing block / a cap was reached |
| 129 | const SO_B_ELSEARM: i64 = 8 // the block is one arm of an if/else message SELECTOR, not a refusal |
| 130 | const SO_B_RETZERO: i64 = 9 // the block returns/exits explicitly -- a chosen contract, not silence |
| 131 | const SO_B_N: i64 = 10 |
| 133 | const SO_MODE_644: i64 = 420 |
| 137 | const SO_I64B: i64 = 8 // bytes per i64 slot |
| 138 | const SO_NULRES: i64 = 8 // headroom left unread so a buffer can always be NUL-terminated |
| 139 | const SO_ASPAN_SLOTS: i64 = 4 // so_argspan writes out[0]=open, out[1]=past-close; slack for growth |
| 140 | const SO_ESCPAIR: i64 = 2 // a backslash escape consumes the slash AND the byte it escapes |
| 142 | const SO_SCAN_ERR_CAP: i64 = 2 // returned as -2: the corpus exceeded the name-table cap |
| 143 | const SO_SCAN_ERR_PATH: i64 = 3 // returned as -3: a source path exceeded the name slot |
| 144 | const SO_EXIT_REFUSED: i64 = 2 // this organ REFUSED to judge; distinct from 1 = a NEW finding |
| 148 | const SO_L_WRITE: *u8 = "sys_write(" |
| 149 | const SO_L_EXIT: *u8 = "sys_exit(" |
| 150 | const SO_L_RETURN: *u8 = "return " |
| 151 | const SO_L_FUNC: *u8 = "func " |
| 152 | const SO_L_CONST: *u8 = "const " |
| 153 | const SO_L_IFSP: *u8 = "if " |
| 154 | const SO_L_IFP: *u8 = "if(" |
| 155 | const SO_L_ELSE: *u8 = "else" |
| 156 | const SO_L_TOPLVL: *u8 = "<top-level>" |
| 157 | const SO_JOURNAL: *u8 = "knowledge/status/stderronly.log" |
| 158 | const SO_L_KWIF: *u8 = "if" |
| 159 | const SO_L_KWWHILE: *u8 = "while" |
| 160 | const SO_L_KWRETURN: *u8 = "return" |
functions
| 162 | func so_isid(c: i64) -> i64 |
| 170 | func so_isdig(c: i64) -> i64 |
| 175 | func so_lower(c: i64) -> i64 called by 1: so_ifind |
| 181 | func so_at(buf: *u8, p: i64, n: i64, lit: *u8) -> i64 |
| 191 | func so_same(buf: *u8, p: i64, q: i64, ln: i64, n: i64) -> i64 called by 1: main |
| 207 | func so_mask(buf: *u8, n: i64, mk: *u8) -> i64 called by 1: main |
| 253 | func so_find(buf: *u8, mk: *u8, s: i64, e: i64, lit: *u8, want: i64) -> i64 |
| 267 | func so_ifind(buf: *u8, mk: *u8, s: i64, e: i64, lit: *u8, ll: i64) -> i64 |
| 288 | func so_bmatch(buf: *u8, mk: *u8, open: i64, n: i64) -> i64 called by 1: main |
| 307 | func so_encl(buf: *u8, mk: *u8, p: i64, lo: i64) -> i64 called by 1: main |
| 328 | func so_carries(buf: *u8, mk: *u8, s: i64, e: i64) -> i64 |
| 381 | func so_assigns(buf: *u8, mk: *u8, s: i64, e: i64) -> i64 called by 1: main |
| 414 | func so_isguard(buf: *u8, mk: *u8, op: i64, lo: i64) -> i64 |
| 448 | func so_elsefollows(buf: *u8, mk: *u8, cl: i64, n: i64) -> i64 |
| 476 | func so_argspan(buf: *u8, mk: *u8, site: i64, n: i64, out: *i64) -> i64 called by 1: main |
| 512 | func so_othercall(buf: *u8, mk: *u8, isemit: *u8, s: i64, e: i64) -> i64 |
| 548 | func so_lineno(buf: *u8, p: i64) -> i64 called by 1: main |
| 557 | func so_vocab_builtin(vb: *u8) -> i64 |
| 574 | func so_vocab_loose(vb: *u8) -> i64 |
| 583 | func so_vindex(vb: *u8, n: i64, off: *i64, len: *i64, cap: i64) -> i64 called by 1: main |
| 616 | func so_hasvocab(buf: *u8, mk: *u8, s: i64, eol: i64, vb: *u8, off: *i64, len: *i64, vn: i64) -> i64 |
| 635 | func so_journal(path: *u8, corpus: i64, sites: i64, silent: i64, unknown: i64, nadd: i64, green: i64) -> i64 |
| 659 | func main(argc: i64, argv: *i64) -> i64 |