Repository navigation
fix(npm_install_deps): key the node_modules cache on the manifests the lockfile depends on - #41
Merged
Merged
Conversation
…e lockfile depends on The key covered the package's lockfile and package.json only. A lockfile also records its workspace members' manifests and those of the packages it links in from the repository (portal:, link:, file:). When one of those changed without the lockfile being updated, the key stayed the same, the cached node_modules was restored, and the immutable install that would have caught the stale lockfile never ran. npm_linked_manifests lists those manifests, following links transitively, and npm_install_deps adds them to the key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DSxF9AgGYcAcCTjXEeJT4L
charlielye
added a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Dec 3, 2026
Pins ci3 to aztec-labs-eng/ci3#41. `npm_install_deps` now adds two kinds of manifest to the `node_modules` cache key: the package's workspace members' manifests, and those of the packages it links in from this repository. A stale lockfile then misses the cache, and the immutable install catches it instead of a cached `node_modules` hiding it, as happened with #25855 until #25916. **What that adds here:** - **`barretenberg/acir_tests`:** its four workspace members, `bb.js`, the `bb.js-api` packages and `ipc-runtime/ts`; - **`native-packages/wsdb` and `ipc-codegen/echo_example/ts`:** `ipc-runtime/ts`; - **`barretenberg/ts`:** its links. Its hand-made `ipc-runtime/ts/package.json` key entry is removed, since the new key covers it. The keys change, so this PR's CI runs those installs fresh, which is the test. ci3 is pinned to the PR's commit. I'll repin to ci3's `main` once ci3#41 merges. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DSxF9AgGYcAcCTjXEeJT4L Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
npm_install_depskeys itsnode_modulescache on the package's ownyarn.lockorpnpm-lock.yamlandpackage.json. Its lockfile also depends on two other kinds of manifest:package.json;package.jsonof each package it links in from the repository (portal:,link:,file:). The lockfile records their version, dependencies andbinentries.When one of those changes and the lockfile isn't updated, the key stays the same. CI restores the cached
node_modules, and the--immutableinstall that would catch the stale lockfile never runs.This happened in aztec-packages. AztecProtocol/aztec-packages#25855 removed a
binentry fromipc-runtime/ts/package.jsonbut missed one of the lockfiles that links it. Public CI passed on a cachednode_modulesfor two days. Builds starting from an empty cache (the private mirror, its arm64 nightly) failed until AztecProtocol/aztec-packages#25916. aztec-packages'barretenberg/tshad already worked around this by hand, by passingipc-runtime/ts/package.jsonas an extra key file.Change
New
npm_linked_manifests: run in a package's directory, it printscache_content_hashpatterns for:workspacesfield in array or object form, or frompnpm-workspace.yaml, honouring!exclusions;file:dependency on an archive, the archive itself.Paths outside the git repository are skipped.
npm_install_deps: adds those patterns to the key, on the CI cache path only.Generated manifests that git doesn't track match nothing, as
cache_content_hashhashes the committed tree. A build that rewrote a committed linked manifest in place would now trip CI's dirty-tree check. aztec-packages' build doesn't do that, and its release step rewrites copies.Testing
tests/npm_linked_manifests_test(new) builds a fixture repo and checks:file:archive, a path outside the repository and regex escaping;barretenberg/acir_testslists its four workspace members,bb.js, thebb.js-apipackages andipc-runtime/ts.native-packages/wsdblistsipc-runtime/ts, its missing workaround.🤖 Generated with Claude Code
https://claude.ai/code/session_01DSxF9AgGYcAcCTjXEeJT4L