Skip to content

ci: get main green again under tree-sitter v0.26#20

Merged
NullVoxPopuli merged 8 commits into
ember-tooling:mainfrom
NullVoxPopuli-ai-agent:bump-setup-action-v2
May 10, 2026
Merged

ci: get main green again under tree-sitter v0.26#20
NullVoxPopuli merged 8 commits into
ember-tooling:mainfrom
NullVoxPopuli-ai-agent:bump-setup-action-v2

Conversation

@NullVoxPopuli-ai-agent
Copy link
Copy Markdown

@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent commented May 10, 2026

Brings main back to a working state under the tree-sitter v0.26 toolchain that CI's floating tags now resolve to, fixes a couple of long-latent bugs in the Rust and Windows binding paths, and documents source-vs-generated files. PR #19 will need to rebase on this and drop its src/parser.c / grammar.json / etc. regen so it can stand as a clean scanner-only fix.

What's in here

  1. ci: bump tree-sitter/setup-action/cli@v1 → @v2 — Action's v1 tag is frozen at a 2024 commit whose init script parses the stdout of tree-sitter init-config. Starting with tree-sitter CLI 0.26.2 that message moved to stderr (upstream fix). v1 was never advanced, so any run that resolves tree-sitter-ref: latest to ≥0.26.2 (currently v0.26.8) fails with line 2: : No such file or directory.

  2. deps: move tree-sitter-javascript to runtime dependenciesgrammar.js does require('tree-sitter-javascript/grammar') at generation time. parser-test-action@v2 installs only runtime deps (npm ci --omit dev --omit peer --omit optional), so this has to be in dependencies.

  3. chore: regenerate parser with tree-sitter v0.26parser-test-action runs tree-sitter generate then git diff --exit-code -- parser.c. The artifacts on main were generated with an older CLI, so they didn't match. Regenerated with v0.26.7; grammar.js is unchanged.

  4. docs: list auto-generated vs hand-written files in README — README was just badges; spell out what's produced by tree-sitter generate (don't edit) vs what's hand-maintained (scanner.c, queries, fixtures, bindings, etc).

  5. build: replace pnpm-lock.yaml with package-lock.jsonparser-test-action@v2 uses npm ci, which requires a package-lock.json. Consolidating on npm matches tree-sitter-typescript and avoids drift between two lockfiles.

  6. build: include src/scanner.c in node binding sourcesbinding.gyp only listed parser.c, so on Windows MSVC the .node build failed with LNK2001 unresolved external symbol tree_sitter_glimmer_javascript_external_scanner_*. macOS/Linux had been tolerating the same gap.

  7. rust: bump tree-sitter to 0.25 and adopt LanguageFn patternCargo.toml was pinning tree-sitter = "~0.20.10", which only supports ABI 13; the regenerated parser declares LANGUAGE_VERSION 15, so the Rust binding test panicked with LanguageError { version: 15 }. Switched to tree-sitter-language = "0.1" for the runtime dep and tree-sitter = "0.25" as a dev-dep, with the LanguageFn::from_raw pattern used by tree-sitter-typescript. Also fixed the crate name (tree-sitter-glimmer-javascript, not the underscore form), bumped the version to match package.json, and added tree-sitter.json to the crate include list.

Verified locally

  • cargo test — both unit and doctest pass against the regenerated parser
  • npm ci --omit=dev followed by node-gyp postinstall — successfully compiles parser.o and scanner.o and links the .node binding

Test plan

  • Test parser matrix passes on ubuntu / windows / macos-14
  • cargo test step (Linux only) passes
  • After merge, Fix ASI not firing before <template> in class bodies #19 rebases cleanly with src/parser.c, src/grammar.json, src/node-types.json, src/tree_sitter/* dropped (git checkout origin/main -- ...) and just keeps the scanner.c and corpus changes

🤖 Generated with Claude Code

The v1 tag is frozen at a 2024 commit whose init step parses the
stdout of `tree-sitter init-config`. Starting with tree-sitter CLI
0.26.2 that message moved to stderr, so the script captures an empty
path and the next redirect fails with `: No such file or directory`.

Upstream fixed this and cut v2; v1 was never advanced, so any run
that resolves `tree-sitter-ref: latest` to >=0.26.2 fails at setup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
grammar.js does `require("tree-sitter-javascript/grammar")` at parser
generation time, so the package must be present when CI runs
`tree-sitter generate`. The current parser-test-action installs only
runtime deps (`npm ci --omit dev --omit peer --omit optional`), so this
needs to be in `dependencies`, matching the convention used by
tree-sitter-typescript and other wrapping grammars.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NullVoxPopuli-ai-agent NullVoxPopuli-ai-agent changed the title ci: bump tree-sitter/setup-action/cli to v2 ci: get main green again under tree-sitter v0.26 May 10, 2026
NullVoxPopuli and others added 2 commits May 9, 2026 23:19
Brings the committed src/parser.c, grammar.json, node-types.json, and
vendored runtime headers in line with what `tree-sitter generate`
produces under the v0.26 CLI used by CI. Without this, parser-test-action
fails its `git diff --exit-code parser.c` regeneration check on every
run, because the artifacts on main were last regenerated with an older
CLI.

Generated with `TREE_SITTER_ABI_VERSION=15 tree-sitter generate` against
tree-sitter v0.26.7. grammar.js is unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The README was just a header and badges, so it wasn't obvious to drive-by
contributors which files under src/ are produced by `tree-sitter generate`
and which are hand-maintained. Spell that out so people don't waste time
hand-editing parser.c only to have it overwritten, or vice versa.

Also fixes the previously-undefined link references for the CI/matrix/npm
badges and adds a one-line description of what this grammar is.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
NullVoxPopuli and others added 3 commits May 10, 2026 00:43
tree-sitter/parser-test-action@v2 runs `npm ci` to install runtime
deps before regeneration; that requires a package-lock.json. Rather
than carry both lockfiles (and risk drift), consolidate on npm to
match the convention used by other tree-sitter parser repos
(tree-sitter-typescript, tree-sitter-rust, etc.).

Update the docs hint in README from `pnpm build` to `npm run build`
to match.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The external scanner symbols (tree_sitter_glimmer_javascript_external_scanner_*)
are referenced by parser.c but their definitions live in scanner.c, which
binding.gyp was not compiling. macOS's linker tolerates the dangling
references, but Windows MSVC fails the .node build with LNK2001 unresolved
external symbol errors.

Adding src/scanner.c to sources matches the convention used by other
tree-sitter parser repos (tree-sitter-typescript, tree-sitter-rust, etc.).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The Rust binding was pinning tree-sitter = "~0.20.10", which only supports
parser ABI 13. The regenerated parser.c declares LANGUAGE_VERSION 15, so
loading the grammar at runtime panicked with `LanguageError { version: 15 }`
in the bindings test.

Switch to the modern convention used by tree-sitter-typescript and other
maintained parser crates:

- `tree-sitter-language = "0.1"` as the runtime dep (provides LanguageFn)
- `tree-sitter = "0.25"` as a dev-dep for the bindings test (supports ABI 15)
- `extern fn tree_sitter_glimmer_javascript() -> *const ()` returns the
  opaque language pointer; wrap with `LanguageFn::from_raw` and expose as
  `pub const LANGUAGE`
- doctest and unit test go through `parser.set_language(&LANGUAGE.into())`

Crate name, version, description, repository, edition, and include list are
left untouched so the published `tree-sitter-glimmer_javascript@0.0.1`
identifier is unaffected.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`tree-sitter generate --no-bindings` no longer accepts that flag in
tree-sitter CLI v0.26 — bindings scaffolding moved out of `generate`
into the separate `tree-sitter init` command, so plain `tree-sitter
generate` is the equivalent.

Update both the package.json `build` script and the README hint that
points at the same command.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@NullVoxPopuli NullVoxPopuli merged commit 2376e3c into ember-tooling:main May 10, 2026
6 checks passed
@NullVoxPopuli NullVoxPopuli requested a review from Copilot May 10, 2026 12:32
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates this grammar repo to work with the tree-sitter v0.26 toolchain (as used by CI), including regenerated parser artifacts, dependency/lockfile adjustments for parser-test-action@v2, Windows Node binding fixes, and updated documentation about generated vs hand-maintained files.

Changes:

  • Update CI to use tree-sitter/setup-action/cli@v2 and regenerate src/ artifacts against the v0.26 generator output.
  • Adjust Node/Rust packaging/build inputs (Node deps, binding.gyp sources, Rust LanguageFn pattern + deps).
  • Replace pnpm-lock.yaml with package-lock.json and expand README documentation.

Reviewed changes

Copilot reviewed 10 out of 13 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
.github/workflows/ci.yml Bumps setup action to @v2 so CI works with newer tree-sitter CLI behavior.
binding.gyp Adds src/scanner.c to Node addon sources (fixes missing external scanner symbols on Windows).
bindings/rust/lib.rs Switches Rust binding to LanguageFn constant API and updates docs/tests accordingly.
Cargo.toml Updates Rust dependency strategy (runtime via tree-sitter-language, dev via tree-sitter).
package.json Updates build script and moves tree-sitter-javascript to runtime deps to satisfy CI install behavior.
package-lock.json New npm lockfile to support npm ci usage.
pnpm-lock.yaml Removed as part of switching lockfile strategy.
README.md Documents which files are generated vs hand-maintained.
src/grammar.json Regenerated grammar JSON for the v0.26 generator output format.
src/node-types.json Regenerated node-types, marking comment tokens as extra.
src/tree_sitter/array.h Updated vendored runtime header (strict-aliasing related changes and MSVC pragmas).
src/tree_sitter/parser.h Updated vendored runtime header for the newer ABI/layout.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

package.json:31

  • This PR removes pnpm-lock.yaml in favor of package-lock.json, but the repo still contains GitHub workflows that run pnpm install --frozen-lockfile (e.g. .github/workflows/publish.yml, .github/workflows/plan-release.yml). Without a pnpm lockfile those workflows will fail. Update the workflows to use npm ci (or keep a pnpm lockfile) so release automation remains functional.
  "scripts": {
    "build": "tree-sitter generate",
    "build:local": "tree-sitter build -o parser/glimmer_javascript.so",
    "install": "node-gyp-build",
    "lint": "eslint common/define-grammar.js",
    "parse": "tree-sitter parse",
    "prebuildify": "prebuildify --napi --strip",
    "test": "tree-sitter test"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment on lines 3 to 5
[![CI][ci]](https://github.com/tree-sitter/tree-sitter-typescript/actions/workflows/ci.yml)
[![matrix][matrix]](https://matrix.to/#/#tree-sitter-chat:matrix.org)
[![npm][npm]](https://www.npmjs.com/package/tree-sitter-glimmer-typescript)
Comment thread src/tree_sitter/array.h
}
// Pointers to individual `Array` fields (rather than the entire `Array` itself)
// are passed to the various `_array__*` functions below to address strict aliasing
// violations that arises when the _entire_ `Array` struct is passed as `Array(void)*`.
Comment thread src/tree_sitter/array.h
1, array_elem_size(self) \
); \
(self)->contents[(self)->size++] = (element); \
} while(0)
Comment thread package.json
"release-plan": "^0.9.2",
"tree-sitter-cli": "^0.24.3",
"tree-sitter-javascript": "^0.23.0"
"tree-sitter-cli": "^0.24.3"
Comment thread Cargo.toml
Comment on lines 22 to +29
[dependencies]
tree-sitter = "~0.20.10"
tree-sitter-language = "0.1"

[build-dependencies]
cc = "1.0"

[dev-dependencies]
tree-sitter = "0.25"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants