Repository navigation
Conversation
…eclaring manifest A `file:` specifier is relative to the directory of the manifest that declares it — pnpm's `parentPkg.rootDir`. The tree walk threaded the importer's `project_dir` through every depth, so a `file:` dependency of a package installed from a local directory was resolved against the importer instead. A `file:../child` in `packages/license/parent` landed on `packages/child` and the install failed with `ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND`. The children walk now derives the declaring package's directory from its directory resolution (relative to the lockfile root, absolute for `link:`-shaped ones) and hands it to each `file:` child's resolve options. It joins the per-wanted dedup key through `project_relative_cache_scope`, so two parents that declare the same relative specifier no longer share a resolution. The speculative children warm-up applies the same override, both to keep it from resolving a path that doesn't exist and so it warms the key the real resolve reads back. Once resolution was correct, the snapshot the lockfile writes for such a dependency still diverged: pacquet wrote `<name>@file:<path>` where pnpm writes the bare `file:<path>` whenever the alias equals the package's own name. The importer side already stripped that self-alias; the strip is now shared with the snapshot side, so a workspace with nested `file:` deps (vite's license fixtures) round-trips through `pnpm dedupe --check` against a pnpm-written lockfile. pnpm 11 already resolves these correctly and covers the shape with its `deep local` test, so no TypeScript change is needed. Closes #13323
|
Warning Review limit reached
Next review available in: 5 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Summary by QodoFix nested file: dependency resolution relative to declaring manifest
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (2): Last reviewed commit: "fix(resolving-deps-resolver): limit the ..." | Re-trigger Greptile |
Code Review by Qodo
Context used✅ Compliance rules (platform):
24 rules 1. Unneeded file: cache splits
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Micro-Benchmark ResultsLinux |
…le: resolutions `declaring_manifest_dir` treated every directory resolution as lockfile-root-relative, which only holds for the `file:`-shaped ones. A workspace `link:` records its directory relative to the consuming importer and the local resolver's `link:` records it absolute, so the helper could have handed back a path assembled from the wrong base. The walk never asks for a linked node's directory — a linked project resolves its own dependencies as a separate importer — but the helper now returns `None` for those instead of relying on the caller.
|
Thanks — replies to the three findings: 1. Historical comments in test docs — fixed in b1d4afc. The module and test docs now state the contract and why the fixture is shaped that way, with a bare 2. Unneeded 3. Written by an agent (Claude Code, claude-opus-5[1m]). |
|
Code review by qodo was updated up to the latest commit b1d4afc |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
…eclaring manifest (pnpm#13384) A `file:` specifier is relative to the directory of the manifest that declares it — pnpm's `parentPkg.rootDir`. The tree walk threaded the importer's `project_dir` through every depth, so a `file:` dependency of a package installed from a local directory was resolved against the importer instead. A `file:../child` in `packages/license/parent` landed on `packages/child` and the install failed with `ERR_PNPM_LINKED_PKG_DIR_NOT_FOUND`. The children walk now derives the declaring package's directory from its directory resolution (relative to the lockfile root, absolute for `link:`-shaped ones) and hands it to each `file:` child's resolve options. It joins the per-wanted dedup key through `project_relative_cache_scope`, so two parents that declare the same relative specifier no longer share a resolution. The speculative children warm-up applies the same override, both to keep it from resolving a path that doesn't exist and so it warms the key the real resolve reads back. Once resolution was correct, the snapshot the lockfile writes for such a dependency still diverged: pacquet wrote `<name>@file:<path>` where pnpm writes the bare `file:<path>` whenever the alias equals the package's own name. The importer side already stripped that self-alias; the strip is now shared with the snapshot side, so a workspace with nested `file:` deps (vite's license fixtures) round-trips through `pnpm dedupe --check` against a pnpm-written lockfile. pnpm 11 already resolves these correctly and covers the shape with its `deep local` test, so no TypeScript change is needed. Closes pnpm#13323
Summary
A
file:specifier is relative to the directory of the manifest that declares it — pnpm'sparentPkg.rootDir. Pacquet's tree walk threaded the importer'sproject_dirthrough every depth, so afile:dependency of a package that was itself installed from a local directory got resolved against the importer. In the reported layout,file:../childdeclared bypackages/license/parentresolved topackages/childand the install failed withERR_PNPM_LINKED_PKG_DIR_NOT_FOUND.The children walk now derives the declaring package's directory from its directory resolution and hands it to each
file:child's resolve options. It joins the per-wanted dedup key throughproject_relative_cache_scope, so two parents declaring the same relative specifier no longer share one resolution.Fixing resolution exposed a second divergence in the same scenario: the snapshot reference. Pacquet wrote
<name>@file:<path>where pnpm writes the barefile:<path>whenever the alias equals the package's own name. The importer side already stripped that self-alias, so the strip is now shared with the snapshot side. Without it,pnpm dedupe --checkonvitejs/vitewould still report a diff against the committed lockfile.Verified against pnpm 11.17.0 by running both stacks over vite's
packages/vite/src/node/__tests__/plugins/fixtures/licenseshape: the lockfiles are now byte-identical, as they are for three other layouts (single project,packages/*,packages/**).pnpm 11 already resolves these correctly and covers the shape with its
deep localtest ininstalling/deps-installer/test/install/local.ts, so this is pacquet-only — no TypeScript change is needed.Closes #13323
Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-opus-5[1m]).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.