Repository navigation
fix(pnpm): restore the lockfile settings a dependency graph was resolved under - #10784
Conversation
…ved under A lockfile Bit restores from a component's dependency graph carried no `settings` block. pnpm reads a missing block as resolved with `dedupePeers` and `injectWorkspacePackages` off, which Bit's installs never match, so it discarded every restored lockfile and resolved the whole graph again: about 85 seconds for a capsule of 5,500 packages. The graph now records the `settings` block of the lockfile it is created from, next to the `pnpmfileChecksum` it already records, and the restored lockfile carries it back. Merges keep the settings only when both sides were resolved under the same ones. Graphs created before this change have no settings and are resolved again, as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
PR Summary by QodoPreserve pnpm lockfile settings in dependency graphs
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1. Lint fails on settings comparisons
|
…s no resolutions Merging a graph lockfile that adds no packages, from an empty or link-only graph, dropped the existing lockfile's pnpmfileChecksum and settings whenever the graph lacked matching ones, and pnpm then resolved the unrelated workspace dependencies again. Such a graph mixes nothing in, so the existing lockfile now keeps its own, the rule DependenciesGraph.merge already follows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Code review by qodo was updated up to the latest commit 36ad6f9 |
|
Code review by qodo was updated up to the latest commit 0006f6d |
|
Code review by qodo was updated up to the latest commit 6a2ebfd |
|
Code review by qodo was updated up to the latest commit fab51ea |
## Proposed Changes - **No readPackage hook.** Every dependency manifest the engine resolved used to go through a JavaScript callback. Its jobs now use static options that `@pnpm/napi` has supported since v12.0.0 (pnpm/pnpm#13492): - `@teambit/legacy` and `@teambit/harmony` are removed with `"@teambit/legacy@*": "-"` style overrides, which cover registry packages. The `@*` selector matches only semver ranges, so the `link:` dependencies Bit's linker adds stay, as the hook kept them. A workspace project can also declare them with `workspace:`, `file:` or `npm:` specs, so they are removed from the workspace manifests before the install as well. - An injected component gets its raw manifest through `projects[].dependencyManifest`. Before, the hook swapped it in by directory. - The stripping of never-built packages' scripts is removed. It did nothing: those packages are already denied with `allowBuilds: false`. - **Graph-restored lockfiles carry the overrides.** Without a hook there is no `pnpmfileChecksum` to record. pnpm instead compares the lockfile's `overrides` with the install's, so the dependency graph now records them, like the settings from #10784. A graph resolved with the old hooks (checksum `bit-1`) is read as having the two removal overrides, so existing graphs keep being reused. - **Measured** (single runs): - Ripple container, `bit sign` of a component with about 5,500 dependencies: the component capsule's install took 34 s instead of 72 s. The env capsules reused their restored lockfiles either way. - This repo: a repeat `bit install` spends 5 s in the engine instead of 12 s. - With `@pnpm/napi` 12.12.0 (below), a repeat `bit install` in this repo is "Already up to date" and the engine call takes under a second (926 ms). - **`@pnpm/napi` 12.12.0.** It includes two engine fixes this PR builds on: - pnpm/pnpm#16815: lockfile freshness compares an injected project with its `dependencyManifest`. Before, every repeat install resolved again. - pnpm/pnpm#16813: `allowBuilds` denials outrank `dangerouslyAllowAllBuilds`. With `dangerouslyAllowAllScripts` and `neverBuiltDependencies` both set, Bit now passes the allow-all flag together with the denials. Before, it passed only the denials, so no other package was built. - **This repo's `pnpm-lock.yaml`:** it gains the `@teambit/legacy@*` override and drops `pnpmfileChecksum: bit-1`. The resolutions are identical. This workspace forces a harmony version, so there is no harmony removal here. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Proposed Changes
settingsblock. pnpm reads a missing block as resolved withdedupePeersandinjectWorkspacePackagesoff, which Bit's installs never match, so it discarded every restored lockfile and resolved the whole graph again. In the ripple container that was about 85 seconds for a capsule of 5,500 packages.settingsblock of the lockfile it's created from, alongside thepnpmfileChecksumit already records. The restored lockfile carries it back.pnpmfileChecksumfollows. A graph lockfile that adds no resolutions, from an empty or link-only graph, leaves the existing lockfile's checksum and settings in place; before, it dropped the checksum and forced the unrelated workspace dependencies to resolve again.🤖 Generated with Claude Code