Skip to content

fix: pin tree-sitter-java to the version tree-sitter-groovy pins, so it stays deduped - #909

Merged
swapnilpaliwal-sd merged 1 commit into
mainfrom
fix/901-arm64-prebuilds
Sep 18, 2026
Merged

swapnilpaliwal-sd merged 1 commit into
mainfrom
fix/901-arm64-prebuilds

Conversation

@swapnilpaliwal-sd

@swapnilpaliwal-sd swapnilpaliwal-sd commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Refs #901. Merges on its own, ahead of the engine work: it fixes a defect that is on main today and blocks arm64 validation of everything else.

The defect

tree-sitter-groovy depends on tree-sitter-java@0.23.4 exactly while the parser asked for ^0.21.0. npm cannot reconcile the two, so it nests a second copy under tree-sitter-groovy, and that nested copy's gyp config resolves node-addon-api by a relative path whose ../ count is wrong once nested:

make: *** No rule to make target 'Release/obj.target/../../../node-addon-api/node_addon_api_except.stamp'

It is invisible wherever a prebuilt binary exists, because nothing compiles. On linux-arm64 the 0.21.x generation ships no prebuilt core, so the build runs and fails on the nested copy.

Measured on a clean arm64 VM

before after
install, no toolchain fails fails (upstream limit, see below)
install, with build-essential fails succeeds
parser on a real Java project could not run 39 csv, 48128 rows

The 39 files and 48128 rows match macOS exactly. On real Java and Python projects the IR is byte for byte identical to tree-sitter-java@0.21.0, so the grammar change is behaviour neutral and not only install neutral.

Why it should not wait for the engine batch

It is independent: three files, none of them the executor, and it does not depend on #904. It is also a prerequisite for validating anything else on arm64, since without it the install fails before an engine is ever resolved.

Why an exact pin

A caret range does not dedupe: ^0.23.4 resolves to 0.23.5 while groovy pins 0.23.4, and npm nests again. The two have to name the same version. package-contents-test.sh now asserts the parser's version equals the one tree-sitter-groovy pins, and was verified to fail on the old value.

What this does not fix

linux-arm64 still needs build-essential. No 0.21.x tree-sitter core ships an arm64 prebuild, and every published tree-sitter-java and tree-sitter-groovy declares peerDependencies { tree-sitter: ^0.21.1 }, which pins the minor on a 0.x version, so no version set reaches an arm64 core prebuild.

Bumping the core to 0.22.4 was tried and abandoned. It resolves only with an npm overrides entry, and overrides apply at the root of an install, so it never reaches a consumer: npm hoists tree-sitter 0.21.1 to satisfy the grammars' peers and installs 0.22.4 nested for us, leaving the consumer on the 0.21.1 that has no arm64 prebuild. That was only caught by testing a consumer-shaped install after the repo install looked clean. It also required migrating four Language.query call sites that 0.22 removed.

Closing the remaining gap needs upstream: an arm64 prebuild for a 0.21.x core, or grammars that accept a newer core. #901 stays open for that.

…it stays deduped

tree-sitter-groovy depends on tree-sitter-java@0.23.4 exactly while the parser
asked for ^0.21.0. Two versions npm cannot reconcile, so it nests a second copy
under tree-sitter-groovy, and the nested copy's gyp config resolves
node-addon-api by a relative path whose ../ count is wrong once nested. It
cannot build even with a full toolchain.

That is invisible wherever a prebuilt binary exists, because nothing compiles.
On linux-arm64 the 0.21.x tree-sitter generation ships no prebuilt core, so the
build runs, hits the nested copy and fails outright.

Pinning to the same version leaves one hoisted copy. Measured on a clean arm64
VM: before, npm install failed with a toolchain installed; after, it succeeds and
the parser produces 39 csv files and 48128 rows on a real Java project, matching
macOS exactly. The IR is byte for byte identical to 0.21.0 on real Java and
Python projects, so the grammar change is behaviour neutral.

A caret range is not enough: ^0.23.4 resolves to 0.23.5 and nests again. The two
have to name the same version, which is what the new check in
package-contents-test.sh asserts. Verified it fails on the old value.

This does NOT make linux-arm64 installable without a compiler. No 0.21.x core
ships an arm64 prebuild, and no published tree-sitter-java or tree-sitter-groovy
accepts a core above 0.21.x, so there is no version set that reaches one. arm64
still needs build-essential; this only removes the failure that a toolchain could
not fix.

Refs #901
@swapnilpaliwal-sd

swapnilpaliwal-sd commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Correction to the note above: this is no longer held with the engine batch and merges on its own.

It is independent of #904 (three files, none of them the executor), it fixes a defect that is on main today, and it is a prerequisite for validating anything else on arm64, because without it the install fails before an engine is ever resolved. Holding it would have blocked the validation it enables.

#904 and #902 still merge together once the engine work is complete.

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