nx_diag_voice_gate.nx
buildroot/runtime/nx_diag_voice_gate.nx
about
nx_diag_voice_gate.nx -- LN27 (lang.plan, 2026-09-02): EVERY DIAGNOSTIC TEACHES IN ONE VOICE.
The operator named the first LN24 messages as output that does not help a programmer grow: a
location and a fact, no why, no fix. The parser's teaching sites already carry the shape (nx_diag_at,
nx_diag_caret, then "why the build stopped:" and "fix:"); this gate walks EVERY diagnostic emission
site in the toolchain sources and refuses a BARE site -- a location or a refusal printed without a
why line and a fix line within its window -- as a RATCHET: the bare count per file may never RISE
above knowledge/status/diag_voice_ratchet.conf, it self-tightens on every fall, and it never rewrites
its baseline on a rise (a ratchet that launders itself green is a threshold wearing a ratchet's name).
It prints the worklist (BARE file:line) so the count is actionable, never a bare number.
SITE RULE (mechanical, declared, bite-proven below): a source line is an emission site when it is
not a comment line and, before any `//`, contains one of
nx_diag_at( nx_diag_organ_at( "error: nxcx_log("nx_compile_x86: "nxasm: FATAL "error at function
and is not a `func ` definition line. It is VOICED when, within the next DV_WINDOW lines and before
the next site, one line carries a why ("why the build stopped" or a call to nx_diag_why_) and one
carries a fix ("fix:" or a did-you-mean nx_dym_note). Everything else is BARE.
The classifier is a pure function over a buffer so the fixtures below are assembled at RUNTIME --
a detector that scans source would otherwise find its own test fixture in this very file.
nx_diag_voice_gate -- census + ratchet + controls, verdict in the exit code (gv_verdict)
license_tier: ORIGINAL layer: lang module: nishi-core.lang.diag_voice_gate
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_gate_verdict.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
| 25 | const DV_WINDOW: i64 = 60 // lines after a site in which why and fix must appear (the exhaustiveness site lists every missing variant first: 48 lines) |
| 26 | const DV_LINECAP: i64 = 4096 // longest source line examined (longer lines are cut, never skipped) |
| 27 | const DV_NFILES: i64 = 8 |
| 28 | const DV_PATHCAP: i64 = 256 |
| 29 | const DV_CONFCAP: i64 = 4096 |
| 30 | const DV_RATCHET: *u8 = "knowledge/status/diag_voice_ratchet.conf\x00" as *u8 |
functions
| 32 | func dv_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 33 | func dv_w(s: *u8) -> i64 { sys_write(1, s, dv_slen(s)); return 0 } |
| 34 | func dv_n(v: i64) -> i64 |
| 43 | func dv_cat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64 = off; var i: i64 = 0; while s[i] != (0 as u8) { dst[o] = s[i]; o = o + 1; i = i + 1 } dst[o] = 0 as u8; return o } |
| 46 | func dv_find(line: *u8, n: i64, pat: *u8) -> i64 |
| 59 | func dv_lead(line: *u8, n: i64) -> i64 |
| 65 | func dv_has_code(line: *u8, n: i64, pat: *u8) -> i64 |
| 72 | func dv_is_site(line: *u8, n: i64) -> i64 |
| 84 | func dv_is_why(line: *u8, n: i64) -> i64 |
| 90 | func dv_is_fix(line: *u8, n: i64) -> i64 |
| 98 | func dv_census(buf: *u8, n: i64, fname: *u8, out: *i64, list: i64) -> i64 |
| 144 | func dv_read_src(fname: *u8, lenp: *i64) -> *u8 |
| 156 | func dv_baseline(conf: *u8, cn: i64, fname: *u8) -> i64 |
| 167 | func dv_write_conf(names: *i64, bares: *i64, nf: i64) -> i64 |
| 189 | func diag_voice_gate(c: *i64) -> i64 |
| 244 | func main() -> i64 |