GitNexus/gitnexus/src/core
Gergo Magyar 0ef71fd7df fix(windows): extend parseSourceSafe to group/embeddings + lint enforcement
Closes the remaining Windows SIGSEGV exposure flagged by the Codex
adversarial review on PR #1433. Six pre-existing parser.parse(content)
call sites bypassed parseSourceSafe and could crash the process on
Windows when a contract IDL, route file, or embedding-target source
exceeded 32 767 chars. Adds a lint rule so the regression vector closes
permanently.

Production code:
- Relocate parseSourceSafe from ingestion/utils/ to core/tree-sitter/
  so group/ and embeddings/ can import without crossing into ingestion
  internals. core/tree-sitter/ already houses parser-loader.ts and is
  the natural shared facade. All 11 existing importers updated; no shim
  left behind in the old location.
- Route through parseSourceSafe in 5 group extractors (grpc, thrift,
  http-route, include, tree-sitter-scanner) and the embeddings
  ensureAndParse helper.
- The seventh direct .parse() call in grpc-patterns/proto.ts:49 is a
  module-load grammar smoke test parsing a 36-char literal. Trivially
  safe by inspection, intentionally direct, filtered out by the lint
  rule via the string-literal-arg skip.

Tests:
- 5 caller-side regression tests with a vi.spyOn assertion on
  parseSourceSafe. The spy is what catches a regression: parser.parse
  on a 40 000-char input succeeds on Linux/macOS, so a "no throw"
  assertion alone would silently pass with the bypass reintroduced.
- The vi.mock boilerplate is centralised in
  gitnexus/test/helpers/parse-source-safe-mock.ts, dynamic-imported
  inside each mock factory so vitest's hoister does not race the
  static import binding.

Lint:
- New custom ESLint rule gitnexus/require-safe-parse, scoped to
  gitnexus/src/core/**, fails on direct <parser>.parse(<non-literal>,
  ...) calls and auto-fixes them to parseSourceSafe(<parser>, ...).
  Skips JSON/URL/marked/Number/Math, string-literal first args
  (smoke tests), test files, and the helper itself. Auto-fix rewrites
  the call site only; the developer adds the import after tsc
  surfaces the missing identifier — same tradeoff as
  unused-imports/no-unused-imports.

Plan: docs/plans/2026-05-10-001-fix-windows-parse-safety-group-and-embeddings-plan.md
2026-05-10 15:27:13 +01:00
..
augmentation feat(cursor): upgrade hooks to Cursor 2.4 postToolUse for Read/Grep/Shell coverage (#1467) 2026-05-10 13:29:06 +01:00
embeddings fix(windows): extend parseSourceSafe to group/embeddings + lint enforcement 2026-05-10 15:27:13 +01:00
graph feat(python): scope-based call resolution + registry-primary flip + perf + generalization (RFC #909 Ring 3) (#980) 2026-04-21 15:50:00 +01:00
group fix(windows): extend parseSourceSafe to group/embeddings + lint enforcement 2026-05-10 15:27:13 +01:00
ingestion fix(windows): extend parseSourceSafe to group/embeddings + lint enforcement 2026-05-10 15:27:13 +01:00
lbug fix(windows): cover all parse sites and correct vector-extension state 2026-05-10 14:00:05 +01:00
platform fix: add platform-aware semantic fallback (#1150) 2026-04-28 12:21:25 +01:00
search fix(search): surface warning when FTS indexes are missing (#1418) 2026-05-08 17:05:18 +01:00
tree-sitter fix(windows): extend parseSourceSafe to group/embeddings + lint enforcement 2026-05-10 15:27:13 +01:00
wiki fix(security): log-injection, http-to-file-access, client-side-request-forgery (#1456) 2026-05-09 17:26:32 +01:00
embedding-mode.ts feat: add optional limit arg to --embeddings flag (closes #382) (#1375) 2026-05-06 16:31:28 +01:00
git-staleness.ts perf(mcp): parallelize staleness checks in list_repos (#1416) 2026-05-08 10:36:20 +01:00
logger.ts feat(core): adopt pino structured logger (#1336) 2026-05-07 20:56:25 +01:00
run-analyze.ts feat: add optional limit arg to --embeddings flag (closes #382) (#1375) 2026-05-06 16:31:28 +01:00