Skip to content

fix: resolve npm package store tar toolchain as a Label#2900

Merged
jbedard merged 1 commit into
aspect-build:mainfrom
keegancsmith:k/auto-exec-groups-npm-package-store
Jul 4, 2026
Merged

fix: resolve npm package store tar toolchain as a Label#2900
jbedard merged 1 commit into
aspect-build:mainfrom
keegancsmith:k/auto-exec-groups-npm-package-store

Conversation

@keegancsmith

Copy link
Copy Markdown
Contributor

The --incompatible_auto_exec_groups flag requires Starlark actions to declare whether their executable/tools come from an action toolchain. This is not a Bazel default today, but it is exposed through strict preset configurations and is intended to catch rules that rely on implicit action toolchain inference.

npm_package_store already declares the tar toolchain, but the extraction action passes that action toolchain as a string. That string is resolved in the consuming repository's mapping, which can fail when @tar.bzl is not visible as an apparent repository name. Use a pre-resolved Label so the action's toolchain behavior is explicit without changing its inputs or execution model.

Test plan

  • Manual testing; please provide instructions so we can reproduce: Using this patch on rules_js in our repository with --incompatible_auto_exec_groups everything starts to work.

@jbedard

jbedard commented Jul 3, 2026

Copy link
Copy Markdown
Member

Can we maybe add an e2e test with a .bazelrc adding the --incompatible_auto_exec_groups? Then enable that test only on the bazel versions that support it?

The --incompatible_auto_exec_groups flag requires Starlark actions to
declare whether their executable/tools come from an action toolchain.
This is not a Bazel default today, but it is exposed through strict
preset configurations and is intended to catch rules that rely on
implicit action toolchain inference.

npm_package_store already declares the tar toolchain, but the extraction
action passes that action toolchain as a string. That string is resolved
in the consuming repository's mapping, which can fail when @tar.bzl is
not visible as an apparent repository name. Use a pre-resolved Label so
the action's toolchain behavior is explicit without changing its inputs
or execution model.

Amp-Thread-ID: https://ampcode.com/threads/T-019f2bdc-94f2-77c9-a92a-081e6c2e19ad
Co-authored-by: Amp <amp@ampcode.com>
@keegancsmith keegancsmith force-pushed the k/auto-exec-groups-npm-package-store branch from 5f6cd8a to 8273b3c Compare July 4, 2026 06:50
@keegancsmith

Copy link
Copy Markdown
Contributor Author

I added --incompatible_auto_exec_groups to the existing e2e/repo_mapping test workspace rather than adding a new e2e case.

That workspace already renames aspect_rules_js via repo_name, so it exercises the same apparent-repository-name failure mode that caused @tar.bzl to resolve incorrectly. Its :node_modules_test also goes through npm_package_store, so the regression is covered directly.

I checked the Bazel versions in our current CI matrix and the flag exists on Bazel 7.x, 8.x, and 9.x, so I didn’t add skip tags/version gating. Verified locally with:

USE_BAZEL_VERSION=7.x bazel test //:node_modules_test

from e2e/repo_mapping.

@jbedard jbedard merged commit aa70c9b into aspect-build:main Jul 4, 2026
154 checks passed
@keegancsmith keegancsmith deleted the k/auto-exec-groups-npm-package-store branch July 5, 2026 08:05
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.

2 participants