fix #4263: preserve resolved/integrity in package-lock.json when loading from cache#9688
Open
Amilliox wants to merge 1 commit into
Open
fix #4263: preserve resolved/integrity in package-lock.json when loading from cache#9688Amilliox wants to merge 1 commit into
Amilliox wants to merge 1 commit into
Conversation
…oading from cache
79e53cc to
def70d7
Compare
2 tasks
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.
Fixes #4263
Root cause: When
node_modules/.package-lock.json(hidden lockfile) is rejected byassertNoNewer()(e.g., after deleting a package fromnode_modules), theresolvedandintegritymetadata for existing on-disk packages is lost. The regeneratedpackage-lock.jsonis written without these fields, causing CI/CD failures, slow reinstalls (no integrity verification), and inconsistent lockfiles.Fix: In
load-actual.js, after loading the filesystem tree, try to recoverresolvedandintegrityfrom the hidden lockfile for nodes that lack this metadata. This preserves the original tarball URLs and integrity hashes even when the hidden lockfile validation fails.Verification:
Files changed:
workspaces/arborist/lib/arborist/load-actual.js(+22 lines)