code wiki / (root) / nx_diag_voice_gate.nx

nx_diag_voice_gate.nx

buildroot/runtime/nx_diag_voice_gate.nx

15899 B272 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_gate_verdict.nx nx_diag_voice_gate.nx

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

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_mmap ↻ dv_cat dv_census sys_mmap ↻ dv_is_why dv_find dv_slen dv_has_code dv_find ↻ dv_has_code ↻ dv_is_fix dv_find ↻ dv_has_code ↻ dv_w sys_write ↻ dv_slen ↻ dv_n sys_write ↻ sys_mmap ↻ gv_check gv_puts sys_write ↻ diag_voice_gate

structs

none

consts

25const 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)
26const DV_LINECAP: i64 = 4096 // longest source line examined (longer lines are cut, never skipped)
27const DV_NFILES: i64 = 8
28const DV_PATHCAP: i64 = 256
29const DV_CONFCAP: i64 = 4096
30const DV_RATCHET: *u8 = "knowledge/status/diag_voice_ratchet.conf\x00" as *u8

functions

32func dv_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: dv_wdv_find
33func dv_w(s: *u8) -> i64 { sys_write(1, s, dv_slen(s)); return 0 }
34func dv_n(v: i64) -> i64
43func 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 }
46func dv_find(line: *u8, n: i64, pat: *u8) -> i64
59func dv_lead(line: *u8, n: i64) -> i64
65func dv_has_code(line: *u8, n: i64, pat: *u8) -> i64
72func dv_is_site(line: *u8, n: i64) -> i64
84func dv_is_why(line: *u8, n: i64) -> i64
90func dv_is_fix(line: *u8, n: i64) -> i64
98func dv_census(buf: *u8, n: i64, fname: *u8, out: *i64, list: i64) -> i64
144func dv_read_src(fname: *u8, lenp: *i64) -> *u8
156func dv_baseline(conf: *u8, cn: i64, fname: *u8) -> i64
167func dv_write_conf(names: *i64, bares: *i64, nf: i64) -> i64
189func diag_voice_gate(c: *i64) -> i64
244func main() -> i64