Skip to content

Conversation

@MO2k4
Copy link
Contributor

@MO2k4 MO2k4 commented Feb 11, 2026

Summary

  • Adds CI workflow (.github/workflows/ci.yml) with build and test jobs across a Node 18/20/22 × ubuntu/macos/windows matrix
  • Adds release workflow (.github/workflows/release.yml) for publishing to npm on v* tags with provenance
  • Uses node_modules caching keyed on OS + Node version + lockfile hash to skip installs on cache hits
  • Native dependencies handled via npm ci --ignore-scripts && npm rebuild better-sqlite3 (skips 130MB model download)
  • Concurrency group cancels in-progress runs for the same branch/PR
  • Coverage artifact uploaded from the Node 22 + ubuntu cell
  • Adds skipIf guards for Kotlin tests (ABI-incompatible grammar, same as Swift/Dart)
  • Fixes resolveRelativeImport to normalize path separators on Windows
  • Renames vitest.config.tsvitest.config.mts to fix Vite CJS deprecation warning
  • Adds @vitest/coverage-v8 for coverage report generation in CI

Test plan

  • CI workflow triggers on push — all 9 test matrix cells run (3 OS × 3 Node versions)
  • Build job compiles successfully on all 3 Node versions
  • Native deps (better-sqlite3, tree-sitter grammars) work on all platforms
  • Tests pass on ubuntu (Node 18, 20, 22)
  • Tests pass on macOS (Node 18, 20, 22)
  • Tests pass on Windows (Node 18, 20, 22)
  • Second push reuses cached node_modules (install step skipped on cache hit)
  • Concurrency cancels previous in-progress run when new commit is pushed
  • Coverage artifact uploaded from ubuntu/Node-22 cell
  • Release workflow: push a v* tag after merge to verify it runs (publish skips if no NPM_TOKEN)

Adds CI workflow (build + test matrix across Node 18/20/22 and
ubuntu/macos/windows) and release workflow for publishing to npm
on version tags. Uses node_modules caching with native rebuild
strategy to avoid re-downloading dependencies on each run.
…e test expectations

Root cause: tree-sitter grammar native bindings for Swift and Dart are
incompatible with tree-sitter 0.22.4 on macOS arm64 (Apple Silicon,
macOS 26.2, Node.js v22.22.0).

Swift (tree-sitter-swift 0.6.0):
- The npm package fails to install entirely — `require('tree-sitter-swift')`
  throws MODULE_NOT_FOUND. There is no prebuilt binary for this platform
  and the source build fails. `loadGrammar()` correctly returned null,
  but 8 tests still ran unconditionally and failed.

Dart (@sengac/tree-sitter-dart 1.1.6):
- The npm package installs and `require()` succeeds, but the grammar
  object has an incompatible ABI with tree-sitter 0.22.4.
  `parser.setLanguage(dart)` crashes with "Cannot read properties of
  undefined (reading 'length')" inside tree-sitter's internal
  `initializeLanguageNodeClasses` function. This is a two-stage failure:
  `loadGrammar()` returned non-null (require worked), but `getParser()`
  threw an uncaught exception at `setLanguage()`. The grammar was likely
  built against a different tree-sitter ABI version.

Source fix (src/extraction/grammars.ts):
- Wrap `parser.setLanguage()` in try/catch inside `getParser()` so
  ABI-incompatible grammars degrade gracefully instead of crashing
- Change `isLanguageSupported()` and `getSupportedLanguages()` to call
  `getParser()` (validates full ABI compatibility) instead of
  `loadGrammar()` (only checks if require succeeds)

Test fixes:
- Skip Swift/Dart test blocks via `describe.skipIf(!isLanguageSupported())`
  so they are skipped on platforms where grammars are unavailable
- Remove hardcoded swift/dart from "supported languages" assertion since
  availability is platform-dependent
- Fix schema version test: expected 1 but schema is now version 2 after
  the v2 migration was added
- Fix DB tests: pass file path (path.join(testDir, 'test.db')) not bare
  directory to DatabaseConnection.initialize() — better-sqlite3 cannot
  open a directory as a database file
- Fix DB tests: call db.getDb() not db.getDatabase() — the latter method
  does not exist on DatabaseConnection
- Fix truncation tests: manually set MAX_OUTPUT_LENGTH on Object.create'd
  handler since constructor is bypassed and class field initializers
  never run
… paths

- Add skipIf guards for Kotlin extraction and import tests (same as
  Swift/Dart) since the grammar may not load on all platforms
- Remove Kotlin from always-expected language list
- Normalize path separators in resolveRelativeImport for Windows compat
- Rename vitest.config.ts to vitest.config.mts so Vite loads via ESM
  instead of the deprecated CJS API
- Add @vitest/coverage-v8 dev dependency for the v8 coverage provider
- Run tests with --coverage on the ubuntu/Node-22 CI cell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant