Skip to content

fix(store.path): keep the store inside the project when nothing above it is linkable - #13536

Merged
zkochan merged 5 commits into
pnpm:mainfrom
edwardlong-ctrl:fix/pnpm-13525-local
Aug 5, 2026
Merged

zkochan merged 5 commits into
pnpm:mainfrom
edwardlong-ctrl:fix/pnpm-13525-local

Conversation

@edwardlong-ctrl

@edwardlong-ctrl edwardlong-ctrl commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #13525.

dirsAreEqual compared the result of path.relative() with '.', but Node returns '' for equal paths, so both equality checks in storePathRelativeToHome were always false. The dead branch would have placed the store in the home directory whenever the project folder was the only linkable location.

The original version of this PR repaired the comparison. Measuring the result showed that executing the branch is the wrong trade, so this PR now removes it instead.

The branch fires exactly when no ancestor of the project accepts a hard link — an agent sandbox that grants write access only to the project, or a container with just the project bind-mounted writable. In a read-only-root sandbox (bwrap --ro-bind / / with only the project writable):

store location result
<project>/.pnpm-store (what pnpm has always shipped) install succeeds, hard linked
~/.local/share/pnpm/store/v11 (repairing the comparison) fails with EROFS ... symlink .../store/v11/projects/38f7f...

When the home directory is writable, it is on another volume by construction — that is why the earlier canLink probe failed — so the home store forces a full copy of every package and reuses nothing, which is the worst outcome in CI. A store on the project's own volume is the better answer in both cases.

So: the dead branch is removed rather than repaired, and the surviving root guard drops the helper for a plain string comparison of two path.join results. The TypeScript CLI's behavior does not change — it is what pnpm has shipped since @pnpm/store-path moved into the monorepo.

pacquet

pacquet implemented the intended-but-dead branch, so it inherited both failure modes. It now keeps the store in the project too, at <project>/node_modules/.pnpm-store rather than pnpm 11's <project>/.pnpm-store, which keeps it out of the working tree's VCS status — the complaint in #13525. This is a deliberate divergence between the two stacks, documented in the store_path module docs.

The install purge skips hidden entries other than .bin, .modules.yaml, and the virtual store dir, so a layout change cannot wipe a store nested there; test_install_purges_node_modules_on_layout_mismatch now pins that.

Squash Commit Body

`dirsAreEqual` compared the result of `path.relative()` with `'.'`, but
Node returns `''` for equal paths, so both equality checks in
`storePathRelativeToHome` were always false. The dead branch would have
placed the store in the home directory whenever the project folder was
the only linkable location.

Executing that branch would be the wrong trade. It fires exactly when no
ancestor of the project accepts a hard link — an agent sandbox that
grants write access only to the project, or a container with just the
project bind-mounted writable. There the home store is either read-only,
so the install fails outright, or on another volume, so every package is
copied instead of hard linked and nothing is ever reused. A store on the
project's own volume is the better answer in both cases, so the branch is
removed rather than repaired, and the surviving root guard drops the
helper for a plain string comparison of two `path.join` results.

pacquet implemented the intended-but-dead branch, so it inherited both
failure modes; it now keeps the store in the project too. It places the
store at `<project>/node_modules/.pnpm-store` instead of pnpm 11's
`<project>/.pnpm-store`, which keeps it out of the working tree's VCS
status. The install purge already skips hidden entries other than `.bin`,
`.modules.yaml`, and the virtual store dir, so a layout change cannot
wipe the store; `test_install_purges_node_modules_on_layout_mismatch` now
pins that.

Closes pnpm/pnpm#13525

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.
  • Updated the documentation if needed.

Validation

  • pnpm --filter @pnpm/store.path test — 5/5
  • cargo nextest run -p pacquet-config — 453/453
  • cargo nextest run -p pacquet-package-manager test_install_purges_node_modules_on_layout_mismatch — pass, and verified non-vacuous by disabling the purge's hidden-entry skip
  • cargo fmt --check, cargo clippy -D warnings on the touched crates, RUSTDOCFLAGS=-D warnings cargo doc -p pacquet-config
  • pnpm run lint:meta, cspell, pnpm install --frozen-lockfile
  • Rebased onto current main; the unused is-windows devDependencies the test rewrite orphaned were removed along with their lockfile entries

Written by an agent (Claude Code, claude-opus-5[1m]).

Summary by CodeRabbit

  • Bug Fixes

    • Fixed default store placement when only the project directory supports linking.
    • The store is now created at <project>/node_modules/.pnpm-store instead of falling back to the home directory.
    • Improved handling of mount points, drive roots, and project subdirectories.
  • Tests

    • Expanded coverage for platform-specific paths and store placement scenarios.
    • Improved validation of cleanup behavior when store layouts change.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1833be11-804f-47ef-9bec-13085d886715

📥 Commits

Reviewing files that changed from the base of the PR and between 20286fe and 4c97241.

📒 Files selected for processing (1)
  • pnpm11/store/path/src/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm11/store/path/src/index.ts

📝 Walkthrough

Walkthrough

Store resolution now places the store under node_modules/.pnpm-store when only the project directory accepts hard links. Tests cover platform-independent linkability and nested-store preservation. A changeset records patch releases.

Changes

Store path selection

Layer / File(s) Summary
Project-local store resolution
pnpm11/store/path/src/index.ts, pnpm/crates/config/src/store_path.rs
Path equality now recognizes identical paths. Both implementations select <project>/node_modules/.pnpm-store when the project is the only linkable directory.
Cross-platform regression coverage
pnpm11/store/path/test/index.ts, pnpm/crates/config/src/store_path/tests.rs, pnpm/crates/package-manager/src/install/tests.rs
Tests cover platform-independent linkability scenarios and preserve a nested .pnpm-store during purge.
Release and dependency updates
.changeset/sandbox-store-path.md, pnpm11/store/path/package.json
The changeset records patch releases. Obsolete Windows-specific test dependencies are removed.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Retain the home store when the project is the only writable ancestor [#13525] ❌ The implementations select <project>/node_modules/.pnpm-store instead of the home store.
Prevent creation of an unintended project-local .pnpm-store/ [#13525] ❌ The new resolution still creates a store inside the project, under node_modules.

Possibly related issues

Possibly related PRs

  • pnpm/pnpm#13603 — It modifies the same mountpoint-based store resolution and tests.
  • pnpm/pnpm#13452 — It modifies related node_modules store and purge behavior.

Suggested labels: product: pacquet, product: pnpm@11

Suggested reviewers: zkochan

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@edwardlong-ctrl
edwardlong-ctrl marked this pull request as ready for review July 31, 2026 16:06
@edwardlong-ctrl
edwardlong-ctrl requested a review from zkochan as a code owner July 31, 2026 16:06
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@greptile-apps

greptile-apps Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (5): Last reviewed commit: "fix(store.path): compare the mountpoint ..." | Re-trigger Greptile

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 31, 2026
edwardlong-ctrl and others added 2 commits August 5, 2026 14:37
… it is linkable

`dirsAreEqual` compared the result of `path.relative()` with `'.'`, but
Node returns `''` for equal paths, so both equality checks in
`storePathRelativeToHome` were always false. The dead branch would have
placed the store in the home directory whenever the project folder was
the only linkable location.

Executing that branch would be the wrong trade. It fires exactly when no
ancestor of the project accepts a hard link — an agent sandbox that
grants write access only to the project, or a container with just the
project bind-mounted writable. There the home store is either read-only,
so the install fails outright, or on another volume, so every package is
copied instead of hard linked and nothing is ever reused. A store on the
project's own volume is the better answer in both cases, so the branch is
removed rather than repaired, and the surviving root guard drops the
helper for a plain string comparison of two `path.join` results.

pacquet implemented the intended-but-dead branch, so it inherited both
failure modes; it now keeps the store in the project too. It places the
store at `<project>/node_modules/.pnpm-store` instead of pnpm 11's
`<project>/.pnpm-store`, which keeps it out of the working tree's VCS
status. The install purge already skips hidden entries other than `.bin`,
`.modules.yaml`, and the virtual store dir, so a layout change cannot
wipe the store; `test_install_purges_node_modules_on_layout_mismatch` now
pins that.

Closes pnpm#13525
@zkochan
zkochan force-pushed the fix/pnpm-13525-local branch from fe6c862 to fe4dd2b Compare August 5, 2026 14:08
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@zkochan zkochan changed the title fix(store.path): avoid project-local stores in sandboxed directories fix(store.path): keep the store inside the project when nothing above it is linkable Aug 5, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pnpm/crates/package-manager/src/install/tests.rs`:
- Around line 10079-10084: Update the purge regression test around the two
install configurations so both installs use the nested node_modules store path
represented by store_in_modules, then create a marker file with known content
there before the second install. Replace the directory-only exists assertion
with a read-and-compare assertion that verifies the marker content remains after
purging, covering both affected test locations.

In `@pnpm11/store/path/src/index.ts`:
- Around line 62-68: Align the project-root store layout with pacquet’s
<pkg_root>/node_modules/.pnpm-store contract instead of returning
<pkg_root>/.pnpm-store/v11. Update the mountpoint return logic in
pnpm11/store/path/src/index.ts, the corresponding store-path logic and related
test expectations in pnpm/crates/config/src/store_path.rs (lines 23-30 and
100-103) and pnpm/crates/config/src/store_path/tests.rs (lines 146-157), and
update the Rust documentation and changeset to describe the shared layout.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f2c6a6ed-6505-47dc-9e29-907f9444a7fc

📥 Commits

Reviewing files that changed from the base of the PR and between bdb25ee and fe4dd2b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !pnpm-lock.yaml
📒 Files selected for processing (7)
  • .changeset/sandbox-store-path.md
  • pnpm/crates/config/src/store_path.rs
  • pnpm/crates/config/src/store_path/tests.rs
  • pnpm/crates/package-manager/src/install/tests.rs
  • pnpm11/store/path/package.json
  • pnpm11/store/path/src/index.ts
  • pnpm11/store/path/test/index.ts
💤 Files with no reviewable changes (1)
  • pnpm11/store/path/package.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • .changeset/sandbox-store-path.md
  • pnpm11/store/path/test/index.ts

Comment thread pnpm11/store/path/src/index.ts Resolved
The comment on the mountpoint return claimed the home store "would have
to be copied from", which is only true once the project is on a volume
of its own — on a dev machine a home store is often the better place,
and the reason this code doesn't pick it is the sandbox and CI cases,
not a blanket rule. Drop it: the store-path tests already pin which
directory wins.

Trim the pacquet module docs to the one fact a reader can't recover from
the code — that nesting the store under `node_modules` is a deliberate
divergence from pnpm 11 — and drop the inline restatements of it.
@codecov-commenter

codecov-commenter commented Aug 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.09%. Comparing base (bdb25ee) to head (4c97241).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13536      +/-   ##
==========================================
+ Coverage   88.08%   88.09%   +0.01%     
==========================================
  Files         608      608              
  Lines       99032    99032              
==========================================
+ Hits        87231    87241      +10     
+ Misses      11801    11791      -10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@qodo-code-review

qodo-code-review Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (5) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. No mirrored store-path tests 📘 Rule violation ▣ Testability
Description
This PR changes store-path behavior in both Rust and TypeScript, but the asserted outcomes differ
between stacks for the same scenario (“only project directory is linkable”). That means the change
is not covered by mirrored parity tests that validate equivalent behavior across implementations.
Code

pnpm/crates/config/src/store_path/tests.rs[R155-157]

    set_allow(&[&pkg_root_canon]);
-    let resolved =
-        resolve_store_dir::<PrefixProbe>(home_default.clone(), &pnpm_home, &pkg_root_canon);
-    assert_eq!(resolved, home_default);
+    let resolved = resolve_store_dir::<PrefixProbe>(home_default, &pnpm_home, &pkg_root_canon);
+    assert_eq!(resolved, pkg_root_canon.join("node_modules").join(".pnpm-store"));
Relevance

●●● Strong

They’ve accepted adding mirrored cross-stack tests to prevent Rust/TS user-visible behavior drift.

PR-#13597

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2255044 requires mirrored tests across Rust and TypeScript for cross-stack behavior
changes, asserting equivalent outcomes. The Rust test asserts node_modules/.pnpm-store for the
“only pkg_root is linkable” case, while the TypeScript test asserts .pnpm-store/<STORE_VERSION>
for the analogous “only project directory is linkable” scenario, demonstrating a lack of
parity-asserting mirrored tests.

Rule 2255044: Cross-stack behavior changes must have mirrored tests in Rust and TypeScript
pnpm/crates/config/src/store_path/tests.rs[146-158]
pnpm11/store/path/test/index.ts[113-122]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Cross-stack behavior changed but the tests are not mirrored to assert equivalent results; instead, TS and Rust assert different store locations for the same scenario.

## Issue Context
Compliance requires cross-stack behavior changes to have mirrored tests that validate equivalent scenarios and outcomes.

## Fix Focus Areas
- pnpm/crates/config/src/store_path/tests.rs[146-158]
- pnpm11/store/path/test/index.ts[113-122]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. No changeset for @pnpm/store.path 📘 Rule violation § Compliance
Description
The PR modifies the published TypeScript package @pnpm/store.path, but the only added changeset
lists pacquet, so @pnpm/store.path may ship without the required version bump and release note
(and the release tooling may not publish a version containing these changes).
Code

.changeset/sandbox-store-path.md[R1-3]

+---
+"pacquet": patch
+---
Relevance

●●● Strong

Team often fixes changesets to include all modified published packages for correct release bumps.

PR-#11555
PR-#11481
PR-#12931

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713441 requires a changeset to list every affected published TypeScript package by
its exact name. The workspace package at pnpm11/store/path/package.json declares `name:
"@pnpm/store.path"`, and the PR modifies its implementation (including store-path resolution logic)
in pnpm11/store/path/src/index.ts, yet the added changeset front-matter only includes pacquet.
Because the repo uses changesets-based versioning, omitting @pnpm/store.path from the changeset
can cause the change to be missing from release notes and potentially not get a corresponding
published version bump.

Rule 713441: Require changeset for TypeScript package changes
pnpm11/store/path/package.json[1-4]
pnpm11/store/path/src/index.ts[45-69]
.changeset/sandbox-store-path.md[1-3]
pnpm11/store/path/src/index.ts[45-76]
pnpm-workspace.yaml[60-84]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
TypeScript package changes were made to the published workspace package `@pnpm/store.path`, but the only added changeset in this PR targets `pacquet`, which can leave `@pnpm/store.path` without the required version bump/release note.

## Issue Context
This repository uses changesets-based versioning and requires that every affected published TypeScript package be listed in a changeset by its exact `name`. In this PR, `pnpm11/store/path/package.json` declares `name: "@pnpm/store.path"` and `pnpm11/store/path/src/index.ts` is modified, but the new changeset front-matter only lists `pacquet`; if no other changeset exists elsewhere, release metadata for `@pnpm/store.path` will be incomplete.

## Fix Focus Areas
- .changeset/sandbox-store-path.md[1-5]
- pnpm11/store/path/package.json[1-10]
- pnpm11/store/path/src/index.ts[45-76]
- pnpm-workspace.yaml[60-84]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Hardcoded node_modules store 🐞 Bug ⛨ Security
Description
When mountpoint == pkg_root, resolve_store_dir() now returns
<pkg_root>/node_modules/.pnpm-store unconditionally, ignoring the configurable modules_dir
setting. In non-default configurations this can place the store outside the actual modules directory
(and potentially into an unexpected/symlinked node_modules), changing filesystem write boundaries
compared to the configured layout.
Code

pnpm/crates/config/src/store_path.rs[R100-103]

+    // A store under `node_modules` is invisible to the project's VCS
+    // status, which a `<pkg_root>/.pnpm-store` would not be.
    if mountpoint == pkg_root {
-        return home_default;
+        return pkg_root.join("node_modules").join(".pnpm-store");
Relevance

●● Moderate

No close precedent found for modules_dir-override vs hardcoded node_modules in store path; could
be contentious.

PR-#13157

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The store-path resolver hardcodes a node_modules segment in the new fallback branch, while config
supports overriding modules_dir via workspace yaml and env overlays. Store initialization creates
directories beneath the chosen store root, so the hardcoded path becomes an actual write
destination.

pnpm/crates/config/src/store_path.rs[90-107]
pnpm/crates/config/src/lib.rs[2115-2128]
pnpm/crates/config/src/lib.rs[665-673]
pnpm/crates/config/src/workspace_yaml.rs[1098-1109]
pnpm/crates/config/src/env_overlay.rs[138-145]
pnpm/crates/store-dir/src/store_dir.rs[85-98]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`resolve_store_dir()` hardcodes `pkg_root/node_modules/.pnpm-store` for the `mountpoint == pkg_root` fallback, but `modules_dir` is configurable (workspace yaml / env). This means the default store may be created under a directory the user did not configure as the modules directory.

## Issue Context
- `modules_dir` is explicitly described as configurable and as the directory where dependencies are installed.
- Store initialization creates directories under the resolved store root, so the path choice directly affects where pacquet writes.

## Fix Focus Areas
- pnpm/crates/config/src/store_path.rs[96-107]
- pnpm/crates/config/src/lib.rs[2115-2128]
- pnpm/crates/config/src/lib.rs[665-673]
- pnpm/crates/config/src/workspace_yaml.rs[1098-1109]
- pnpm/crates/config/src/env_overlay.rs[138-145]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (2)
4. Historical pnpm 11 comparison 📘 Rule violation ⚙ Maintainability
Description
The new Rust module docs describe behavior in terms of what “pnpm 11” does and frames the current
approach as “deliberately parting” from it, which is historical/comparative commentary rather than
documenting the current contract. This makes the docs easier to become stale and violates the
no-historical-implementation comment rule.
Code

pnpm/crates/config/src/store_path.rs[R23-26]

+//! That case is the one place where pacquet deliberately parts from
+//! pnpm 11, which places the store at `<pkg_root>/.pnpm-store` and so
+//! leaves an untracked directory in the working tree. pacquet nests it
+//! under `node_modules` instead. Installing the same project with both
Relevance

●● Moderate

Mixed history on removing historical/pnpm-version commentary in comments; sometimes accepted,
sometimes rejected.

PR-#13592
PR-#13359
PR-#13652

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 772199 forbids comments that reference historical implementations (e.g., framing
the current code as differing from an old implementation). The added comment explicitly compares to
pnpm 11 and describes the behavior as pacquet “deliberately parting” from it.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/config/src/store_path.rs[23-30]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A newly added comment explains behavior using historical/comparative phrasing (references to pnpm 11) instead of describing only the current behavior/contract.

## Issue Context
Comments must describe current behavior and rationale without embedding historical implementation details.

## Fix Focus Areas
- pnpm/crates/config/src/store_path.rs[23-30]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. TS/Rust store path diverges 📘 Rule violation ⌂ Architecture
Description
In the “only project is linkable” case, Rust returns <pkg_root>/node_modules/.pnpm-store while
TypeScript returns <pkg_root>/.pnpm-store/<STORE_VERSION>, creating observable
cross-implementation behavior differences. This violates the parity requirement and also introduces
a pacquet behavior that pnpm does not implement in the TypeScript side of this PR.
Code

pnpm/crates/config/src/store_path.rs[R100-103]

+    // A store under `node_modules` is invisible to the project's VCS
+    // status, which a `<pkg_root>/.pnpm-store` would not be.
    if mountpoint == pkg_root {
-        return home_default;
+        return pkg_root.join("node_modules").join(".pnpm-store");
Relevance

●● Moderate

Parity alignment is frequently accepted, but no clear precedent approving/rejecting this specific
store-path divergence.

PR-#12789
PR-#13464
PR-#13597

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance IDs 713428 and 713429 require keeping user-visible behavior aligned between pnpm
(TypeScript) and pacquet (Rust), and disallow pacquet-only user-visible behavior. The Rust
implementation returns a node_modules/.pnpm-store location when mountpoint == pkg_root, but the
TypeScript implementation returns <mountpoint>/.pnpm-store/<STORE_VERSION> and tests assert that
result, demonstrating divergence for the same scenario.

Rule 713428: Keep pnpm TypeScript and pacquet Rust user-visible behavior changes in sync
Rule 713429: Pacquet must not introduce new user-visible behavior beyond pnpm
pnpm/crates/config/src/store_path.rs[100-106]
pnpm11/store/path/src/index.ts[61-69]
pnpm11/store/path/test/index.ts[113-122]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The store-path resolution behavior diverges between TypeScript and Rust for the same scenario (only the project directory accepts hard links).

## Issue Context
Compliance requires pnpm TypeScript and pacquet Rust user-visible behavior changes to remain in sync, and pacquet must not add user-visible behavior beyond pnpm.

## Fix Focus Areas
- pnpm/crates/config/src/store_path.rs[100-106]
- pnpm11/store/path/src/index.ts[61-69]
- pnpm11/store/path/test/index.ts[113-122]
- pnpm/crates/config/src/store_path/tests.rs[146-158]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

6. Test comment misstates default 🐞 Bug ⚙ Maintainability ⭐ New
Description
The updated test comment says node_modules/.pnpm-store is where the default store lands, but the
test explicitly sets config.store_dir to that location, so it does not actually validate default
store-path resolution. This can create false confidence about regression coverage for “default store
location” behavior.
Code

pnpm/crates/package-manager/src/install/tests.rs[R10003-10004]

+    // Where the default store lands — see [`pacquet_config::store_path`].
+    let store_dir = modules_dir.join(".pnpm-store");
Relevance

●●● Strong

They commonly accept correcting misleading/stale comments in tests for maintainability.

PR-#13652

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The comment introduces the claim, but the test later assigns store_dir directly into both configs,
meaning the path is not obtained via any default store-path algorithm.

pnpm/crates/package-manager/src/install/tests.rs[10003-10004]
pnpm/crates/package-manager/src/install/tests.rs[10011-10022]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
A comment claims the test uses the *default* store location, but the test injects `store_dir` via `config.store_dir`, so it only tests purge behavior for a store placed under `node_modules`.

### Issue Context
This is test-only, but misleading comments can cause maintainers to misjudge what behavior is covered.

### Fix
Either:
- Update the comment to say the test *simulates* the default store placement (or that it pins purge behavior for a store under `node_modules`).
- Or, if feasible in this test, compute the store dir via the default store-path resolution code and assert it equals `node_modules/.pnpm-store`, then use that derived value.

### Fix Focus Areas
- pnpm/crates/package-manager/src/install/tests.rs[10003-10004]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. VCS ignore claim too strong 🐞 Bug ⚙ Maintainability ⭐ New
Description
The new module docs assert <pkg_root>/node_modules/.pnpm-store is ignored by the project’s VCS,
but the implementation only chooses a path and does not (and cannot) enforce any VCS ignore policy.
This can mislead users/maintainers in repos that don’t ignore node_modules (or use different
ignore rules) about expected git status noise and repo size impact.
Code

pnpm/crates/config/src/store_path.rs[R16-19]

+//! above it accepts a hard link. The store then goes to
+//! `<pkg_root>/node_modules/.pnpm-store`, where the project's VCS
+//! ignores it — deliberately not the `<pkg_root>/.pnpm-store` pnpm 11
+//! uses, so a project installed with both CLIs reports
Relevance

●●● Strong

Team often accepts doc wording fixes that avoid overstating guarantees/invariants.

PR-#13652

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The docs make an unconditional claim about VCS behavior, while the function returns a filesystem
path only and contains no behavior that would create or enforce VCS ignore rules.

pnpm/crates/config/src/store_path.rs[15-20]
pnpm/crates/config/src/store_path.rs[63-95]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The rustdoc claims the store under `node_modules` is ignored by the project’s VCS. This is not guaranteed: pnpm/pacquet do not write ignore rules or inspect VCS config.

### Issue Context
This is documentation-only, but it risks setting incorrect expectations for users and future maintainers.

### Fix
Adjust the wording to be conditional/typical, e.g. “often ignored by default ignore rules (e.g. `node_modules`)” or “recommended to add to VCS ignore rules if needed”, rather than asserting it is ignored.

### Fix Focus Areas
- pnpm/crates/config/src/store_path.rs[16-20]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. pnpm missing in changeset 📘 Rule violation § Compliance
Description
The new changeset omits a pnpm entry in its front-matter, so the main pnpm package will not
receive a version bump/release note for this change. This violates the changeset requirement to
explicitly declare pnpm with a valid bump type.
Code

.changeset/sandbox-store-path.md[R1-3]

+---
+"pacquet": patch
+---
Relevance

● Weak

Multiple recent PRs rejected adding required pnpm entry to pacquet-only changesets.

PR-#13594
PR-#13587
PR-#13549

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires each new/modified changeset to include an explicit pnpm entry
with a valid bump type. The added changeset front-matter lists only pacquet and omits pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/sandbox-store-path.md[1-3]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new changeset file does not include a `pnpm` entry in its front-matter.

## Issue Context
Compliance requires each new/modified changeset to explicitly declare the `pnpm` package and a valid bump type (`patch`/`minor`/`major`).

## Fix Focus Areas
- .changeset/sandbox-store-path.md[1-3]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context used
✅ Compliance rules (platform): 24 rules

To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Previous review results

Review updated until commit 4c97241

Results up to commit fe4dd2b ⚖️ Balanced


🐞 Bugs (1) 📘 Rule violations (5) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)


Remediation recommended
1. No changeset for @pnpm/store.path 📘 Rule violation § Compliance
Description
The PR modifies the published TypeScript package @pnpm/store.path, but the only added changeset
lists pacquet, so @pnpm/store.path may ship without the required version bump and release note
(and the release tooling may not publish a version containing these changes).
Code

.changeset/sandbox-store-path.md[R1-3]

+---
+"pacquet": patch
+---
Relevance

●●● Strong

Team often fixes changesets to include all modified published packages for correct release bumps.

PR-#11555
PR-#11481
PR-#12931

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713441 requires a changeset to list every affected published TypeScript package by
its exact name. The workspace package at pnpm11/store/path/package.json declares `name:
"@pnpm/store.path"`, and the PR modifies its implementation (including store-path resolution logic)
in pnpm11/store/path/src/index.ts, yet the added changeset front-matter only includes pacquet.
Because the repo uses changesets-based versioning, omitting @pnpm/store.path from the changeset
can cause the change to be missing from release notes and potentially not get a corresponding
published version bump.

Rule 713441: Require changeset for TypeScript package changes
pnpm11/store/path/package.json[1-4]
pnpm11/store/path/src/index.ts[45-69]
.changeset/sandbox-store-path.md[1-3]
pnpm11/store/path/src/index.ts[45-76]
pnpm-workspace.yaml[60-84]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
TypeScript package changes were made to the published workspace package `@pnpm/store.path`, but the only added changeset in this PR targets `pacquet`, which can leave `@pnpm/store.path` without the required version bump/release note.

## Issue Context
This repository uses changesets-based versioning and requires that every affected published TypeScript package be listed in a changeset by its exact `name`. In this PR, `pnpm11/store/path/package.json` declares `name: "@pnpm/store.path"` and `pnpm11/store/path/src/index.ts` is modified, but the new changeset front-matter only lists `pacquet`; if no other changeset exists elsewhere, release metadata for `@pnpm/store.path` will be incomplete.

## Fix Focus Areas
- .changeset/sandbox-store-path.md[1-5]
- pnpm11/store/path/package.json[1-10]
- pnpm11/store/path/src/index.ts[45-76]
- pnpm-workspace.yaml[60-84]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. No mirrored store-path tests 📘 Rule violation ▣ Testability
Description
This PR changes store-path behavior in both Rust and TypeScript, but the asserted outcomes differ
between stacks for the same scenario (“only project directory is linkable”). That means the change
is not covered by mirrored parity tests that validate equivalent behavior across implementations.
Code

pnpm/crates/config/src/store_path/tests.rs[R155-157]

    set_allow(&[&pkg_root_canon]);
-    let resolved =
-        resolve_store_dir::<PrefixProbe>(home_default.clone(), &pnpm_home, &pkg_root_canon);
-    assert_eq!(resolved, home_default);
+    let resolved = resolve_store_dir::<PrefixProbe>(home_default, &pnpm_home, &pkg_root_canon);
+    assert_eq!(resolved, pkg_root_canon.join("node_modules").join(".pnpm-store"));
Relevance

●●● Strong

They’ve accepted adding mirrored cross-stack tests to prevent Rust/TS user-visible behavior drift.

PR-#13597

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2255044 requires mirrored tests across Rust and TypeScript for cross-stack behavior
changes, asserting equivalent outcomes. The Rust test asserts node_modules/.pnpm-store for the
“only pkg_root is linkable” case, while the TypeScript test asserts .pnpm-store/<STORE_VERSION>
for the analogous “only project directory is linkable” scenario, demonstrating a lack of
parity-asserting mirrored tests.

Rule 2255044: Cross-stack behavior changes must have mirrored tests in Rust and TypeScript
pnpm/crates/config/src/store_path/tests.rs[146-158]
pnpm11/store/path/test/index.ts[113-122]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Cross-stack behavior changed but the tests are not mirrored to assert equivalent results; instead, TS and Rust assert different store locations for the same scenario.

## Issue Context
Compliance requires cross-stack behavior changes to have mirrored tests that validate equivalent scenarios and outcomes.

## Fix Focus Areas
- pnpm/crates/config/src/store_path/tests.rs[146-158]
- pnpm11/store/path/test/index.ts[113-122]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. TS/Rust store path diverges 📘 Rule violation ⌂ Architecture
Description
In the “only project is linkable” case, Rust returns <pkg_root>/node_modules/.pnpm-store while
TypeScript returns <pkg_root>/.pnpm-store/<STORE_VERSION>, creating observable
cross-implementation behavior differences. This violates the parity requirement and also introduces
a pacquet behavior that pnpm does not implement in the TypeScript side of this PR.
Code

pnpm/crates/config/src/store_path.rs[R100-103]

+    // A store under `node_modules` is invisible to the project's VCS
+    // status, which a `<pkg_root>/.pnpm-store` would not be.
    if mountpoint == pkg_root {
-        return home_default;
+        return pkg_root.join("node_modules").join(".pnpm-store");
Relevance

●● Moderate

Parity alignment is frequently accepted, but no clear precedent approving/rejecting this specific
store-path divergence.

PR-#12789
PR-#13464
PR-#13597

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance IDs 713428 and 713429 require keeping user-visible behavior aligned between pnpm
(TypeScript) and pacquet (Rust), and disallow pacquet-only user-visible behavior. The Rust
implementation returns a node_modules/.pnpm-store location when mountpoint == pkg_root, but the
TypeScript implementation returns <mountpoint>/.pnpm-store/<STORE_VERSION> and tests assert that
result, demonstrating divergence for the same scenario.

Rule 713428: Keep pnpm TypeScript and pacquet Rust user-visible behavior changes in sync
Rule 713429: Pacquet must not introduce new user-visible behavior beyond pnpm
pnpm/crates/config/src/store_path.rs[100-106]
pnpm11/store/path/src/index.ts[61-69]
pnpm11/store/path/test/index.ts[113-122]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The store-path resolution behavior diverges between TypeScript and Rust for the same scenario (only the project directory accepts hard links).

## Issue Context
Compliance requires pnpm TypeScript and pacquet Rust user-visible behavior changes to remain in sync, and pacquet must not add user-visible behavior beyond pnpm.

## Fix Focus Areas
- pnpm/crates/config/src/store_path.rs[100-106]
- pnpm11/store/path/src/index.ts[61-69]
- pnpm11/store/path/test/index.ts[113-122]
- pnpm/crates/config/src/store_path/tests.rs[146-158]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (2)
4. Historical pnpm 11 comparison 📘 Rule violation ⚙ Maintainability
Description
The new Rust module docs describe behavior in terms of what “pnpm 11” does and frames the current
approach as “deliberately parting” from it, which is historical/comparative commentary rather than
documenting the current contract. This makes the docs easier to become stale and violates the
no-historical-implementation comment rule.
Code

pnpm/crates/config/src/store_path.rs[R23-26]

+//! That case is the one place where pacquet deliberately parts from
+//! pnpm 11, which places the store at `<pkg_root>/.pnpm-store` and so
+//! leaves an untracked directory in the working tree. pacquet nests it
+//! under `node_modules` instead. Installing the same project with both
Relevance

●● Moderate

Mixed history on removing historical/pnpm-version commentary in comments; sometimes accepted,
sometimes rejected.

PR-#13592
PR-#13359
PR-#13652

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 772199 forbids comments that reference historical implementations (e.g., framing
the current code as differing from an old implementation). The added comment explicitly compares to
pnpm 11 and describes the behavior as pacquet “deliberately parting” from it.

Rule 772199: Comments must describe current behavior, not historical implementations
pnpm/crates/config/src/store_path.rs[23-30]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A newly added comment explains behavior using historical/comparative phrasing (references to pnpm 11) instead of describing only the current behavior/contract.

## Issue Context
Comments must describe current behavior and rationale without embedding historical implementation details.

## Fix Focus Areas
- pnpm/crates/config/src/store_path.rs[23-30]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Hardcoded node_modules store 🐞 Bug ⛨ Security
Description
When mountpoint == pkg_root, resolve_store_dir() now returns
<pkg_root>/node_modules/.pnpm-store unconditionally, ignoring the configurable modules_dir
setting. In non-default configurations this can place the store outside the actual modules directory
(and potentially into an unexpected/symlinked node_modules), changing filesystem write boundaries
compared to the configured layout.
Code

pnpm/crates/config/src/store_path.rs[R100-103]

+    // A store under `node_modules` is invisible to the project's VCS
+    // status, which a `<pkg_root>/.pnpm-store` would not be.
    if mountpoint == pkg_root {
-        return home_default;
+        return pkg_root.join("node_modules").join(".pnpm-store");
Relevance

●● Moderate

No close precedent found for modules_dir-override vs hardcoded node_modules in store path; could
be contentious.

PR-#13157

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The store-path resolver hardcodes a node_modules segment in the new fallback branch, while config
supports overriding modules_dir via workspace yaml and env overlays. Store initialization creates
directories beneath the chosen store root, so the hardcoded path becomes an actual write
destination.

pnpm/crates/config/src/store_path.rs[90-107]
pnpm/crates/config/src/lib.rs[2115-2128]
pnpm/crates/config/src/lib.rs[665-673]
pnpm/crates/config/src/workspace_yaml.rs[1098-1109]
pnpm/crates/config/src/env_overlay.rs[138-145]
pnpm/crates/store-dir/src/store_dir.rs[85-98]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`resolve_store_dir()` hardcodes `pkg_root/node_modules/.pnpm-store` for the `mountpoint == pkg_root` fallback, but `modules_dir` is configurable (workspace yaml / env). This means the default store may be created under a directory the user did not configure as the modules directory.

## Issue Context
- `modules_dir` is explicitly described as configurable and as the directory where dependencies are installed.
- Store initialization creates directories under the resolved store root, so the path choice directly affects where pacquet writes.

## Fix Focus Areas
- pnpm/crates/config/src/store_path.rs[96-107]
- pnpm/crates/config/src/lib.rs[2115-2128]
- pnpm/crates/config/src/lib.rs[665-673]
- pnpm/crates/config/src/workspace_yaml.rs[1098-1109]
- pnpm/crates/config/src/env_overlay.rs[138-145]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational
6. pnpm missing in changeset 📘 Rule violation § Compliance
Description
The new changeset omits a pnpm entry in its front-matter, so the main pnpm package will not
receive a version bump/release note for this change. This violates the changeset requirement to
explicitly declare pnpm with a valid bump type.
Code

.changeset/sandbox-store-path.md[R1-3]

+---
+"pacquet": patch
+---
Relevance

● Weak

Multiple recent PRs rejected adding required pnpm entry to pacquet-only changesets.

PR-#13594
PR-#13587
PR-#13549

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 713436 requires each new/modified changeset to include an explicit pnpm entry
with a valid bump type. The added changeset front-matter lists only pacquet and omits pnpm.

Rule 713436: Explicitly declare pnpm package and correct bump type in changesets
.changeset/sandbox-store-path.md[1-3]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new changeset file does not include a `pnpm` entry in its front-matter.

## Issue Context
Compliance requires each new/modified changeset to explicitly declare the `pnpm` package and a valid bump type (`patch`/`minor`/`major`).

## Fix Focus Areas
- .changeset/sandbox-store-path.md[1-3]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

The purge regression test created an empty `node_modules/.pnpm-store`
and asserted only that the directory existed afterwards, so a purge that
deleted and recreated it would still pass. `store_dir` also pointed
outside `node_modules`, leaving the directory unrelated to the store the
assertion was about.

Both installs now use `<modules_dir>/.pnpm-store` as their store, and a
marker file written before the second install has to come back with its
contents intact.
@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 20286fe

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

…tive

A string comparison of the two paths assumes both are already
normalized the same way, which holds only as long as `rootLinkTarget`
returns a resolved path. `path.relative` does not depend on that, and on
Windows it compares case-insensitively, so `C:\Foo` and `c:\foo` are
recognized as the same directory.
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 4c97241

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

/improve is deprecated. Use /agentic_review instead (removal date not yet scheduled).

No code suggestions found for the PR.

@zkochan
zkochan merged commit 21429c6 into pnpm:main Aug 5, 2026
33 of 34 checks passed
@welcome

welcome Bot commented Aug 5, 2026

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

@coderabbitai coderabbitai Bot mentioned this pull request Aug 18, 2026
5 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pnpm creates unintended project-local .pnpm-store/ in AI agent sandboxes

3 participants