Files
sx/build.zig
agra 503dfd8344 test(lsp): permanent corpus-sweep over the editor analyzer [dist B]
Adds `src/lsp/corpus_sweep.test.zig`: a permanent test that drives the
editor analyzer (`DocumentStore.analyzeDocument` — the exact path the
server's `textDocument/didOpen` uses) over EVERY `.sx` file in the
example + issue corpora, in process. The contract: analysis must
complete without panic/abort for any file. A panic aborts the test
binary — the loud CI signal that some new AST node shape crashes the
analyzer (the bug class issue 0099 fixed at sema.zig:397).

- Corpus dirs are injected as absolute paths at configure time
  (build.zig `corpus_paths` options module) so the sweep is
  CWD-independent; the FILE LIST is still read from disk at test time,
  so new examples are covered automatically with no test edit.
- Imports resolve against the shipped `library/` (root_path + stdlib
  path set), so the analyzer runs over real, fully-resolved code —
  maximum crash surface, mirroring an editor session opened on the repo.
- Wired into `zig build test` via the `src/root.zig` lsp barrel, same
  mechanism document.test.zig uses (refAllDecls reaches one struct deep,
  so the file is referenced directly).
- `SX_LSP_SWEEP_VERBOSE` prints each file before analysis; on a crash the
  last printed line names the offending file.

Coverage: 470 examples + 1 issue repro analyze with zero crashes.
Regression-guard proven: temporarily reverting A's sema.zig:397 fix
(`@intCast(ate.length.data.int_literal.value)`) makes the sweep abort
with `access of union field 'int_literal' while field 'identifier' is
active`; restoring it turns the sweep green.
2026-06-05 23:52:22 +03:00

9.5 KiB