nx_lsp_gate.nx
buildroot/runtime/nx_lsp_gate.nx
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
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
| 35 | const GL_LF: i64 = 10 |
| 36 | const GL_CR: i64 = 13 |
| 37 | const GL_QUOTE: i64 = 34 |
| 38 | const GL_D0: i64 = 48 |
| 39 | const GL_D9: i64 = 57 |
| 40 | const GL_BSLASH: i64 = 92 |
| 41 | const GL_B10: i64 = 10 |
| 42 | const GL_WORD: i64 = 8 |
| 43 | const GL_U8_2: i64 = 192 |
| 44 | const GL_U8_3: i64 = 224 |
| 45 | const GL_U8_4: i64 = 240 |
| 47 | const GL_E9_HI: i64 = 195 |
| 48 | const GL_E9_LO: i64 = 169 |
| 49 | const GL_LBRACE: i64 = 123 |
| 50 | const GL_RBRACE: i64 = 125 |
| 51 | const GL_RBRACK: i64 = 93 |
| 52 | const GL_MINUS: i64 = 45 |
| 53 | const GL_ESC_N: i64 = 110 |
| 54 | const GL_ESC_R: i64 = 114 |
| 55 | const GL_ESC_T: i64 = 116 |
| 56 | const GL_TAB: i64 = 9 |
| 57 | const GL_SEPLEN: i64 = 4 |
| 58 | const GL_DIAGS_KEYLEN: i64 = 15 |
| 61 | const GL_BUF: i64 = 262144 |
| 62 | const GL_PATH: i64 = 1024 |
| 63 | const GL_SMALL: i64 = 4096 |
functions
| 65 | func gl_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 67 | func gl_find(b: *u8, n: i64, start: i64, pat: *u8) -> i64 |
| 84 | func gl_count(b: *u8, n: i64, pat: *u8) -> i64 |
| 96 | func gl_int_after(b: *u8, n: i64, start: i64, key: *u8) -> i64 |
| 118 | func gl_u16(b: *u8, n: i64, upto: i64) -> i64 called by 1: main |
| 139 | func gl_write_file(path: *u8, buf: *u8, n: i64) -> i64 |
| 155 | func gl_exists(path: *u8) -> i64 |
| 163 | func gl_jesc(d: *u8, o: i64, s: *u8, n: i64) -> i64 |
| 181 | func gl_frame(d: *u8, o: i64, body: *u8, bn: i64) -> i64 |
| 193 | func gl_spawn(elf: *u8, argv: *i64, in_path: *u8, out_path: *u8) -> i64 |
| 216 | func gl_slurp(path: *u8, len_out: *i64) -> *u8 |
| 227 | func gl_frames_valid(b: *u8, n: i64) -> i64 |
| 257 | func main() -> i64 |