npm package-lock.json round-trip corrupts graph when package.json has any non-empty overrides
#752
Replies: 1 comment
-
|
Thanks for the detailed repro. I opened https://github.com/endevco/aube/pull/753 for this. Root cause: package-lock.json does not carry the lockfile-level override snapshot that aube/pnpm/bun locks use for drift detection. Because of that, any non-empty package.json overrides block made an npm lock look stale, even when the override was unrelated to the packages in the lockfile. aube then re-resolved and rewrote package-lock.json, which was npm-readable but could be lossy relative to npm’s original graph shape. The PR makes drift checks format-aware: npm/yarn skip those lockfile-level metadata comparisons, while aube-lock.yaml, pnpm-lock.yaml, and bun.lock stay strict. I also verified bun does serialize top-level overrides, and Yarn 1/4 resolutions are applied into package entries rather than stored as a top-level snapshot. Validation included the repro from this discussion: after This comment was generated by Codex. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
When
package.jsoncontains a non-emptyoverridesblock,aube installrewritespackage-lock.jsonin a way that:optional: truemarkers (and matchingos/cpuconstraints) from platform-specific packages,packagessection,peerDependenciesinto concretedependencieswith pinned versions.The content of
overridesdoes not matter — even an override on a package with no peer chains (e.g.lodash) triggers it. An emptyoverrides: {}does not trigger it.Environment
aube 1.15.0 macos-arm64 (2026-05-17)node v24.14.1,npm 11.11.0Minimal reproduction
package.json:{ "name": "aube-overrides-repro", "version": "1.0.0", "private": true, "dependencies": { "typescript": "^5.0.0", "vite": "^8.0.13", "react": "18.3.1", "@casl/react": "5.0.1", "@casl/ability": "6.8.1" }, "overrides": { "lodash": "^4.0.0" } }Actual
node_modules/...entriesoptional: truemarkersreact: "18.x"pin injections into peer-only entriesThe pruned packages are all
@esbuild/*platform binaries, including the one matching the host (@esbuild/darwin-arm64).@casl/reactgains injected concretedependencies:"node_modules/@casl/react": { "version": "5.0.1", ... + "dependencies": { + "@casl/ability": "6.8.1", + "react": "18.3.1" + }, "peerDependencies": { "@casl/ability": "^4.0.0 || ^5.1.0 || ^6.0.0", "react": "^17.0.0 || ^18.0.0 || ^19.0.0" } }Expected
aube installon apackage-lock.jsonwritten by npm should round-trip the file faithfully. Theoverridesblock should not change the shape ofpackages[],optional/os/cpumetadata, or peer/dep classification of unrelated packages.Ablation
overridesvalue{}(empty object){ "typescript": "$typescript" }{ "typescript": "^5.0.0" }{ "lodash": "^4.0.0" }The trigger is the presence of any entry in
overrides— neither the npm$<direct-dep>parent-reference syntax nor a specific override target is required.This issue was investigated with Claude Code.
Beta Was this translation helpful? Give feedback.
All reactions