Replies: 5 comments 3 replies
-
Meaning it do a shallow comparison of top-level modules? Rather than rebuilding the whole lockfile, does something like a Merkle tree make sense here? Could pnpm detect a branch that's out of date without discarding everything? In the above, Whatever the implementation, having a means to verify this during CI and fail on checksum mismatch, would be useful. Otherwise, if a poor merge is made, every dev who pulls will be subject to pnpm in "slow mode". |
Beta Was this translation helpful? Give feedback.
-
Another solution might be to always check the actual name/version (or the package ID?) of the package inside the tarball with the name/version that is present in the lockfile. If they don't much, the lockfile is broken. To implement this, we will probably need to add the name and version of the package to the package index file. The package index file is a file in the store that contains mappings of the package files to their locations in the content-addressable store (for example). |
Beta Was this translation helpful? Give feedback.
-
Having to
|
Beta Was this translation helpful? Give feedback.
-
Any update? I'm migrating from yarn which has "yarn check --integrity" that I use on my project as a precommit hook, quite useful when working with monorepos. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
We cannot guarantee that Git or other version control system merges changes to lockfiles correctly. Issues may happen sometimes (see #3188, #3137). Hence, we need pnpm to verify the correctness of the data which is present in the lockfile.
Currently, pnpm blindly trusts any lockfile that is up-to-date with the
package.json
file of the repository. This allows pnpm to be extremely fast. However, this also means that in case of an invalid lockfile, pnpm will create an invalid modules directory.Possible solution: we could add a new field to the lockfile called
lockfileChecksum
. This field will contain a hash of the lockfile. When the hash will be out-of-date, pnpm will not run the fast install algorithm but will instead revalidate the data in the lockfile.Cons of this solution. After any merge/rebase that modifies the lockfile,
pnpm install
will have to be executed to revalidate the lockfile.cc @pnpm/collaborators
Beta Was this translation helpful? Give feedback.
All reactions