code wiki / (root) / nx_lsp_gate.nx

nx_lsp_gate.nx

buildroot/runtime/nx_lsp_gate.nx

25971 B573 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

============================================================================================ nx_lsp_gate.nx -- the referee for LN11 (nx_lsp, the NishiLang language server). WHAT IT PROVES, and why each half is load-bearing: A CLEAN document must publish ZERO diagnostics and a BROKEN one must publish exactly ONE at the right line and column. Either half alone is trivially passable: a server that always reports an error passes the broken case, and a server that never reports one passes the clean case. Only the PAIR discriminates, so the pairing is a gv_bite cell and not two independent teeth. The UTF-16 column is checked against a byte column that is DIFFERENT, on a line built at runtime with multi-byte characters before the offending name. A server that passed byte columns through would satisfy "character is a plausible number" and fail this. That is the anti-vacuity tooth. The transcript is a REAL client: a recorded byte stream fed to `nx_lsp serve` on stdin with stdout captured. Nothing is stubbed, and the framing validator re-derives every Content-Length from the bytes that followed it -- an escaping bug that shortens a body cannot hide behind a self-consistent header. DELIBERATE DUPLICATION, DECLARED: this gate carries its OWN substring search, its OWN JSON string escaper and its OWN UTF-16 counter. That is not the duplicate-ruler defect -- it is the opposite. A test that measures the subject with the subject's own helpers cannot catch a defect IN those helpers, and the escaper and the column arithmetic are exactly where the interesting defects live. FIXTURES ARE ASSEMBLED AT RUNTIME in /tmp/nx_lsp_gate/ -- never checked in, never shared with a production beat, and never written into the estate's own source tree where a detector that scans sources would find this gate's own bad input and report it as a real defect. The multi-byte characters are CONSTRUCTED FROM BYTES rather than written as literals: a source file crosses several transports before it reaches a compiler and each of them can re-encode a literal. license_tier: ORIGINAL No hardware writes (Rule 26). ============================================================================================

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_lsp_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 ↻ gv_head gv_puts sys_write ↻ sys_mmap ↻ gv_cat sys_mkdir gl_exists sys_openat_rd sys_close gv_puts ↻ gl_write_file sys_openat_wr sys_write ↻ sys_close ↻ gv_need gv_puts ↻ gl_find gl_len gl_len ↻ gl_u16 gv_num sys_mmap ↻ sys_write ↻

structs

none

consts

35const GL_LF: i64 = 10
36const GL_CR: i64 = 13
37const GL_QUOTE: i64 = 34
38const GL_D0: i64 = 48
39const GL_D9: i64 = 57
40const GL_BSLASH: i64 = 92
41const GL_B10: i64 = 10
42const GL_WORD: i64 = 8
43const GL_U8_2: i64 = 192
44const GL_U8_3: i64 = 224
45const GL_U8_4: i64 = 240
47const GL_E9_HI: i64 = 195
48const GL_E9_LO: i64 = 169
49const GL_LBRACE: i64 = 123
50const GL_RBRACE: i64 = 125
51const GL_RBRACK: i64 = 93
52const GL_MINUS: i64 = 45
53const GL_ESC_N: i64 = 110
54const GL_ESC_R: i64 = 114
55const GL_ESC_T: i64 = 116
56const GL_TAB: i64 = 9
57const GL_SEPLEN: i64 = 4
58const GL_DIAGS_KEYLEN: i64 = 15
61const GL_BUF: i64 = 262144
62const GL_PATH: i64 = 1024
63const GL_SMALL: i64 = 4096

functions

65func gl_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
67func gl_find(b: *u8, n: i64, start: i64, pat: *u8) -> i64
84func gl_count(b: *u8, n: i64, pat: *u8) -> i64
called by 1: main calls 1: gl_find
96func gl_int_after(b: *u8, n: i64, start: i64, key: *u8) -> i64
called by 2: gl_frames_validmain calls 2: gl_findgl_len
118func gl_u16(b: *u8, n: i64, upto: i64) -> i64
called by 1: main
139func gl_write_file(path: *u8, buf: *u8, n: i64) -> i64
155func gl_exists(path: *u8) -> i64
called by 1: main calls 2: sys_openat_rdsys_close
163func gl_jesc(d: *u8, o: i64, s: *u8, n: i64) -> i64
181func gl_frame(d: *u8, o: i64, body: *u8, bn: i64) -> i64
called by 1: main calls 2: gv_catgv_catn
193func gl_spawn(elf: *u8, argv: *i64, in_path: *u8, out_path: *u8) -> i64
216func gl_slurp(path: *u8, len_out: *i64) -> *u8
called by 1: main calls 1: sys_read_file
227func gl_frames_valid(b: *u8, n: i64) -> i64
called by 1: main calls 2: gl_findgl_int_after
257func main() -> i64