aspect-build / aspect-build/rules_js

[Bug]: installing new packages invalidates caches for unrelated targets

Open
#2,540 2 comments 0 reactions 0 assignees View on GitHub
bug need: repro
Dominant language
Starlark
Stars
378
Forks
183
Avg merge
1d 9h
Merged PRs (30d)
32

Description

### What happened?

I would expect when installing a new package via the `npm_translate_lock` + `npm_link_all_packages` that it would not invalidate any cache entries. However, I observe that `pnpm add -E foo` + `aspect lint //...` invalidates all targets despite none relying on `//:node_modules/foo`

### Version

Development (host) and target OS/architectures:

Output of `bazel --version`:aspect 2025.19.5+06d8a1c78

Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file:

```starlark
bazel_dep(name = "aspect_bazel_lib", version = "2.19.2")
bazel_dep(name = "aspect_rules_rollup", version = "2.0.1")
bazel_dep(name = "aspect_rules_lint", version = "1.5.3")
bazel_dep(name = "rules_nodejs", version = "6.4.0")
bazel_dep(name = "aspect_rules_js", version = "2.4.0")
bazel_dep(name = "aspect_rules_ts", version = "3.6.3")
bazel_dep(name = "bazel_skylib", version = "1.8.1")
bazel_dep(name = "platforms", version = "1.0.0")

pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
pnpm.pnpm(pnpm_version = "9.15.9")
use_repo(pnpm, "pnpm")

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
npm.npm_translate_lock(
name = "npm",
npmrc = "//:.npmrc",
pnpm_lock = "//:pnpm-lock.yaml",
)
use_repo(npm, "npm")
```

Language(s) and/or frameworks involved: typescript, javascript

### How to reproduce

```shell

```

### Any other information?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the npm_translate_lock and npm_link_all_packages integration described in the issue, then reproduce the pnpm add -E foo followed by aspect lint //... scenario. Trace why unrelated cache entries are invalidated despite no dependency on //:node_modules/foo; done means unaffected targets retain their cache entries after the package change.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.