Repository navigation
[pull] main from pnpm:main - #494
Merged
Merged
Conversation
) The blanket readPackage gate on canTryFastUpdateLockfile predates the machinery that makes it unnecessary: getContext applies the composed readPackage hook to every project manifest, so drift detection and the handlers compare hooked manifests against the hooked state the lockfile records, and a changed pnpmfile surfaces as pnpmfileChecksum drift, which is not composable and falls back to the resolver. The freshness gates that validate every candidate are the same ones that already admit frozen-like installs for pnpmfile projects. pacquet has no such gate and already behaved this way; it gains the regression e2e tests, including one pinning that a fast update never rewrites a specifier a project-rewriting hook recorded. Writing that test surfaced a pre-existing recording divergence between the stacks, filed as #13769. Item 7 of #13696.
) pacquet ran the pnpmfile's readPackage only over the manifests the resolver returned for a project's dependencies, never over the project manifests themselves, so a hook rewriting one of a project's own specifiers was dropped: the importer's wanted dependencies and the specifier the lockfile recorded for it both came from package.json. A hook turning "^1.0.0" into "3.1.0" left pacquet installing 1.0.0 and recording "^1.0.0" where pnpm installs 3.1.0 and records "3.1.0". The hook now runs once over every project manifest at the point pnpm's getContext runs it, before the freshness gates, the fast-update candidate, and the resolver read them, so all three agree on the hooked view. Recording the hooked specifier alone would have made every --frozen-lockfile install fail with SpecifiersDiffer, since that gate compares the lockfile against the manifest. The optimistic repeat-install check keeps reading the on-disk manifests: it runs ahead of the pnpmfile load and must not spawn the Node worker. Closes #13769.
…mReleaseAge` (#13678) `pnpm audit --fix` and `pnpm audit --fix update` no longer add `minimumReleaseAgeExclude` entries for patched versions that were published before the `minimumReleaseAge` cutoff. The publish time of each minimum patched version is now checked against the registry metadata, and only versions young enough to be blocked by the age gate get an exclusion entry
The fast paths bailed on any lockfile carrying a time field. That was unnecessary for the rewrites that introduce no new version: time records publish dates for the importers' direct dependencies, and pruneTimeInLockfile prunes it back to exactly those on every write, so a removal's stale entries are dropped by the writer rather than needing maintenance in the handlers. A removal on a time-based lockfile now produces a file byte-identical to the one a full resolution writes, which the new test asserts by running the same removal both ways. The bail stays for the resolver-consulting rewrites (catalogs, overrides): those introduce versions whose publish dates only a resolution can record, and no evidence was gathered either way. pacquet needs no mirror: it does not model the time field at all, which is its own bug (#13776) rather than a fast-path difference. Item 8 of #13696.
…dundant (#13780) `dedupeDirectDeps` only decided which direct-dependency links to create, never which existing ones to retire. Once the workspace root started providing a dependency a project already had linked, that project's now-redundant symlink survived every later install, so the on-disk layout depended on install history rather than on the manifests. The prune pass now folds the same root comparison pnpm's `modules-cleaner` prune applies into its diff, so an incremental install converges on the layout a clean install of the same manifests produces. Closes #13775
…ge (#13779) The importers fast update asked whether the locked version satisfies the new range and kept it when it did. Resolution asks a different question: preferredVersions makes it reuse the highest version of that alias already in the graph, which beats picking the highest published one. The two answers differ whenever some other importer or transitive dependency already holds a higher satisfying version, so widening a range through the fast path left the importer behind and kept a duplicate the resolver would have collapsed. Both stacks now pick the highest already-locked satisfying version, letting the shared epilogue prune whatever the move orphans. That also covers a range the locked version cannot satisfy at all but a present one can, which no longer falls back to the resolver. Bails kept for a candidate under peer-suffixed keys (the choice would be a guess) and for anything that is not plain semver. Closes #13778. Item 4 of #13696.
Include forwarded catalogs in pnpr's resolution cache identity so requests with different catalog mappings cannot reuse each other's resolver output. Route catalog URL values through the existing forwarded-input validation, applying the same destination allowlist and inline-credential rules as dependency specs, overrides, and lockfile tarballs. --------- Co-authored-by: Zoltan Kochan <[email protected]>
#13784) The fast path required the lockfile's importer count to equal the project count whenever pruneLockfileImporters was on — which is the default for an unfiltered recursive install — so deleting a package from a workspace always paid a full resolution. The importers handler now drops importer entries no project claims and records their aliases as dropped, leaving the shared epilogue to prune whatever that orphans, and the gate only requires that no project is *missing* an importer. A stale importer that a surviving importer still links to keeps the resolver: a project that is gone while something depends on it is a broken workspace, which must be reported rather than quietly rewritten — the behavior an existing multipleImporters test already pinned. No pacquet mirror yet: it does not prune stale importers at all, filed as #13783. Item 3 of #13696.
Every caller of the pnpmfile worker fans out without a bound — the resolver runs `readPackage` once per resolved package, all at once — while one worker is one Node process that services them a few at a time. Each request also started its 30s timer when it was written, so a request queued behind thousands of others could exhaust its window before the worker ever reached it and fail the install with ERR_PNPM_PNPMFILE_FAIL on hooks that are all fast. `NodeWorker::request` now takes one of 16 in-flight slots before it writes, so the bound (and the timer's start at the request's turn) covers every call site instead of having to be repeated at each one. The serialized request line and the pending bookkeeping are bounded with it; a caller's own manifest clone predates the call and stays resident in its queued future, which is the fan-out's to bound. The per-request timeout moved from a constant read at the point of use onto the worker, so a test can drive it without a 30s wait; `HOOK_TIMEOUT` is unchanged for every production caller. Closes #13774
pacquet's `Lockfile` had no `time` field, so serde discarded the section on load and never wrote it back: a `pnpm-lock.yaml` carrying the publish dates a `resolutionMode: time-based` install records lost them the first time pacquet rewrote it. Model the section, fill it from the `time-based` pre-pass (the prior lockfile's entries with this run's freshly resolved ones layered over them), prune it to the importers' direct dependencies on save the way `pruneTimeInLockfile` does, and read it back as the fallback publish date for a direct dependency whose packument carries none — so against a registry whose abbreviated metadata omits publish times, a later resolution derives the cutoff the lockfile was written under rather than a different one. The prune runs on the serialized document, where pnpm's `normalizeLockfile` runs, so every write path is covered: the fresh resolve, the fast lockfile update, the current lockfile under `node_modules/.pnpm`, and an `afterAllResolved` result. It also runs ahead of the verification cache's content hash, so an in-memory lockfile still hashes to what it will hash to once saved and read back. Closes #13776
#13788) `pnpm deploy` resolved its `--filter` selectors against the workspace directory with the legacy (subtree) directory matcher, so `--filter .` named every project nested under the workspace root rather than the root project itself. Deploying the root either copied the wrong project or failed with "Cannot deploy more than 1 project". The selection now runs through `select_recursive_projects`, the same path every other filtered command uses: glob directory matching (`legacyDirFiltering: false`) and selectors anchored at the current directory. That also drops a duplicate `GraphPkg` and picks up the `-w` root selector for free. Two fixes follow from the root becoming selectable: - The legacy deploy install ran with the source workspace as its workspace root, so it wrote the deployed project's resolution over the workspace's own `pnpm-lock.yaml` — replacing the root importer with the deployed manifest. Legacy deploy now takes `Install::run_legacy_deploy`, which carries pnpm's `saveLockfile: false` through the install: the resolved graph still drives `<virtual_store_dir>/lock.yaml`, but no `pnpm-lock.yaml` is written. This applies to every legacy deploy, not only a root one. - Deploying the root copies `pnpm-workspace.yaml` and the projects it globs into the deploy directory. The shared-lockfile install then discovered those copies as importers and rejected the generated frozen lockfile, which only describes the deployed project. The install now receives the deployed project as its whole workspace, matching pnpm, which installs the deploy directory with no workspace at all. pacquet only: the TypeScript CLI already behaves this way on the same fixture. Closes #13758
Stop importer-level workspace links from expanding a filtered install into unselected projects. The selected importer still receives its direct workspace link, but the linked importer's dependency graph is not materialized. Keep snapshot-level workspace-link traversal unchanged because those links are part of the selected dependency graph. Update the porting notes and regression coverage to document the boundary. --------- Co-authored-by: Zoltan Kochan <[email protected]>
#13790) pacquet kept an importer entry for a workspace project that no longer exists: the freshness gates only ask whether every manifest has a satisfying importer, never whether an importer still has a project, so the lockfile was judged up to date and never rewritten. The entry is not inert — it is a root in every reachability walk, so the departed project's dependencies stayed reachable too, and the file diverged from the one the TypeScript CLI writes. An importer no project claims is now staleness (RemovedImporter), and the importers fast update absorbs it: the entry goes, its aliases are recorded as dropped, and the shared epilogue prunes what that orphans. Only an unfiltered install of a whole workspace may conclude this, since only it sees the complete project list — a filtered run cannot tell a removed project from an unselected one. A stale importer that a surviving importer still links to keeps the resolver: that is a broken workspace to report, not drift to absorb, which is the exit the TypeScript side takes too. The three freshness flags move into a FreshnessScope struct rather than growing the parameter list further. Closes #13783.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )