Skip to content

fix: allow standalone pnpm downgrades - #12840

Merged
zkochan merged 4 commits into
mainfrom
fix-downgrade-of-pnpm
Jul 7, 2026
Merged

zkochan merged 4 commits into
mainfrom
fix-downgrade-of-pnpm

Conversation

@zkochan

@zkochan zkochan commented Jul 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Allows standalone installs to replace an existing global pnpm entry when the package identity changes between pnpm and @pnpm/exe. This fixes downgrading from pnpm v12 to pnpm v11 through the standalone installer without weakening bin-conflict checks for unrelated global packages.

The same replacement alias handling is mirrored in pacquet.

Squash Commit Body

Treat pnpm and `@pnpm/exe` as equivalent replacement aliases during isolated global installs.

The standalone installer for pnpm v11 installs the downloaded binary as a local `@pnpm/exe` package, while pnpm v12 records the global CLI as `pnpm`. Before this change, the global bin conflict check saw both packages as distinct owners of the `pnpm` bin and failed before the existing install could be removed.

Expand the replacement alias set only for the pnpm-managed package pair before conflict checking and removal. The install still hashes and records the actual resolved aliases, and unrelated bin conflicts continue to fail.

Mirror the same behavior in pacquet.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pacquet/ 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.

Written by an agent (Codex, GPT-5).

Summary by CodeRabbit

  • Bug Fixes
    • Fixed standalone installer downgrades when moving from pnpm v12 to v11.
    • Improved global install conflict handling for pnpm CLI alias variants, so switching between pnpm and @pnpm/exe replaces the correct existing global install.
  • Tests
    • Added/expanded unit and Jest coverage for pnpm alias expansion and replacement behavior, including bin-conflict scenarios during global add operations.

Copilot AI review requested due to automatic review settings July 7, 2026 13:47

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 7415d5a6-2d24-4801-815a-1e0033a8bbc7

📥 Commits

Reviewing files that changed from the base of the PR and between 92233bf and 13b86f5.

📒 Files selected for processing (1)
  • pnpm11/global/commands/test/globalAdd.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm11/global/commands/test/globalAdd.test.ts

📝 Walkthrough

Walkthrough

Adds pnpm alias-replacement handling in both the pnpm11 TypeScript and pacquet Rust global install flows so pnpm and @pnpm/exe are treated as interchangeable during conflict checks and existing-install removal. Includes tests and a changeset entry.

Changes

pnpm alias replacement in global installers

Layer / File(s) Summary
Rust global add replacement rules
pacquet/crates/cli/src/cli_args/global.rs, pacquet/crates/cli/src/cli_args/global/tests.rs
Adds replacement_aliases plus replacement predicates in the Rust global install path, then uses the expanded aliases for conflict checks and cleanup; tests cover alias expansion and replacement behavior.
TypeScript global add replacement rules
pnpm11/global/commands/src/globalAdd.ts, pnpm11/global/commands/test/globalAdd.test.ts, .changeset/standalone-downgrade-pnpm.md
Adds PNPM_CLI_PACKAGE_ALIASES, getReplacementAliases, and shouldReplaceExistingGlobalInstall, then uses expanded replacement aliases for bin-conflict checks and removal; tests cover alias expansion and replacement decisions, and the changeset records the downgrade fix.

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

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

Suggested reviewers: qodo-free-for-open-source-projects

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-downgrade-of-pnpm

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.

@qodo-code-review

qodo-code-review Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Fix standalone pnpm downgrades by treating pnpm and @pnpm/exe as replacements

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Treat pnpm and @pnpm/exe as equivalent aliases when replacing standalone global installs.
• Keep bin-conflict checks strict for unrelated global packages.
• Mirror the same replacement-alias behavior in the Rust pacquet CLI, with tests.
Diagram

graph TD
  U["Standalone installer"] --> ADD["Global add (pnpm/pacquet)"] --> DEC{"Alias is pnpm\n or @pnpm/exe?"}
  DEC -- "Yes" --> EXP["Expand replacement aliases"] --> CHECK["Check bin conflicts"] --> RM["Remove existing installs"] --> STATE[("Global pkg/bin state")]
  DEC -- "No" --> CHECK
  CHECK -. "scans" .-> STATE

  subgraph Legend
    direction LR
    _proc["Process"] ~~~ _dec{"Decision"} ~~~ _db[("State")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Canonicalize pnpm CLI identity in global metadata
  • ➕ Eliminates future alias-identity mismatches at the source
  • ➕ May simplify replacement/removal logic elsewhere
  • ➖ Requires migration logic and compatibility handling across versions
  • ➖ Higher risk of breaking existing global install layouts
2. Teach bin-conflict checker a pnpm-specific equivalence rule
  • ➕ Keeps replacement logic localized to conflict detection
  • ➕ Avoids expanding alias lists passed to removal
  • ➖ More subtle: conflict checker must know package-identity semantics
  • ➖ Still needs coordinated change in both TS and Rust to stay consistent
3. Always allow replacement when bin names match (looser rule)
  • ➕ Simpler mental model; fewer special cases
  • ➖ Weakens safety guarantees by allowing unrelated packages to replace each other’s bins
  • ➖ Increases risk of accidental global package removal

Recommendation: Proceed with the PR’s current approach: expand the replacement alias set only when the resolved aliases include pnpm or @pnpm/exe, and use that expanded set solely for conflict-check skipping and removal. It’s a minimal, targeted fix that preserves strict bin-conflict behavior for unrelated packages and is mirrored in pacquet for behavioral parity.

Files changed (5) +141 / -5

Bug fix (2) +29 / -4
global.rsExpand pnpm replacement aliases during isolated global add (pacquet) +19/-2

Expand pnpm replacement aliases during isolated global add (pacquet)

• Introduces 'replacement_aliases()' to treat 'pnpm' and '@pnpm/exe' as equivalent for replacement purposes. Uses the expanded alias set when deciding which existing packages to skip in bin-conflict checks and which installs to remove, while keeping the cache key based on the actual resolved aliases.

pacquet/crates/cli/src/cli_args/global.rs

globalAdd.tsTreat pnpm and @pnpm/exe as replacement aliases in globalAdd +10/-2

Treat pnpm and @pnpm/exe as replacement aliases in globalAdd

• Adds 'getReplacementAliases()' and uses it for bin-conflict skip checks and for removing existing global installs. The install still records and hashes the actual resolved aliases from the installed package.json.

pnpm11/global/commands/src/globalAdd.ts

Tests (2) +106 / -1
tests.rsAdd pacquet tests for pnpm/@pnpm/exe alias expansion +15/-1

Add pacquet tests for pnpm/@pnpm/exe alias expansion

• Adds unit tests ensuring 'replacement_aliases()' expands only for the pnpm CLI alias pair and leaves unrelated aliases unchanged.

pacquet/crates/cli/src/cli_args/global/tests.rs

globalAdd.test.tsAdd Jest coverage for standalone downgrade replacement behavior +91/-0

Add Jest coverage for standalone downgrade replacement behavior

• Adds tests for 'getReplacementAliases()' and an integration-style unit test that verifies an existing 'pnpm' global install is treated as replaceable when installing '@pnpm/exe', including conflict-check skip behavior and bin removal/linking calls.

pnpm11/global/commands/test/globalAdd.test.ts

Documentation (1) +6 / -0
standalone-downgrade-pnpm.mdAdd release note for standalone pnpm downgrade fix +6/-0

Add release note for standalone pnpm downgrade fix

• Adds a patch changeset for '@pnpm/global.commands' and 'pnpm' documenting that standalone downgrades from pnpm v12 to v11 are fixed.

.changeset/standalone-downgrade-pnpm.md

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (4) 📘 Rule violations (1) 📜 Skill insights (0)

Grey Divider


Action required

1. Collateral group uninstall ✓ Resolved 🐞 Bug ☼ Reliability
Description
In pacquet, expanding replacement aliases so pnpm and @pnpm/exe replace each other can make
standalone installs/downgrades match an existing comma-grouped global install that includes pnpm
plus other packages, causing remove_existing_global_installs to remove the entire group and
unintentionally uninstall unrelated packages. This occurs because global installs support
multi-package comma groups while removals are performed at the group/hash level rather than per
individual alias.
Code

pacquet/crates/cli/src/cli_args/global.rs[R109-122]

let pkgs = read_installed_packages(&install_dir);
let aliases = read_direct_dependency_aliases(&install_dir);
+        let aliases_to_replace = replacement_aliases(&aliases);
let bins_to_skip = match check_global_bin_conflicts(
   &global_pkg_dir,
   &global_bin_dir,
   &pkgs,
-            |existing: &GlobalPackageInfo| aliases.iter().any(|alias| existing.has_alias(alias)),
+            |existing: &GlobalPackageInfo| {
+                aliases_to_replace.iter().any(|alias| existing.has_alias(alias))
+            },
) {
   Ok(skip) => skip,
   Err(error) => {
Evidence
The cited logic supports multi-package global “groups” created from comma-separated selectors (via
group splitting), meaning a single global group can legitimately contain pnpm alongside unrelated
packages. The removal helper operates by deleting whole groups using their hash/install directory
rather than removing just the single matched alias, and with the new replacement-alias expansion
(pnpm↔@pnpm/exe) an install of one identity can now match the other identity’s existing group;
if that matched group is mixed, the group-scoped deletion necessarily removes the unrelated packages
too, demonstrating the unintended uninstall risk.

pacquet/crates/cli/src/cli_args/global.rs[109-131]
pacquet/crates/cli/src/cli_args/global.rs[410-434]
pacquet/crates/cli/src/cli_args/global.rs[498-522]
pnpm11/global/commands/src/globalAdd.ts[59-66]
pnpm11/global/commands/src/globalAdd.ts[140-163]
pnpm11/global/commands/src/globalAdd.ts[235-273]

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

## Issue description
Replacement-alias expansion makes `pnpm` and `@pnpm/exe` replace each other, and that expanded alias set is used for both conflict skipping and global group removal. Because global installs can create comma-grouped multi-package groups and removal is group/hash-scoped, a standalone `@pnpm/exe` (or `pnpm`) install can match an existing mixed `pnpm,...` group and delete the whole group, unintentionally uninstalling unrelated packages.
## Issue Context
- Global installs support comma-separated selectors that form a single multi-package “group”.
- Removal deletes entire groups by hash/install directory (not per individual alias).
- With the new alias equivalence, installing `@pnpm/exe` can target existing `pnpm` groups (and vice versa), which is unsafe when the existing group contains other packages.
- Repro example: a user previously installed a comma group like `pnpm,eslint` into one global group; a later standalone downgrade/replace that installs `@pnpm/exe` expands replacement aliases to include `pnpm`, matches that group, and removes it, uninstalling `eslint` too.
## Fix Focus Areas
- pacquet/crates/cli/src/cli_args/global.rs[109-131]
- pacquet/crates/cli/src/cli_args/global.rs[410-434]
- pacquet/crates/cli/src/cli_args/global.rs[498-522]
- pnpm11/global/commands/src/globalAdd.ts[140-175]
- pnpm11/global/commands/src/globalAdd.ts[235-273]
### Suggested fix direction
Only treat a group as replaceable due to the `pnpm`↔`@pnpm/exe` alias equivalence when the *existing group is pnpm-only* (i.e., its dependencies are limited to just `pnpm` and/or `@pnpm/exe`).
Implementation sketch:
- Introduce a helper/predicate (e.g., `isPnpmCliOnlyGroup`) that checks the group’s dependency keys are a subset of `{ "pnpm", "@pnpm/exe" }`.
- In both the bin-conflict skipping predicate/closure and in the group-removal filtering (`remove_existing_global_installs` / `removeExistingGlobalInstalls`), if the match is coming specifically from the pnpm alias-equivalence expansion, require `isPnpmCliOnlyGroup`; otherwise do not skip/remove.
- If a non-pnpm-only group is detected, fail fast with a targeted error explaining that the group contains other packages and must be removed/reinstalled manually (or installed without comma-grouping) to avoid uninstalling unrelated packages.

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


2. removeExistingGlobalInstalls has 4 params ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The modified removeExistingGlobalInstalls function now takes four positional parameters, exceeding
the maximum of three allowed by the TypeScript parameter limit rule. This increases call-site
complexity and makes the API harder to use consistently across the codebase.
Code

pnpm11/global/commands/src/globalAdd.ts[R250-255]

async function removeExistingGlobalInstalls (
globalDir: string,
globalBinDir: string,
-  aliases: string[]
+  aliases: string[],
+  replacementAliases: string[]
): Promise<void> {
Evidence
PR Compliance ID 713433 requires TypeScript functions to have three parameters or fewer (or use an
options object). The updated removeExistingGlobalInstalls signature includes four parameters.

Rule 713433: Limit TypeScript functions to three parameters or fewer
pnpm11/global/commands/src/globalAdd.ts[250-255]

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

## Issue description
`removeExistingGlobalInstalls` now has 4 positional parameters (`globalDir`, `globalBinDir`, `aliases`, `replacementAliases`), violating the rule that TypeScript functions must have 3 parameters or fewer.
## Issue Context
This signature was expanded to support pnpm vs `@pnpm/exe` replacement-alias handling.
## Fix Focus Areas
- pnpm11/global/commands/src/globalAdd.ts[163-163]
- pnpm11/global/commands/src/globalAdd.ts[250-255]

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



Remediation recommended

3. Unsafe absolute-path test 🐞 Bug ☼ Reliability
Description
The new globalAdd unit test calls handleGlobalAdd() with absolute paths like /global/v11, and
the production code path it exercises performs real fs.promises.rm() calls derived from
globalPkgDir/getHashLink(). If those paths exist on the machine running tests (and permissions
allow), the test can delete real filesystem entries outside a sandboxed temp directory.
Code

pnpm11/global/commands/test/globalAdd.test.ts[R112-117]

+  await handleGlobalAdd({
+    bin: '/global/bin',
+    dir: '/project',
+    globalPkgDir: '/global/v11',
+    registries: {},
+  } as any, ['file:/tmp/pnpm'], {}) // eslint-disable-line @typescript-eslint/no-explicit-any
Evidence
The test hard-codes /global/v11 and mocks getHashLink(globalDir, hash) to return
${globalDir}/${hash}, which becomes the argument to fs.promises.rm() in the real
removeExistingGlobalInstalls() implementation, making the test capable of deleting real paths if
present.

pnpm11/global/commands/test/globalAdd.test.ts[12-18]
pnpm11/global/commands/test/globalAdd.test.ts[98-123]
pnpm11/global/commands/src/globalAdd.ts[250-296]

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 Jest test `global add replaces an existing pnpm install when installing @pnpm/exe` passes absolute filesystem locations (`/global/v11`, `/global/bin`) into `handleGlobalAdd()`. The exercised removal path in `removeExistingGlobalInstalls()` uses `fs.promises.rm(hashLink, { force: true })`, where `hashLink` is derived from `getHashLink(globalDir, hash)`. Because `fs.promises.rm` is not mocked, this test can attempt to delete real paths on the host machine if they exist.
### Issue Context
Other global command tests in this repo already use `fs.mkdtempSync(path.join(os.tmpdir(), ...))` to sandbox filesystem side effects (e.g., `globalRemove.test.ts`). This test should follow the same pattern or mock `fs.promises.rm`/`fs.realpathSync` to ensure no real absolute paths are touched.
### Fix Focus Areas
- pnpm11/global/commands/test/globalAdd.test.ts[12-18]
- pnpm11/global/commands/test/globalAdd.test.ts[98-123]

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


4. Overbroad alias group removal ✓ Resolved 🐞 Bug ☼ Reliability
Description
In globalAdd.ts, getReplacementAliases() expands any install group containing "pnpm" or "@pnpm/exe"
and then uses that expanded list for shouldSkip() and removeExistingGlobalInstalls(), which can
remove an entire existing global group that contains the other alias even if that group also
includes unrelated packages. This can unexpectedly uninstall additional global packages that
happened to be installed in the same group as pnpm/@pnpm/exe.
Code

pnpm11/global/commands/src/globalAdd.ts[R140-146]

// Read resolved aliases from the installed package.json
const pkgJson = readPackageJsonFromDirRawSync(installDir)
const aliases = Object.keys(pkgJson.dependencies ?? {})
+  const replacementAliases = getReplacementAliases(aliases)
// Check for bin name conflicts with other global packages
// (must happen before removeExistingGlobalInstalls so we don't lose existing packages on failure)
Evidence
The PR change uses expanded aliases for both conflict skipping and removal. Removal operates on
whole groups found by alias membership; because groups can contain multiple dependencies, adding the
other pnpm alias can select and delete a mixed group that contains that alias and additional
packages.

pnpm11/global/commands/src/globalAdd.ts[140-174]
pnpm11/global/commands/src/globalAdd.ts[235-273]
pnpm11/global/packages/src/scanGlobalPackages.ts[96-99]

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

## Issue description
`getReplacementAliases()` expands aliases whenever the new group contains `pnpm` or `@pnpm/exe`, and the expanded list is passed into `removeExistingGlobalInstalls()`. Because removal happens at the **group** level (a group can contain multiple direct dependencies), expanding to include the other pnpm alias can match and remove a different existing group that contains that alias plus unrelated packages.
## Issue Context
This PR intends to allow standalone pnpm downgrades by treating `pnpm` and `@pnpm/exe` as replacement-equivalent. That equivalence should be scoped to the pnpm CLI group and not cause removal of unrelated packages installed in a mixed group.
## Fix Focus Areas
- pnpm11/global/commands/src/globalAdd.ts[140-183]
### Suggested implementation direction
- Only expand aliases when the **new group is a standalone pnpm CLI group**, e.g. `aliases.length === 1 && (aliases[0] === 'pnpm' || aliases[0] === '@pnpm/exe')`.
- This preserves the intended standalone-downgrade behavior while avoiding matching/removing mixed groups.
**Alternative (more robust):**
- Keep expanded aliases for `shouldSkip` (conflict-check) but, when removing via the extra alias, only remove an existing group if *all* of its direct dependency aliases are within `{pnpm, @pnpm/exe}` (i.e., it is a pure pnpm CLI group).

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


5. Missing trailing commas in params 📘 Rule violation ⚙ Maintainability
Description
Multi-line TypeScript parameter lists were added/modified without trailing commas on the final
parameter, increasing diff noise and violating the trailing-comma requirement. This can also
conflict with formatter/linter expectations.
Code

pnpm11/global/commands/src/globalAdd.ts[R185-189]

+export function shouldReplaceExistingGlobalInstall (
+  pkg: GlobalPackageInfo,
+  aliases: string[],
+  replacementAliases: string[]
+): boolean {
Evidence
PR Compliance ID 713434 requires trailing commas in multi-line TypeScript constructs. The function
signatures shown have multi-line parameters where the last parameter line lacks a trailing comma.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/global/commands/src/globalAdd.ts[185-189]
pnpm11/global/commands/src/globalAdd.ts[250-255]

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

## Issue description
Multi-line TypeScript parameter lists are missing a trailing comma on the last parameter.
## Issue Context
The PR introduced/modified multi-line function signatures in `globalAdd.ts`.
## Fix Focus Areas
- pnpm11/global/commands/src/globalAdd.ts[185-189]
- pnpm11/global/commands/src/globalAdd.ts[250-255]

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


View more (1)
6. Prototype-chain alias match 🐞 Bug ⛨ Security
Description
shouldReplaceExistingGlobalInstall() uses alias in pkg.dependencies, which matches inherited
Object.prototype keys (e.g. toString) and can incorrectly treat unrelated global groups as
replaceable/skip conflict checks. This can lead to wrong global package removal and missed
bin-conflict detection when installing a package whose name collides with a prototype property.
Code

pnpm11/global/commands/src/globalAdd.ts[R185-192]

+export function shouldReplaceExistingGlobalInstall (
+  pkg: GlobalPackageInfo,
+  aliases: string[],
+  replacementAliases: string[]
+): boolean {
+  if (aliases.some((alias) => alias in pkg.dependencies)) return true
+  return isPnpmCliOnlyGroup(pkg) && replacementAliases.some((alias) => alias in pkg.dependencies)
+}
Evidence
The new helper uses the in operator against a plain object of dependencies; in checks the
prototype chain, so prototype property names can be treated as present dependencies even when they
are not. The global packages scanner builds dependencies as a normal object and does not reject
such names, and findGlobalPackage() also uses the same unsafe membership test.

pnpm11/global/commands/src/globalAdd.ts[185-192]
pnpm11/global/packages/src/scanGlobalPackages.ts[21-33]
pnpm11/global/packages/src/scanGlobalPackages.ts[35-49]
pnpm11/global/packages/src/scanGlobalPackages.ts[96-99]

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

## Issue description
`shouldReplaceExistingGlobalInstall()` currently checks membership with `alias in pkg.dependencies`, which consults the prototype chain and can return true for inherited keys (e.g. `toString`, `constructor`). This can incorrectly (1) skip bin-conflict checks and (2) mark the wrong existing global group for removal.
### Issue Context
`pkg.dependencies` is a plain object (`Record<string, string>`) created from `{}` during global package scanning, and alias validation does not exclude names like `toString`.
### Fix
- Replace `alias in pkg.dependencies` with an own-property check:
- Prefer `Object.hasOwn(pkg.dependencies, alias)` (Node 18+), or
- `Object.prototype.hasOwnProperty.call(pkg.dependencies, alias)`.
- For consistency and to avoid misidentifying existing packages, update the same pattern in `findGlobalPackage()` (currently uses `alias in pkg.dependencies`).
- (Optional hardening) Create dependency maps with a null prototype (e.g. `Object.create(null)`) so prototype keys cannot ever match.
### Fix Focus Areas
- pnpm11/global/commands/src/globalAdd.ts[185-192]
- pnpm11/global/packages/src/scanGlobalPackages.ts[35-43]
- pnpm11/global/packages/src/scanGlobalPackages.ts[96-99]

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



Informational

7. Repeated global dir scans 🐞 Bug ➹ Performance ⭐ New
Description
When pnpm/@pnpm/exe replacement alias expansion is active, the new removal loop queries multiple
aliases via findGlobalPackage/find_global_package, and each call rescans the entire global package
directory. This adds extra filesystem work (directory reads + package.json reads) in the standalone
pnpm install/downgrade path, especially noticeable with large global stores or slower disks.
Code

pnpm11/global/commands/src/globalAdd.ts[R260-271]

  // Collect unique groups to remove (dedup by hash)
  const groupsToRemove = new Map<string, ReturnType<typeof getInstalledBinNames>>()
-  for (const alias of aliases) {
+  for (const alias of replacementAliases) {
    const existing = findGlobalPackage(globalDir, alias)
-    if (existing && !groupsToRemove.has(existing.hash)) {
+    if (
+      existing &&
+      shouldReplaceExistingGlobalInstall(existing, aliases, replacementAliases) &&
+      !groupsToRemove.has(existing.hash)
+    ) {
      groupsToRemove.set(existing.hash, getInstalledBinNames(existing))
    }
  }
Evidence
The changed code loops over the expanded alias list and performs one global-package lookup per
alias; the lookup helper is implemented by scanning the whole global dir each time, so alias
expansion increases scan count.

pnpm11/global/commands/src/globalAdd.ts[250-272]
pnpm11/global/packages/src/scanGlobalPackages.ts[57-99]
pacquet/crates/cli/src/cli_args/global.rs[417-432]
pacquet/crates/global/src/scan.rs[56-91]

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

### Issue description
`removeExistingGlobalInstalls()` now iterates `replacementAliases` and calls `findGlobalPackage(globalDir, alias)` for each alias. `findGlobalPackage()` rescans the entire global packages directory on every invocation, so alias expansion (pnpm <-> @pnpm/exe) can trigger multiple full scans per install group.

### Issue Context
This only occurs when replacement alias expansion is enabled (i.e., when the installed group’s resolved aliases include `pnpm` or `@pnpm/exe`). The added work is small (typically one extra scan), but it is unnecessary overhead on a filesystem-heavy path.

### Fix Focus Areas
- pnpm11/global/commands/src/globalAdd.ts[250-272]
- pnpm11/global/packages/src/scanGlobalPackages.ts[96-99]
- pacquet/crates/cli/src/cli_args/global.rs[417-432]
- pacquet/crates/global/src/scan.rs[85-92]

### Suggested fix
- In TS: scan global packages once (e.g., call `scanGlobalPackages(globalDir)` directly) and match all `replacementAliases` against that in-memory list, collecting unique groups by hash.
- In Rust: call `scan_global_packages(global_pkg_dir)?` once in `remove_existing_global_installs` and then filter/match against `aliases_to_replace` without invoking `find_global_package` per alias.

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


8. Extra alias Vec clone 🐞 Bug ➹ Performance
Description
pacquet’s new replacement_aliases() always clones aliases (aliases.to_vec()) even when no
pnpm/@pnpm/exe alias is present, adding a small avoidable allocation/copy on every global add group.
This is low impact relative to the overall global install I/O, but easy to eliminate while keeping
behavior identical.
Code

pacquet/crates/cli/src/cli_args/global.rs[R436-447]

+fn replacement_aliases(aliases: &[String]) -> Vec<String> {
+    const PNPM_CLI_PACKAGE_ALIASES: [&str; 2] = ["pnpm", "@pnpm/exe"];
+
+    let mut expanded = aliases.to_vec();
+    if aliases.iter().any(|alias| PNPM_CLI_PACKAGE_ALIASES.contains(&alias.as_str())) {
+        for alias in PNPM_CLI_PACKAGE_ALIASES {
+            if !expanded.iter().any(|existing| existing == alias) {
+                expanded.push(alias.to_string());
+            }
+        }
+    }
+    expanded
Evidence
In pacquet, handle_global_add reads aliases for each group and calls
replacement_aliases(&aliases) unconditionally; the helper currently clones the full alias list
before it even checks whether pnpm/@pnpm/exe is present, so unrelated global installs pay the cost
too. The TS implementation avoids this by returning the original array when no expansion is needed,
showing the allocation is not required for correctness.

pacquet/crates/cli/src/cli_args/global.rs[109-112]
pacquet/crates/cli/src/cli_args/global.rs[436-448]
pnpm11/global/commands/src/globalAdd.ts[177-182]

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

## Issue description
`replacement_aliases()` always allocates/clones (`aliases.to_vec()`), even when it will return the aliases unchanged. This adds a small but unnecessary allocation/copy to every `handle_global_add` group.
### Issue Context
`handle_global_add` calls `replacement_aliases(&aliases)` unconditionally before bin-conflict checking and removal.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/global.rs[109-131]
- pacquet/crates/cli/src/cli_args/global.rs[436-448]
### Implementation sketch
- Detect whether expansion is needed *before* cloning.
- Only allocate an `expanded: Vec<String>` when a pnpm alias is present.
- Pass a `&[String]` to both `check_global_bin_conflicts`’s skip predicate and `remove_existing_global_installs`:

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


Grey Divider

Previous review results

Review updated until commit 13b86f5

Results up to commit 13b86f5


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


Action required
1. Collateral group uninstall ✓ Resolved 🐞 Bug ☼ Reliability
Description
In pacquet, expanding replacement aliases so pnpm and @pnpm/exe replace each other can make
standalone installs/downgrades match an existing comma-grouped global install that includes pnpm
plus other packages, causing remove_existing_global_installs to remove the entire group and
unintentionally uninstall unrelated packages. This occurs because global installs support
multi-package comma groups while removals are performed at the group/hash level rather than per
individual alias.
Code

pacquet/crates/cli/src/cli_args/global.rs[R109-122]

let pkgs = read_installed_packages(&install_dir);
let aliases = read_direct_dependency_aliases(&install_dir);
+        let aliases_to_replace = replacement_aliases(&aliases);
let bins_to_skip = match check_global_bin_conflicts(
    &global_pkg_dir,
    &global_bin_dir,
    &pkgs,
-            |existing: &GlobalPackageInfo| aliases.iter().any(|alias| existing.has_alias(alias)),
+            |existing: &GlobalPackageInfo| {
+                aliases_to_replace.iter().any(|alias| existing.has_alias(alias))
+            },
) {
    Ok(skip) => skip,
    Err(error) => {
Evidence
The cited logic supports multi-package global “groups” created from comma-separated selectors (via
group splitting), meaning a single global group can legitimately contain pnpm alongside unrelated
packages. The removal helper operates by deleting whole groups using their hash/install directory
rather than removing just the single matched alias, and with the new replacement-alias expansion
(pnpm↔@pnpm/exe) an install of one identity can now match the other identity’s existing group;
if that matched group is mixed, the group-scoped deletion necessarily removes the unrelated packages
too, demonstrating the unintended uninstall risk.

pacquet/crates/cli/src/cli_args/global.rs[109-131]
pacquet/crates/cli/src/cli_args/global.rs[410-434]
pacquet/crates/cli/src/cli_args/global.rs[498-522]
pnpm11/global/commands/src/globalAdd.ts[59-66]
pnpm11/global/commands/src/globalAdd.ts[140-163]
pnpm11/global/commands/src/globalAdd.ts[235-273]

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

## Issue description
Replacement-alias expansion makes `pnpm` and `@pnpm/exe` replace each other, and that expanded alias set is used for both conflict skipping and global group removal. Because global installs can create comma-grouped multi-package groups and removal is group/hash-scoped, a standalone `@pnpm/exe` (or `pnpm`) install can match an existing mixed `pnpm,...` group and delete the whole group, unintentionally uninstalling unrelated packages.
## Issue Context
- Global installs support comma-separated selectors that form a single multi-package “group”.
- Removal deletes entire groups by hash/install directory (not per individual alias).
- With the new alias equivalence, installing `@pnpm/exe` can target existing `pnpm` groups (and vice versa), which is unsafe when the existing group contains other packages.
- Repro example: a user previously installed a comma group like `pnpm,eslint` into one global group; a later standalone downgrade/replace that installs `@pnpm/exe` expands replacement aliases to include `pnpm`, matches that group, and removes it, uninstalling `eslint` too.
## Fix Focus Areas
- pacquet/crates/cli/src/cli_args/global.rs[109-131]
- pacquet/crates/cli/src/cli_args/global.rs[410-434]
- pacquet/crates/cli/src/cli_args/global.rs[498-522]
- pnpm11/global/commands/src/globalAdd.ts[140-175]
- pnpm11/global/commands/src/globalAdd.ts[235-273]
### Suggested fix direction
Only treat a group as replaceable due to the `pnpm`↔`@pnpm/exe` alias equivalence when the *existing group is pnpm-only* (i.e., its dependencies are limited to just `pnpm` and/or `@pnpm/exe`).
Implementation sketch:
- Introduce a helper/predicate (e.g., `isPnpmCliOnlyGroup`) that checks the group’s dependency keys are a subset of `{ "pnpm", "@pnpm/exe" }`.
- In both the bin-conflict skipping predicate/closure and in the group-removal filtering (`remove_existing_global_installs` / `removeExistingGlobalInstalls`), if the match is coming specifically from the pnpm alias-equivalence expansion, require `isPnpmCliOnlyGroup`; otherwise do not skip/remove.
- If a non-pnpm-only group is detected, fail fast with a targeted error explaining that the group contains other packages and must be removed/reinstalled manually (or installed without comma-grouping) to avoid uninstalling unrelated packages.

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


2. removeExistingGlobalInstalls has 4 params ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The modified removeExistingGlobalInstalls function now takes four positional parameters, exceeding
the maximum of three allowed by the TypeScript parameter limit rule. This increases call-site
complexity and makes the API harder to use consistently across the codebase.
Code

pnpm11/global/commands/src/globalAdd.ts[R250-255]

async function removeExistingGlobalInstalls (
globalDir: string,
globalBinDir: string,
-  aliases: string[]
+  aliases: string[],
+  replacementAliases: string[]
): Promise<void> {
Evidence
PR Compliance ID 713433 requires TypeScript functions to have three parameters or fewer (or use an
options object). The updated removeExistingGlobalInstalls signature includes four parameters.

Rule 713433: Limit TypeScript functions to three parameters or fewer
pnpm11/global/commands/src/globalAdd.ts[250-255]

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

## Issue description
`removeExistingGlobalInstalls` now has 4 positional parameters (`globalDir`, `globalBinDir`, `aliases`, `replacementAliases`), violating the rule that TypeScript functions must have 3 parameters or fewer.
## Issue Context
This signature was expanded to support pnpm vs `@pnpm/exe` replacement-alias handling.
## Fix Focus Areas
- pnpm11/global/commands/src/globalAdd.ts[163-163]
- pnpm11/global/commands/src/globalAdd.ts[250-255]

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



Remediation recommended
3. Unsafe absolute-path test 🐞 Bug ☼ Reliability
Description
The new globalAdd unit test calls handleGlobalAdd() with absolute paths like /global/v11, and
the production code path it exercises performs real fs.promises.rm() calls derived from
globalPkgDir/getHashLink(). If those paths exist on the machine running tests (and permissions
allow), the test can delete real filesystem entries outside a sandboxed temp directory.
Code

pnpm11/global/commands/test/globalAdd.test.ts[R112-117]

+  await handleGlobalAdd({
+    bin: '/global/bin',
+    dir: '/project',
+    globalPkgDir: '/global/v11',
+    registries: {},
+  } as any, ['file:/tmp/pnpm'], {}) // eslint-disable-line @typescript-eslint/no-explicit-any
Evidence
The test hard-codes /global/v11 and mocks getHashLink(globalDir, hash) to return
${globalDir}/${hash}, which becomes the argument to fs.promises.rm() in the real
removeExistingGlobalInstalls() implementation, making the test capable of deleting real paths if
present.

pnpm11/global/commands/test/globalAdd.test.ts[12-18]
pnpm11/global/commands/test/globalAdd.test.ts[98-123]
pnpm11/global/commands/src/globalAdd.ts[250-296]

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 Jest test `global add replaces an existing pnpm install when installing @pnpm/exe` passes absolute filesystem locations (`/global/v11`, `/global/bin`) into `handleGlobalAdd()`. The exercised removal path in `removeExistingGlobalInstalls()` uses `fs.promises.rm(hashLink, { force: true })`, where `hashLink` is derived from `getHashLink(globalDir, hash)`. Because `fs.promises.rm` is not mocked, this test can attempt to delete real paths on the host machine if they exist.
### Issue Context
Other global command tests in this repo already use `fs.mkdtempSync(path.join(os.tmpdir(), ...))` to sandbox filesystem side effects (e.g., `globalRemove.test.ts`). This test should follow the same pattern or mock `fs.promises.rm`/`fs.realpathSync` to ensure no real absolute paths are touched.
### Fix Focus Areas
- pnpm11/global/commands/test/globalAdd.test.ts[12-18]
- pnpm11/global/commands/test/globalAdd.test.ts[98-123]

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


4. Overbroad alias group removal ✓ Resolved 🐞 Bug ☼ Reliability
Description
In globalAdd.ts, getReplacementAliases() expands any install group containing "pnpm" or "@pnpm/exe"
and then uses that expanded list for shouldSkip() and removeExistingGlobalInstalls(), which can
remove an entire existing global group that contains the other alias even if that group also
includes unrelated packages. This can unexpectedly uninstall additional global packages that
happened to be installed in the same group as pnpm/@pnpm/exe.
Code

pnpm11/global/commands/src/globalAdd.ts[R140-146]

// Read resolved aliases from the installed package.json
const pkgJson = readPackageJsonFromDirRawSync(installDir)
const aliases = Object.keys(pkgJson.dependencies ?? {})
+  const replacementAliases = getReplacementAliases(aliases)
// Check for bin name conflicts with other global packages
// (must happen before removeExistingGlobalInstalls so we don't lose existing packages on failure)
Evidence
The PR change uses expanded aliases for both conflict skipping and removal. Removal operates on
whole groups found by alias membership; because groups can contain multiple dependencies, adding the
other pnpm alias can select and delete a mixed group that contains that alias and additional
packages.

pnpm11/global/commands/src/globalAdd.ts[140-174]
pnpm11/global/commands/src/globalAdd.ts[235-273]
pnpm11/global/packages/src/scanGlobalPackages.ts[96-99]

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

## Issue description
`getReplacementAliases()` expands aliases whenever the new group contains `pnpm` or `@pnpm/exe`, and the expanded list is passed into `removeExistingGlobalInstalls()`. Because removal happens at the **group** level (a group can contain multiple direct dependencies), expanding to include the other pnpm alias can match and remove a different existing group that contains that alias plus unrelated packages.
## Issue Context
This PR intends to allow standalone pnpm downgrades by treating `pnpm` and `@pnpm/exe` as replacement-equivalent. That equivalence should be scoped to the pnpm CLI group and not cause removal of unrelated packages installed in a mixed group.
## Fix Focus Areas
- pnpm11/global/commands/src/globalAdd.ts[140-183]
### Suggested implementation direction
- Only expand aliases when the **new group is a standalone pnpm CLI group**, e.g. `aliases.length === 1 && (aliases[0] === 'pnpm' || aliases[0] === '@pnpm/exe')`.
- This preserves the intended standalone-downgrade behavior while avoiding matching/removing mixed groups.
**Alternative (more robust):**
- Keep expanded aliases for `shouldSkip` (conflict-check) but, when removing via the extra alias, only remove an existing group if *all* of its direct dependency aliases are within `{pnpm, @pnpm/exe}` (i.e., it is a pure pnpm CLI group).

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


5. Missing trailing commas in params 📘 Rule violation ⚙ Maintainability
Description
Multi-line TypeScript parameter lists were added/modified without trailing commas on the final
parameter, increasing diff noise and violating the trailing-comma requirement. This can also
conflict with formatter/linter expectations.
Code

pnpm11/global/commands/src/globalAdd.ts[R185-189]

+export function shouldReplaceExistingGlobalInstall (
+  pkg: GlobalPackageInfo,
+  aliases: string[],
+  replacementAliases: string[]
+): boolean {
Evidence
PR Compliance ID 713434 requires trailing commas in multi-line TypeScript constructs. The function
signatures shown have multi-line parameters where the last parameter line lacks a trailing comma.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/global/commands/src/globalAdd.ts[185-189]
pnpm11/global/commands/src/globalAdd.ts[250-255]

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

## Issue description
Multi-line TypeScript parameter lists are missing a trailing comma on the last parameter.
## Issue Context
The PR introduced/modified multi-line function signatures in `globalAdd.ts`.
## Fix Focus Areas
- pnpm11/global/commands/src/globalAdd.ts[185-189]
- pnpm11/global/commands/src/globalAdd.ts[250-255]

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


View more (1)
6. Prototype-chain alias match 🐞 Bug ⛨ Security
Description
shouldReplaceExistingGlobalInstall() uses alias in pkg.dependencies, which matches inherited
Object.prototype keys (e.g. toString) and can incorrectly treat unrelated global groups as
replaceable/skip conflict checks. This can lead to wrong global package removal and missed
bin-conflict detection when installing a package whose name collides with a prototype property.
Code

pnpm11/global/commands/src/globalAdd.ts[R185-192]

+export function shouldReplaceExistingGlobalInstall (
+  pkg: GlobalPackageInfo,
+  aliases: string[],
+  replacementAliases: string[]
+): boolean {
+  if (aliases.some((alias) => alias in pkg.dependencies)) return true
+  return isPnpmCliOnlyGroup(pkg) && replacementAliases.some((alias) => alias in pkg.dependencies)
+}
Evidence
The new helper uses the in operator against a plain object of dependencies; in checks the
prototype chain, so prototype property names can be treated as present dependencies even when they
are not. The global packages scanner builds dependencies as a normal object and does not reject
such names, and findGlobalPackage() also uses the same unsafe membership test.

pnpm11/global/commands/src/globalAdd.ts[185-192]
pnpm11/global/packages/src/scanGlobalPackages.ts[21-33]
pnpm11/global/packages/src/scanGlobalPackages.ts[35-49]
pnpm11/global/packages/src/scanGlobalPackages.ts[96-99]

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

## Issue description
`shouldReplaceExistingGlobalInstall()` currently checks membership with `alias in pkg.dependencies`, which consults the prototype chain and can return true for inherited keys (e.g. `toString`, `constructor`). This can incorrectly (1) skip bin-conflict checks and (2) mark the wrong existing global group for removal.
### Issue Context
`pkg.dependencies` is a plain object (`Record<string, string>`) created from `{}` during global package scanning, and alias validation does not exclude names like `toString`.
### Fix
- Replace `alias in pkg.dependencies` with an own-property check:
- Prefer `Object.hasOwn(pkg.dependencies, alias)` (Node 18+), or
- `Object.prototype.hasOwnProperty.call(pkg.dependencies, alias)`.
- For consistency and to avoid misidentifying existing packages, update the same pattern in `findGlobalPackage()` (currently uses `alias in pkg.dependencies`).
- (Optional hardening) Create dependency maps with a null prototype (e.g. `Object.create(null)`) so prototype keys cannot ever match.
### Fix Focus Areas
- pnpm11/global/commands/src/globalAdd.ts[185-192]
- pnpm11/global/packages/src/scanGlobalPackages.ts[35-43]
- pnpm11/global/packages/src/scanGlobalPackages.ts[96-99]

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



Informational
7. Extra alias Vec clone 🐞 Bug ➹ Performance
Description
pacquet’s new replacement_aliases() always clones aliases (aliases.to_vec()) even when no
pnpm/@pnpm/exe alias is present, adding a small avoidable allocation/copy on every global add group.
This is low impact relative to the overall global install I/O, but easy to eliminate while keeping
behavior identical.
Code

pacquet/crates/cli/src/cli_args/global.rs[R436-447]

+fn replacement_aliases(aliases: &[String]) -> Vec<String> {
+    const PNPM_CLI_PACKAGE_ALIASES: [&str; 2] = ["pnpm", "@pnpm/exe"];
+
+    let mut expanded = aliases.to_vec();
+    if aliases.iter().any(|alias| PNPM_CLI_PACKAGE_ALIASES.contains(&alias.as_str())) {
+        for alias in PNPM_CLI_PACKAGE_ALIASES {
+            if !expanded.iter().any(|existing| existing == alias) {
+                expanded.push(alias.to_string());
+            }
+        }
+    }
+    expanded
Evidence
In pacquet, handle_global_add reads aliases for each group and calls
replacement_aliases(&aliases) unconditionally; the helper currently clones the full alias list
before it even checks whether pnpm/@pnpm/exe is present, so unrelated global installs pay the cost
too. The TS implementation avoids this by returning the original array when no expansion is needed,
showing the allocation is not required for correctness.

pacquet/crates/cli/src/cli_args/global.rs[109-112]
pacquet/crates/cli/src/cli_args/global.rs[436-448]
pnpm11/global/commands/src/globalAdd.ts[177-182]

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

## Issue description
`replacement_aliases()` always allocates/clones (`aliases.to_vec()`), even when it will return the aliases unchanged. This adds a small but unnecessary allocation/copy to every `handle_global_add` group.
### Issue Context
`handle_global_add` calls `replacement_aliases(&aliases)` unconditionally before bin-conflict checking and removal.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/global.rs[109-131]
- pacquet/crates/cli/src/cli_args/global.rs[436-448]
### Implementation sketch
- Detect whether expansion is needed *before* cloning.
- Only allocate an `expanded: Vec<String>` when a pnpm alias is present.
- Pass a `&[String]` to both `check_global_bin_conflicts`’s skip predicate and `remove_existing_global_installs`:

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


Qodo Logo

@github-actions

github-actions Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
tarball/download_dependency    1.00      6.8±0.32ms   638.5 KB/sec    1.00      6.8±0.16ms   635.9 KB/sec

@qodo-code-review

qodo-code-review Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 51 rules

Grey Divider


Action required

1. removeExistingGlobalInstalls has 4 params ✓ Resolved 📘 Rule violation ⚙ Maintainability ⭐ New
Description
The modified removeExistingGlobalInstalls function now takes four positional parameters, exceeding
the maximum of three allowed by the TypeScript parameter limit rule. This increases call-site
complexity and makes the API harder to use consistently across the codebase.
Code

pnpm11/global/commands/src/globalAdd.ts[R250-255]

async function removeExistingGlobalInstalls (
  globalDir: string,
  globalBinDir: string,
-  aliases: string[]
+  aliases: string[],
+  replacementAliases: string[]
): Promise<void> {
Evidence
PR Compliance ID 713433 requires TypeScript functions to have three parameters or fewer (or use an
options object). The updated removeExistingGlobalInstalls signature includes four parameters.

Rule 713433: Limit TypeScript functions to three parameters or fewer
pnpm11/global/commands/src/globalAdd.ts[250-255]

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

## Issue description
`removeExistingGlobalInstalls` now has 4 positional parameters (`globalDir`, `globalBinDir`, `aliases`, `replacementAliases`), violating the rule that TypeScript functions must have 3 parameters or fewer.

## Issue Context
This signature was expanded to support pnpm vs `@pnpm/exe` replacement-alias handling.

## Fix Focus Areas
- pnpm11/global/commands/src/globalAdd.ts[163-163]
- pnpm11/global/commands/src/globalAdd.ts[250-255]

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


2. Collateral group uninstall ✓ Resolved 🐞 Bug ☼ Reliability
Description
In pacquet, expanding replacement aliases so pnpm and @pnpm/exe replace each other can make
standalone installs/downgrades match an existing comma-grouped global install that includes pnpm
plus other packages, causing remove_existing_global_installs to remove the entire group and
unintentionally uninstall unrelated packages. This occurs because global installs support
multi-package comma groups while removals are performed at the group/hash level rather than per
individual alias.
Code

pacquet/crates/cli/src/cli_args/global.rs[R109-122]

        let pkgs = read_installed_packages(&install_dir);
        let aliases = read_direct_dependency_aliases(&install_dir);
+        let aliases_to_replace = replacement_aliases(&aliases);

        let bins_to_skip = match check_global_bin_conflicts(
            &global_pkg_dir,
            &global_bin_dir,
            &pkgs,
-            |existing: &GlobalPackageInfo| aliases.iter().any(|alias| existing.has_alias(alias)),
+            |existing: &GlobalPackageInfo| {
+                aliases_to_replace.iter().any(|alias| existing.has_alias(alias))
+            },
        ) {
            Ok(skip) => skip,
            Err(error) => {
Evidence
The cited logic supports multi-package global “groups” created from comma-separated selectors (via
group splitting), meaning a single global group can legitimately contain pnpm alongside unrelated
packages. The removal helper operates by deleting whole groups using their hash/install directory
rather than removing just the single matched alias, and with the new replacement-alias expansion
(pnpm↔@pnpm/exe) an install of one identity can now match the other identity’s existing group;
if that matched group is mixed, the group-scoped deletion necessarily removes the unrelated packages
too, demonstrating the unintended uninstall risk.

pacquet/crates/cli/src/cli_args/global.rs[109-131]
pacquet/crates/cli/src/cli_args/global.rs[410-434]
pacquet/crates/cli/src/cli_args/global.rs[498-522]
pnpm11/global/commands/src/globalAdd.ts[59-66]
pnpm11/global/commands/src/globalAdd.ts[140-163]
pnpm11/global/commands/src/globalAdd.ts[235-273]

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

## Issue description
Replacement-alias expansion makes `pnpm` and `@pnpm/exe` replace each other, and that expanded alias set is used for both conflict skipping and global group removal. Because global installs can create comma-grouped multi-package groups and removal is group/hash-scoped, a standalone `@pnpm/exe` (or `pnpm`) install can match an existing mixed `pnpm,...` group and delete the whole group, unintentionally uninstalling unrelated packages.

## Issue Context
- Global installs support comma-separated selectors that form a single multi-package “group”.
- Removal deletes entire groups by hash/install directory (not per individual alias).
- With the new alias equivalence, installing `@pnpm/exe` can target existing `pnpm` groups (and vice versa), which is unsafe when the existing group contains other packages.
- Repro example: a user previously installed a comma group like `pnpm,eslint` into one global group; a later standalone downgrade/replace that installs `@pnpm/exe` expands replacement aliases to include `pnpm`, matches that group, and removes it, uninstalling `eslint` too.

## Fix Focus Areas
- pacquet/crates/cli/src/cli_args/global.rs[109-131]
- pacquet/crates/cli/src/cli_args/global.rs[410-434]
- pacquet/crates/cli/src/cli_args/global.rs[498-522]
- pnpm11/global/commands/src/globalAdd.ts[140-175]
- pnpm11/global/commands/src/globalAdd.ts[235-273]

### Suggested fix direction
Only treat a group as replaceable due to the `pnpm`↔`@pnpm/exe` alias equivalence when the *existing group is pnpm-only* (i.e., its dependencies are limited to just `pnpm` and/or `@pnpm/exe`).

Implementation sketch:
- Introduce a helper/predicate (e.g., `isPnpmCliOnlyGroup`) that checks the group’s dependency keys are a subset of `{ "pnpm", "@pnpm/exe" }`.
- In both the bin-conflict skipping predicate/closure and in the group-removal filtering (`remove_existing_global_installs` / `removeExistingGlobalInstalls`), if the match is coming specifically from the pnpm alias-equivalence expansion, require `isPnpmCliOnlyGroup`; otherwise do not skip/remove.
- If a non-pnpm-only group is detected, fail fast with a targeted error explaining that the group contains other packages and must be removed/reinstalled manually (or installed without comma-grouping) to avoid uninstalling unrelated packages.

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



Remediation recommended

3. Missing trailing commas in params 📘 Rule violation ⚙ Maintainability ⭐ New
Description
Multi-line TypeScript parameter lists were added/modified without trailing commas on the final
parameter, increasing diff noise and violating the trailing-comma requirement. This can also
conflict with formatter/linter expectations.
Code

pnpm11/global/commands/src/globalAdd.ts[R185-189]

+export function shouldReplaceExistingGlobalInstall (
+  pkg: GlobalPackageInfo,
+  aliases: string[],
+  replacementAliases: string[]
+): boolean {
Evidence
PR Compliance ID 713434 requires trailing commas in multi-line TypeScript constructs. The function
signatures shown have multi-line parameters where the last parameter line lacks a trailing comma.

Rule 713434: Require trailing commas in TypeScript collections and multi-line constructs
pnpm11/global/commands/src/globalAdd.ts[185-189]
pnpm11/global/commands/src/globalAdd.ts[250-255]

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

## Issue description
Multi-line TypeScript parameter lists are missing a trailing comma on the last parameter.

## Issue Context
The PR introduced/modified multi-line function signatures in `globalAdd.ts`.

## Fix Focus Areas
- pnpm11/global/commands/src/globalAdd.ts[185-189]
- pnpm11/global/commands/src/globalAdd.ts[250-255]

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


4. Prototype-chain alias match 🐞 Bug ⛨ Security ⭐ New
Description
shouldReplaceExistingGlobalInstall() uses alias in pkg.dependencies, which matches inherited
Object.prototype keys (e.g. toString) and can incorrectly treat unrelated global groups as
replaceable/skip conflict checks. This can lead to wrong global package removal and missed
bin-conflict detection when installing a package whose name collides with a prototype property.
Code

pnpm11/global/commands/src/globalAdd.ts[R185-192]

+export function shouldReplaceExistingGlobalInstall (
+  pkg: GlobalPackageInfo,
+  aliases: string[],
+  replacementAliases: string[]
+): boolean {
+  if (aliases.some((alias) => alias in pkg.dependencies)) return true
+  return isPnpmCliOnlyGroup(pkg) && replacementAliases.some((alias) => alias in pkg.dependencies)
+}
Evidence
The new helper uses the in operator against a plain object of dependencies; in checks the
prototype chain, so prototype property names can be treated as present dependencies even when they
are not. The global packages scanner builds dependencies as a normal object and does not reject
such names, and findGlobalPackage() also uses the same unsafe membership test.

pnpm11/global/commands/src/globalAdd.ts[185-192]
pnpm11/global/packages/src/scanGlobalPackages.ts[21-33]
pnpm11/global/packages/src/scanGlobalPackages.ts[35-49]
pnpm11/global/packages/src/scanGlobalPackages.ts[96-99]

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

### Issue description
`shouldReplaceExistingGlobalInstall()` currently checks membership with `alias in pkg.dependencies`, which consults the prototype chain and can return true for inherited keys (e.g. `toString`, `constructor`). This can incorrectly (1) skip bin-conflict checks and (2) mark the wrong existing global group for removal.

### Issue Context
`pkg.dependencies` is a plain object (`Record<string, string>`) created from `{}` during global package scanning, and alias validation does not exclude names like `toString`.

### Fix
- Replace `alias in pkg.dependencies` with an own-property check:
 - Prefer `Object.hasOwn(pkg.dependencies, alias)` (Node 18+), or
 - `Object.prototype.hasOwnProperty.call(pkg.dependencies, alias)`.
- For consistency and to avoid misidentifying existing packages, update the same pattern in `findGlobalPackage()` (currently uses `alias in pkg.dependencies`).
- (Optional hardening) Create dependency maps with a null prototype (e.g. `Object.create(null)`) so prototype keys cannot ever match.

### Fix Focus Areas
- pnpm11/global/commands/src/globalAdd.ts[185-192]
- pnpm11/global/packages/src/scanGlobalPackages.ts[35-43]
- pnpm11/global/packages/src/scanGlobalPackages.ts[96-99]

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


Grey Divider

Previous review results

Review updated until commit 13b86f5

Results up to commit e7456c8


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


Action required
1. Collateral group uninstall ✓ Resolved 🐞 Bug ☼ Reliability
Description
In pacquet, expanding replacement aliases so pnpm and @pnpm/exe replace each other can make
standalone installs/downgrades match an existing comma-grouped global install that includes pnpm
plus other packages, causing remove_existing_global_installs to remove the entire group and
unintentionally uninstall unrelated packages. This occurs because global installs support
multi-package comma groups while removals are performed at the group/hash level rather than per
individual alias.
Code

pacquet/crates/cli/src/cli_args/global.rs[R109-122]

        let pkgs = read_installed_packages(&install_dir);
        let aliases = read_direct_dependency_aliases(&install_dir);
+        let aliases_to_replace = replacement_aliases(&aliases);

        let bins_to_skip = match check_global_bin_conflicts(
            &global_pkg_dir,
            &global_bin_dir,
            &pkgs,
-            |existing: &GlobalPackageInfo| aliases.iter().any(|alias| existing.has_alias(alias)),
+            |existing: &GlobalPackageInfo| {
+                aliases_to_replace.iter().any(|alias| existing.has_alias(alias))
+            },
        ) {
            Ok(skip) => skip,
            Err(error) => {
Evidence
The cited logic supports multi-package global “groups” created from comma-separated selectors (via
group splitting), meaning a single global group can legitimately contain pnpm alongside unrelated
packages. The removal helper operates by deleting whole groups using their hash/install directory
rather than removing just the single matched alias, and with the new replacement-alias expansion
(pnpm↔@pnpm/exe) an install of one identity can now match the other identity’s existing group;
if that matched group is mixed, the group-scoped deletion necessarily removes the unrelated packages
too, demonstrating the unintended uninstall risk.

pacquet/crates/cli/src/cli_args/global.rs[109-131]
pacquet/crates/cli/src/cli_args/global.rs[410-434]
pacquet/crates/cli/src/cli_args/global.rs[498-522]
pnpm11/global/commands/src/globalAdd.ts[59-66]
pnpm11/global/commands/src/globalAdd.ts[140-163]
pnpm11/global/commands/src/globalAdd.ts[235-273]

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

## Issue description
Replacement-alias expansion makes `pnpm` and `@pnpm/exe` replace each other, and that expanded alias set is used for both conflict skipping and global group removal. Because global installs can create comma-grouped multi-package groups and removal is group/hash-scoped, a standalone `@pnpm/exe` (or `pnpm`) install can match an existing mixed `pnpm,...` group and delete the whole group, unintentionally uninstalling unrelated packages.

## Issue Context
- Global installs support comma-separated selectors that form a single multi-package “group”.
- Removal deletes entire groups by hash/install directory (not per individual alias).
- With the new alias equivalence, installing `@pnpm/exe` can target existing `pnpm` groups (and vice versa), which is unsafe when the existing group contains other packages.
- Repro example: a user previously installed a comma group like `pnpm,eslint` into one global group; a later standalone downgrade/replace that installs `@pnpm/exe` expands replacement aliases to include `pnpm`, matches that group, and removes it, uninstalling `eslint` too.

## Fix Focus Areas
- pacquet/crates/cli/src/cli_args/global.rs[109-131]
- pacquet/crates/cli/src/cli_args/global.rs[410-434]
- pacquet/crates/cli/src/cli_args/global.rs[498-522]
- pnpm11/global/commands/src/globalAdd.ts[140-175]
- pnpm11/global/commands/src/globalAdd.ts[235-273]

### Suggested fix direction
Only treat a group as replaceable due to the `pnpm`↔`@pnpm/exe` alias equivalence when the *existing group is pnpm-only* (i.e., its dependencies are limited to just `pnpm` and/or `@pnpm/exe`).

Implementation sketch:
- Introduce a helper/predicate (e.g., `isPnpmCliOnlyGroup`) that checks the group’s dependency keys are a subset of `{ "pnpm", "@pnpm/exe" }`.
- In both the bin-conflict skipping predicate/closure and in the group-removal filtering (`remove_existing_global_installs` / `removeExistingGlobalInstalls`), if the match is coming specifically from the pnpm alias-equivalence expansion, require `isPnpmCliOnlyGroup`; otherwise do not skip/remove.
- If a non-pnpm-only group is detected, fail fast with a targeted error explaining that the group contains other packages and must be removed/reinstalled manually (or installed without comma-grouping) to avoid uninstalling unrelated packages.

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


Qodo Logo

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit e7456c8

@qodo-code-review

qodo-code-review Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to 13b86f5

Warning

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

CategorySuggestion                                                                                                                                    Impact
Security
Use own-property dependency checks

Replace the in operator with Object.hasOwn() for dependency membership checks.
This prevents incorrect matches with prototype chain properties.

pnpm11/global/commands/src/globalAdd.ts [185-192]

 export function shouldReplaceExistingGlobalInstall (
   pkg: GlobalPackageInfo,
   aliases: string[],
   replacementAliases: string[]
 ): boolean {
-  if (aliases.some((alias) => alias in pkg.dependencies)) return true
-  return isPnpmCliOnlyGroup(pkg) && replacementAliases.some((alias) => alias in pkg.dependencies)
+  if (aliases.some((alias) => Object.hasOwn(pkg.dependencies, alias))) return true
+  return isPnpmCliOnlyGroup(pkg) && replacementAliases.some((alias) => Object.hasOwn(pkg.dependencies, alias))
 }
  • Apply / Chat
Suggestion importance[1-10]: 5

__

Why: Using Object.hasOwn is safer than the in operator to avoid matching prototype properties, though the practical risk here is low as aliases originate from package.json keys.

Low
General
De-duplicate replacement alias lists

De-duplicate the aliases array at the beginning of the replacement_aliases
function. This would prevent redundant processing if the input contains
duplicates.

pacquet/crates/cli/src/cli_args/global.rs [443-455]

 fn replacement_aliases(aliases: &[String]) -> Vec<String> {
     const PNPM_CLI_PACKAGE_ALIASES: [&str; 2] = ["pnpm", "@pnpm/exe"];
 
-    let mut expanded = aliases.to_vec();
-    if aliases.iter().any(|alias| is_pnpm_cli_package_alias(alias)) {
+    let mut expanded: Vec<String> = Vec::new();
+    let mut seen = HashSet::new();
+
+    for alias in aliases {
+        if seen.insert(alias.clone()) {
+            expanded.push(alias.clone());
+        }
+    }
+
+    if expanded.iter().any(|alias| is_pnpm_cli_package_alias(alias)) {
         for alias in PNPM_CLI_PACKAGE_ALIASES {
-            if !expanded.iter().any(|existing| existing == alias) {
+            if seen.insert(alias.to_string()) {
                 expanded.push(alias.to_string());
             }
         }
     }
+
     expanded
 }
  • Apply / Chat
Suggestion importance[1-10]: 2

__

Why: The input aliases are derived from package.json dependency keys which are naturally unique, making the proposed deduplication unnecessary and adding slight overhead.

Low
  • More

Previous suggestions

Suggestions up to commit 92233bf
CategorySuggestion                                                                                                                                    Impact
Security
Use own-property dependency checks

Replace the in operator with Object.hasOwn() when checking for package
dependencies. This prevents unintended matches with prototype chain properties.

pnpm11/global/commands/src/globalAdd.ts [185-192]

 export function shouldReplaceExistingGlobalInstall (
   pkg: GlobalPackageInfo,
   aliases: string[],
   replacementAliases: string[]
 ): boolean {
-  if (aliases.some((alias) => alias in pkg.dependencies)) return true
-  return isPnpmCliOnlyGroup(pkg) && replacementAliases.some((alias) => alias in pkg.dependencies)
+  const hasDep = (alias: string) => Object.hasOwn(pkg.dependencies, alias)
+  if (aliases.some(hasDep)) return true
+  return isPnpmCliOnlyGroup(pkg) && replacementAliases.some(hasDep)
 }
Suggestion importance[1-10]: 4

__

Why: Using Object.hasOwn() instead of the in operator is a valid best practice to prevent matching prototype properties, though the practical risk of exploiting this with valid package names is extremely low.

Low
Suggestions
CategorySuggestion                                                                                                                                    Impact
Security
Use own-property dependency checks

Replace the in operator with Object.prototype.hasOwnProperty.call for checking
dependency membership. This avoids potential unexpected behavior caused by
prototype chain traversal.

pnpm11/global/commands/src/globalAdd.ts [185-192]

 export function shouldReplaceExistingGlobalInstall (
   pkg: GlobalPackageInfo,
   aliases: string[],
   replacementAliases: string[]
 ): boolean {
-  if (aliases.some((alias) => alias in pkg.dependencies)) return true
-  return isPnpmCliOnlyGroup(pkg) && replacementAliases.some((alias) => alias in pkg.dependencies)
+  const hasDep = (alias: string): boolean =>
+    Object.prototype.hasOwnProperty.call(pkg.dependencies, alias)
+
+  if (aliases.some(hasDep)) return true
+  return isPnpmCliOnlyGroup(pkg) && replacementAliases.some(hasDep)
 }
Suggestion importance[1-10]: 4

__

Why: Using Object.prototype.hasOwnProperty.call prevents potential issues with prototype chain traversal when checking object keys, which is a good practice, though unlikely to be exploited here.

Low
Possible issue
Guard against malformed metadata

Add a null check for pkg.dependencies before calling Object.keys. This prevents
potential runtime crashes in case the package metadata is corrupted or
malformed.

pnpm11/global/commands/src/globalAdd.ts [194-197]

 function isPnpmCliOnlyGroup (pkg: GlobalPackageInfo): boolean {
+  if (pkg.dependencies == null || typeof pkg.dependencies !== 'object') return false
   const aliases = Object.keys(pkg.dependencies)
   return aliases.length > 0 && aliases.every((alias) => PNPM_CLI_PACKAGE_ALIASES.includes(alias))
 }
Suggestion importance[1-10]: 2

__

Why: While adding runtime safety is sometimes useful, TypeScript likely already guarantees pkg.dependencies is an object via the GlobalPackageInfo type, making this check mostly redundant.

Low

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jul 7, 2026
@codecov-commenter

codecov-commenter commented Jul 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.24390% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.81%. Comparing base (de1371d) to head (13b86f5).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pacquet/crates/cli/src/cli_args/global.rs 90.24% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #12840   +/-   ##
=======================================
  Coverage   85.80%   85.81%           
=======================================
  Files         448      448           
  Lines       69402    69438   +36     
=======================================
+ Hits        59552    59585   +33     
- Misses       9850     9853    +3     

☔ 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.

Comment thread pnpm11/global/commands/src/globalAdd.ts Resolved
@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 2104f63

@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.

🧹 Nitpick comments (2)
pacquet/crates/cli/src/cli_args/global/tests.rs (1)

1-83: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Alias-equivalence tests only cover one direction.

Both tests seed aliases = ["@pnpm/exe"] against an existing "pnpm" group. There's no test for the reverse direction (aliases = ["pnpm"] against an existing "@pnpm/exe"-only group), which is the actual downgrade scenario this PR targets (v12 pnpm → v11 @pnpm/exe, or vice versa depending on packaging). Since replacement_aliases is symmetric, this is likely covered implicitly, but an explicit reverse-direction test would pin down the exact regression this PR fixes and improve confidence given the Codecov coverage gap noted on global.rs.

✅ Suggested additional test
#[test]
fn pnpm_alias_equivalence_replaces_reverse_direction() {
    let aliases = vec!["pnpm".to_string()];
    let aliases_to_replace = replacement_aliases(&aliases);

    assert!(should_replace_existing_package(
        &global_package(&["`@pnpm/exe`"]),
        &aliases,
        &aliases_to_replace,
    ));
}
🤖 Prompt for 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.

In `@pacquet/crates/cli/src/cli_args/global/tests.rs` around lines 1 - 83, Add an
explicit reverse-direction alias-equivalence test in global tests to cover the
downgrade case the PR targets. Extend the existing pnpm alias checks around
replacement_aliases and should_replace_existing_package by adding a test that
seeds aliases with "pnpm" and verifies it replaces an existing "`@pnpm/exe`"-only
GlobalPackageInfo group, so both directions of the symmetric mapping are pinned
down.
pacquet/crates/cli/src/cli_args/global.rs (1)

417-441: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Coverage gap on the destructive removal path.

The PR's Codecov comment flags 3 uncovered lines in this file, and tests.rs only exercises the pure predicate functions (replacement_aliases, should_replace_existing_package), not this loop or the handle_global_add closure (lines 117-119) that actually deletes global install directories. Given this path performs filesystem removal based on the new alias-equivalence rule, an integration-level test exercising remove_existing_global_installs directly (or via handle_global_add) would meaningfully reduce risk of a regression silently deleting the wrong global install.

🤖 Prompt for 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.

In `@pacquet/crates/cli/src/cli_args/global.rs` around lines 417 - 441, The
destructive global-removal path in remove_existing_global_installs is not
covered, so add an integration-style test that exercises this function or the
handle_global_add closure that calls it. Set up multiple global installs with
overlapping aliases, verify the alias-equivalence replacement behavior, and
assert that only the intended package directories/bins are removed while
unrelated global installs remain untouched. Use the existing symbols
remove_existing_global_installs, handle_global_add, find_global_package, and
remove_group to locate the path to cover.
🤖 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.

Nitpick comments:
In `@pacquet/crates/cli/src/cli_args/global.rs`:
- Around line 417-441: The destructive global-removal path in
remove_existing_global_installs is not covered, so add an integration-style test
that exercises this function or the handle_global_add closure that calls it. Set
up multiple global installs with overlapping aliases, verify the
alias-equivalence replacement behavior, and assert that only the intended
package directories/bins are removed while unrelated global installs remain
untouched. Use the existing symbols remove_existing_global_installs,
handle_global_add, find_global_package, and remove_group to locate the path to
cover.

In `@pacquet/crates/cli/src/cli_args/global/tests.rs`:
- Around line 1-83: Add an explicit reverse-direction alias-equivalence test in
global tests to cover the downgrade case the PR targets. Extend the existing
pnpm alias checks around replacement_aliases and should_replace_existing_package
by adding a test that seeds aliases with "pnpm" and verifies it replaces an
existing "`@pnpm/exe`"-only GlobalPackageInfo group, so both directions of the
symmetric mapping are pinned down.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 83eea02d-5a4c-42ca-a4a1-83449a7da528

📥 Commits

Reviewing files that changed from the base of the PR and between e7456c8 and 2104f63.

📒 Files selected for processing (4)
  • pacquet/crates/cli/src/cli_args/global.rs
  • pacquet/crates/cli/src/cli_args/global/tests.rs
  • pnpm11/global/commands/src/globalAdd.ts
  • pnpm11/global/commands/test/globalAdd.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm11/global/commands/src/globalAdd.ts

@qodo-code-review

qodo-code-review Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

CategorySuggestion                                                                                                                                    Impact
Security
Use own-property dependency checks

Replace the in operator with Object.prototype.hasOwnProperty.call for checking
dependency membership. This avoids potential unexpected behavior caused by
prototype chain traversal.

pnpm11/global/commands/src/globalAdd.ts [185-192]

 export function shouldReplaceExistingGlobalInstall (
   pkg: GlobalPackageInfo,
   aliases: string[],
   replacementAliases: string[]
 ): boolean {
-  if (aliases.some((alias) => alias in pkg.dependencies)) return true
-  return isPnpmCliOnlyGroup(pkg) && replacementAliases.some((alias) => alias in pkg.dependencies)
+  const hasDep = (alias: string): boolean =>
+    Object.prototype.hasOwnProperty.call(pkg.dependencies, alias)
+
+  if (aliases.some(hasDep)) return true
+  return isPnpmCliOnlyGroup(pkg) && replacementAliases.some(hasDep)
 }
  • Apply / Chat
Suggestion importance[1-10]: 4

__

Why: Using Object.prototype.hasOwnProperty.call prevents potential issues with prototype chain traversal when checking object keys, which is a good practice, though unlikely to be exploited here.

Low
Possible issue
Guard against malformed metadata

Add a null check for pkg.dependencies before calling Object.keys. This prevents
potential runtime crashes in case the package metadata is corrupted or
malformed.

pnpm11/global/commands/src/globalAdd.ts [194-197]

 function isPnpmCliOnlyGroup (pkg: GlobalPackageInfo): boolean {
+  if (pkg.dependencies == null || typeof pkg.dependencies !== 'object') return false
   const aliases = Object.keys(pkg.dependencies)
   return aliases.length > 0 && aliases.every((alias) => PNPM_CLI_PACKAGE_ALIASES.includes(alias))
 }
  • Apply / Chat
Suggestion importance[1-10]: 2

__

Why: While adding runtime safety is sometimes useful, TypeScript likely already guarantees pkg.dependencies is an object via the GlobalPackageInfo type, making this check mostly redundant.

Low
  • More

Copilot AI review requested due to automatic review settings July 7, 2026 14:11
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 2104f63

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

Grey Divider

New Review Started

This review has been superseded by a new analysis

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 92233bf

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 92233bf

1 similar comment
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 92233bf

@github-actions

github-actions Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 13b86f534845

Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD.

Scenario: Isolated linker: fresh restore, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.103 ± 0.181 3.849 4.332 1.95 ± 0.14
pacquet@main 4.123 ± 0.161 3.892 4.368 1.96 ± 0.14
pnpr@HEAD 2.107 ± 0.123 1.938 2.290 1.00
pnpr@main 2.130 ± 0.111 2.005 2.331 1.01 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.10333104284,
      "stddev": 0.18071645970089742,
      "median": 4.17415029914,
      "user": 3.8717338,
      "system": 3.3520686599999996,
      "min": 3.84902835864,
      "max": 4.33160989464,
      "times": [
        3.91636533964,
        3.84902835864,
        4.22269149164,
        4.301207392639999,
        4.33160989464,
        3.88256397164,
        4.21015745064,
        3.97138593064,
        4.19860935964,
        4.14969123864
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.1228810010400005,
      "stddev": 0.16058635996717863,
      "median": 4.18050909514,
      "user": 3.8656294999999994,
      "system": 3.3536332599999996,
      "min": 3.89229826864,
      "max": 4.36776982464,
      "times": [
        4.24388321164,
        4.36776982464,
        4.04473368464,
        3.89229826864,
        4.19247879264,
        4.2518842576399996,
        3.9610774046399997,
        4.17258791864,
        3.91366637564,
        4.18843027164
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.10721949524,
      "stddev": 0.12336471089935676,
      "median": 2.07079023814,
      "user": 2.7240209,
      "system": 2.8582320599999993,
      "min": 1.93819512564,
      "max": 2.29044435564,
      "times": [
        2.29044435564,
        2.04937324364,
        2.13125473164,
        2.04826468564,
        1.93819512564,
        2.2809248796399997,
        1.99225433164,
        2.01691912664,
        2.2323572396399998,
        2.09220723264
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.13029700874,
      "stddev": 0.11088794745449569,
      "median": 2.12410481514,
      "user": 2.7096764999999996,
      "system": 2.8715024599999994,
      "min": 2.00476043764,
      "max": 2.33125673564,
      "times": [
        2.26838143164,
        2.17378687064,
        2.1807250316399998,
        2.14431904464,
        2.0549327686399996,
        2.00787513864,
        2.00476043764,
        2.03304204264,
        2.10389058564,
        2.33125673564
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 639.2 ± 13.7 621.7 666.1 1.00
pacquet@main 681.1 ± 132.6 613.4 1054.1 1.07 ± 0.21
pnpr@HEAD 721.4 ± 77.1 679.4 939.2 1.13 ± 0.12
pnpr@main 694.3 ± 27.3 665.0 743.1 1.09 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.63915098594,
      "stddev": 0.013703113152152705,
      "median": 0.6366680979400001,
      "user": 0.36353716,
      "system": 1.3169059199999997,
      "min": 0.6216754079400001,
      "max": 0.66609578694,
      "times": [
        0.64492625894,
        0.6555043219400001,
        0.6325241379400001,
        0.62867085394,
        0.62621507994,
        0.6341456869400001,
        0.66609578694,
        0.6216754079400001,
        0.6425618159400001,
        0.6391905089400001
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.68109158274,
      "stddev": 0.13262462433050284,
      "median": 0.6432113019400001,
      "user": 0.36548976,
      "system": 1.31622402,
      "min": 0.61337555994,
      "max": 1.05405480694,
      "times": [
        0.6580140549400001,
        0.66367585494,
        0.62511153894,
        0.61337555994,
        0.6402274759400001,
        0.6200280369400001,
        0.61826369294,
        0.64619512794,
        1.05405480694,
        0.6719696779400001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.72143137084,
      "stddev": 0.07712649781147377,
      "median": 0.69994723244,
      "user": 0.38935395999999994,
      "system": 1.3661896199999999,
      "min": 0.67943375594,
      "max": 0.93917388294,
      "times": [
        0.7001910449400001,
        0.6859347949400001,
        0.70253122694,
        0.7062120809400001,
        0.69296463194,
        0.69468824594,
        0.67943375594,
        0.93917388294,
        0.6997034199400001,
        0.71348062394
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.69431951654,
      "stddev": 0.027337816824800153,
      "median": 0.6856030314400001,
      "user": 0.38538986,
      "system": 1.3465444199999999,
      "min": 0.66495951694,
      "max": 0.74311546094,
      "times": [
        0.7348315539400001,
        0.7063543679400001,
        0.68868445594,
        0.66495951694,
        0.67003028294,
        0.6825216069400001,
        0.74311546094,
        0.70424906594,
        0.67809462194,
        0.6703542319400001
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.273 ± 0.054 4.217 4.346 1.95 ± 0.13
pacquet@main 4.249 ± 0.039 4.204 4.331 1.94 ± 0.12
pnpr@HEAD 2.232 ± 0.126 2.054 2.468 1.02 ± 0.09
pnpr@main 2.196 ± 0.139 2.042 2.387 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.27295539074,
      "stddev": 0.053657088092261676,
      "median": 4.26383043204,
      "user": 3.849369399999999,
      "system": 3.32190576,
      "min": 4.21679242954,
      "max": 4.34551353154,
      "times": [
        4.24528226154,
        4.34551353154,
        4.328444215539999,
        4.30323801254,
        4.28237860254,
        4.341992633539999,
        4.21679242954,
        4.2289988335399995,
        4.21711426154,
        4.21979912554
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.24940951674,
      "stddev": 0.03870110998110847,
      "median": 4.25299379554,
      "user": 3.8351555,
      "system": 3.2784833600000005,
      "min": 4.204317544539999,
      "max": 4.33112529954,
      "times": [
        4.33112529954,
        4.251498070539999,
        4.25448952054,
        4.261134441539999,
        4.208366615539999,
        4.282192568539999,
        4.204317544539999,
        4.259928576539999,
        4.226117010539999,
        4.2149255195399995
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.23150401624,
      "stddev": 0.1263379673800546,
      "median": 2.2284994730400003,
      "user": 2.5791582999999996,
      "system": 2.79452136,
      "min": 2.05383742954,
      "max": 2.46770931954,
      "times": [
        2.46770931954,
        2.13106519254,
        2.20963709454,
        2.24736185154,
        2.05383742954,
        2.10901551054,
        2.32051202654,
        2.2934692715400002,
        2.1449837565400003,
        2.3374487095400003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.1959389228400004,
      "stddev": 0.1394277754335978,
      "median": 2.12894105254,
      "user": 2.5441487999999994,
      "system": 2.7937696599999997,
      "min": 2.04170807254,
      "max": 2.38687238154,
      "times": [
        2.37277995254,
        2.2554341835400002,
        2.13741515354,
        2.04170807254,
        2.12046695154,
        2.07683716154,
        2.08465149754,
        2.38310848354,
        2.38687238154,
        2.10011539054
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.369 ± 0.009 1.357 1.384 2.05 ± 0.20
pacquet@main 1.370 ± 0.037 1.339 1.469 2.05 ± 0.20
pnpr@HEAD 0.667 ± 0.064 0.640 0.847 1.00
pnpr@main 0.681 ± 0.105 0.631 0.978 1.02 ± 0.19
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.36865345304,
      "stddev": 0.009063654016650923,
      "median": 1.3696434591400002,
      "user": 1.3153181999999997,
      "system": 1.6919068199999998,
      "min": 1.35680014014,
      "max": 1.3843122811400002,
      "times": [
        1.3797252821400001,
        1.3714285451400001,
        1.3602916911400003,
        1.3721682081400002,
        1.35680014014,
        1.36313386814,
        1.35873999714,
        1.3843122811400002,
        1.37207614414,
        1.36785837314
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.3695039343400002,
      "stddev": 0.036807044928156986,
      "median": 1.3573701981400002,
      "user": 1.3131155999999997,
      "system": 1.69373932,
      "min": 1.33905068114,
      "max": 1.46914081814,
      "times": [
        1.3814429681400002,
        1.3598064091400002,
        1.46914081814,
        1.3710176901400002,
        1.35268015514,
        1.3569550511400001,
        1.3577853451400002,
        1.33905068114,
        1.3562323041400002,
        1.35092792114
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.66667755764,
      "stddev": 0.06388557734190364,
      "median": 0.64653712614,
      "user": 0.3379942,
      "system": 1.26582822,
      "min": 0.63975629814,
      "max": 0.84749999714,
      "times": [
        0.64163050314,
        0.6480609231400001,
        0.64324252114,
        0.64657245614,
        0.63975629814,
        0.84749999714,
        0.64751096214,
        0.64650179614,
        0.66383695014,
        0.64216316914
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.6813457199400001,
      "stddev": 0.10494337504302258,
      "median": 0.6493346496400001,
      "user": 0.3422843,
      "system": 1.26448042,
      "min": 0.6310128381400001,
      "max": 0.9782507661400001,
      "times": [
        0.6605412741400001,
        0.65747749714,
        0.64859572814,
        0.6319171331400001,
        0.6491727031400001,
        0.6310128381400001,
        0.64098450714,
        0.6660081561400001,
        0.9782507661400001,
        0.64949659614
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.029 ± 0.029 2.989 3.096 4.63 ± 0.07
pacquet@main 3.013 ± 0.028 2.968 3.057 4.61 ± 0.06
pnpr@HEAD 0.669 ± 0.008 0.659 0.686 1.02 ± 0.02
pnpr@main 0.654 ± 0.007 0.639 0.663 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.0291496948,
      "stddev": 0.0294714063564525,
      "median": 3.0276070826000003,
      "user": 1.74944876,
      "system": 1.9740157800000002,
      "min": 2.9886674556000004,
      "max": 3.0962884726,
      "times": [
        3.0962884726,
        3.0335772816,
        3.0473300466,
        3.0163136696,
        3.0146512986,
        3.0282244046,
        3.0002020916,
        2.9886674556000004,
        3.0392524666000003,
        3.0269897606000002
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.0126478452999996,
      "stddev": 0.028068842347811276,
      "median": 3.0110214671,
      "user": 1.7261979599999997,
      "system": 1.9693018800000002,
      "min": 2.9678919416,
      "max": 3.0568685836,
      "times": [
        3.0089944946,
        2.9990731676,
        3.0043984896,
        2.9678919416,
        3.0390473796,
        3.0130484396,
        3.0422992096,
        2.9770944126,
        3.0568685836,
        3.0177623346
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.6686203848,
      "stddev": 0.008108320898323845,
      "median": 0.6669234326000001,
      "user": 0.33423295999999997,
      "system": 1.3121199799999999,
      "min": 0.6586744996000001,
      "max": 0.6859997296000001,
      "times": [
        0.6648001146000001,
        0.6665931216000001,
        0.6586836826000001,
        0.6661021566,
        0.6586744996000001,
        0.6672537436000001,
        0.6704580816000001,
        0.6718630536000001,
        0.6757756646,
        0.6859997296000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.6536582597,
      "stddev": 0.006862187221975888,
      "median": 0.6539750636000001,
      "user": 0.33448506000000006,
      "system": 1.26955118,
      "min": 0.6390444306,
      "max": 0.6632350006000001,
      "times": [
        0.6571351376000001,
        0.6390444306,
        0.6576457866000001,
        0.6502141986000001,
        0.6632350006000001,
        0.6517992186000001,
        0.6489488486000001,
        0.6554780676,
        0.6524720596000001,
        0.6606098486
      ]
    }
  ]
}

Scenario: Isolated linker: fresh resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 644.5 ± 7.0 632.5 656.4 5.98 ± 0.10
pacquet@main 647.9 ± 4.7 641.9 654.3 6.01 ± 0.09
pnpr@HEAD 107.8 ± 1.4 106.8 111.9 1.00
pnpr@main 108.6 ± 2.9 106.6 119.0 1.01 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6445235756,
      "stddev": 0.0069782118619080655,
      "median": 0.6436222995,
      "user": 0.60111862,
      "system": 0.15238727999999999,
      "min": 0.632458528,
      "max": 0.656445667,
      "times": [
        0.64120499,
        0.64080717,
        0.645013364,
        0.64231867,
        0.632458528,
        0.644925929,
        0.645129812,
        0.656445667,
        0.641794259,
        0.655137367
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6478952597000001,
      "stddev": 0.00472829409294992,
      "median": 0.647757531,
      "user": 0.60765822,
      "system": 0.14983108,
      "min": 0.641905168,
      "max": 0.654325946,
      "times": [
        0.653001964,
        0.646976003,
        0.65198086,
        0.642780746,
        0.6429054200000001,
        0.641905168,
        0.648539059,
        0.652050924,
        0.654325946,
        0.644486507
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10780365264,
      "stddev": 0.0013567734657886558,
      "median": 0.107293761,
      "user": 0.027325779999999997,
      "system": 0.020991500000000003,
      "min": 0.10676300500000001,
      "max": 0.11194874,
      "times": [
        0.10699776300000001,
        0.107176993,
        0.107293761,
        0.107769817,
        0.10722558,
        0.106853929,
        0.107601878,
        0.107206462,
        0.107339394,
        0.107009305,
        0.10791964400000001,
        0.106831886,
        0.107291197,
        0.10766025500000001,
        0.107444469,
        0.10676300500000001,
        0.107482741,
        0.107256266,
        0.107072623,
        0.10719795900000001,
        0.107586575,
        0.10924574000000001,
        0.11173121200000001,
        0.10918412200000001,
        0.11194874
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.10860303958333332,
      "stddev": 0.002850987317674274,
      "median": 0.10745437199999999,
      "user": 0.026688186666666665,
      "system": 0.022187163333333332,
      "min": 0.106572148,
      "max": 0.118963185,
      "times": [
        0.111830499,
        0.106572148,
        0.107452437,
        0.107652653,
        0.107484534,
        0.106980343,
        0.107456307,
        0.107354406,
        0.107155231,
        0.107565905,
        0.112012885,
        0.107165931,
        0.10732965500000001,
        0.10745104500000001,
        0.10754693700000001,
        0.11192724300000001,
        0.107524593,
        0.10737189700000001,
        0.10727049200000001,
        0.112423984,
        0.107338573,
        0.10702990500000001,
        0.107612162,
        0.118963185
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 6.894 ± 0.192 6.574 7.200 1.42 ± 0.05
pacquet@main 6.785 ± 0.115 6.650 7.032 1.40 ± 0.04
pnpr@HEAD 4.850 ± 0.091 4.737 5.032 1.00
pnpr@main 4.909 ± 0.095 4.759 5.104 1.01 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 6.8944978816399995,
      "stddev": 0.1924595405128218,
      "median": 6.888990997840001,
      "user": 4.05748322,
      "system": 3.6084119800000005,
      "min": 6.574456507840001,
      "max": 7.19957789584,
      "times": [
        7.03705447984,
        7.08170192584,
        6.89803738484,
        7.19957789584,
        6.794710863840001,
        6.87994461084,
        6.574456507840001,
        6.78849139584,
        6.677755531840001,
        7.01324821984
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 6.784662545640001,
      "stddev": 0.11508957383954949,
      "median": 6.788013411340001,
      "user": 4.03871542,
      "system": 3.6166685800000002,
      "min": 6.64951713984,
      "max": 7.032282282840001,
      "times": [
        7.032282282840001,
        6.83963646084,
        6.73035546884,
        6.81658558584,
        6.64951713984,
        6.68436358684,
        6.65759534084,
        6.84138294284,
        6.759441236840001,
        6.83546541084
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 4.85018597424,
      "stddev": 0.09059819504339635,
      "median": 4.81523101734,
      "user": 2.8197857199999996,
      "system": 3.1034021799999993,
      "min": 4.7373466548400005,
      "max": 5.03220565584,
      "times": [
        4.916627113840001,
        4.77089364784,
        4.7373466548400005,
        4.804901640840001,
        5.03220565584,
        4.80208860584,
        4.7975008928400005,
        4.82556039384,
        4.8685018518400005,
        4.94623328484
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 4.908559134740001,
      "stddev": 0.09517510011163648,
      "median": 4.91463374534,
      "user": 2.8291432199999997,
      "system": 3.0935365799999994,
      "min": 4.758803670840001,
      "max": 5.10352719684,
      "times": [
        4.85133467484,
        4.90727334684,
        4.87657682684,
        4.80664520284,
        4.92199414384,
        4.957795922840001,
        4.758803670840001,
        4.9402586818400005,
        5.10352719684,
        4.961381679840001
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12840
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
4,272.96 ms
(+1.10%)Baseline: 4,226.41 ms
5,071.69 ms
(84.25%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
3,029.15 ms
(+0.47%)Baseline: 3,014.96 ms
3,617.96 ms
(83.73%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
1,368.65 ms
(+2.44%)Baseline: 1,336.10 ms
1,603.32 ms
(85.36%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
644.52 ms
(+1.72%)Baseline: 633.64 ms
760.37 ms
(84.76%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
4,103.33 ms
(+3.13%)Baseline: 3,978.68 ms
4,774.41 ms
(85.94%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
6,894.50 ms
(+1.12%)Baseline: 6,817.85 ms
8,181.42 ms
(84.27%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
639.15 ms
(+1.16%)Baseline: 631.84 ms
758.21 ms
(84.30%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12840
Testbedpnpr

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds flag.

Click to view all benchmark results
BenchmarkLatencymilliseconds (ms)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,231.50 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
668.62 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
666.68 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
107.80 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,107.22 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
4,850.19 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
721.43 ms
🐰 View full continuous benchmarking report in Bencher

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 13b86f5

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 13b86f5

1 similar comment
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 13b86f5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet product: pnpm@11 reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants