fix(lockfile): avoid lossy npm metadata drift rewrites#753
Conversation
Greptile SummaryFixes spurious re-resolves for npm (and yarn) lockfiles caused by
Confidence Score: 5/5Safe to merge — the change narrows when a lockfile is considered stale for npm/yarn formats, matching their actual on-disk capabilities, and the production install paths are all updated to pass the lockfile kind through the drift check. The logic is straightforward: a single predicate gates the override/ignored-optional comparison on whether the lockfile format can round-trip that metadata. The bun.lock format does serialise overrides (confirmed in bun/read.rs and bun/write.rs), so treating Bun as strict is correct. All three call-sites in resolve.rs are migrated consistently. No existing strict-checking paths for aube or pnpm are changed. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "fix(lockfile): avoid npm override drift ..." | Re-trigger Greptile |
e20727f to
960ef0b
Compare
Summary
Root cause
package-lock.json does not serialize the top-level override snapshot that aube/pnpm/bun locks use for drift detection. Any non-empty package.json overrides block therefore made an npm lock look stale, so install re-resolved and rewrote the package-lock graph even when the override was unrelated.
That rewrite was npm-readable, but it could be lossy relative to npm’s original package-lock shape: platform optional package entries, optional flags, and peer metadata could be reshaped even though the user did not make a dependency change requiring a lockfile update.
Validation
Fixes discussion #752.