Skip to content

feat(pacquet): support global runtime install - #12814

Merged
zkochan merged 8 commits into
mainfrom
pacquet-global-runtime-install
Jul 5, 2026
Merged

zkochan merged 8 commits into
mainfrom
pacquet-global-runtime-install

Conversation

@zkochan

@zkochan zkochan commented Jul 5, 2026 •

Copy link
Copy Markdown
Member

Summary

pnpm runtime set <name> <version> -g now installs a runtime (Node/Deno/Bun) into the global packages directory and links its binary into the global bin directory, matching the TypeScript pnpm CLI. Previously pacquet rejected runtime set --global with a "not supported yet" stub.

The `<name>@runtime:<version>` selector is routed through the existing global-add pipeline. The one wrinkle: pacquet's manifest writer folds a runtime:<version> dependency into engines.runtime on save, so a globally-installed runtime is stored under engines.runtime with an empty dependencies map. The global scanner and bin-linker read dependencies, so without a fix they would link no binary. The global crate now reifies engines.runtime / devEngines.runtime back into dependencies when reading a group manifest — the same conversion the package-manifest reader already applies on read — so list -g, remove -g, and update -g see the runtime too.

The TypeScript pnpm CLI already ships this feature, so this PR brings pacquet to parity and needs no TypeScript-side change.

Verified end-to-end: runtime set node 22 -g downloads Node 22.23.1 and links node into the global bin dir (node --version → v22.23.1); list -g shows [email protected]; remove -g node unlinks it.

Follow-ups from review:

  • Argument validation for runtime set (both stacks): the runtime name must be node/deno/bun, and the version must not contain a comma. Without this, node,is-positive, ./foo, or 22,evil could be misread by the global-add pipeline as a package list / local path and install unintended packages. Errors are ERR_PNPM_INVALID_RUNTIME_NAME / ERR_PNPM_INVALID_RUNTIME_VERSION, with tests and a changeset.
  • Global-install config isolation (pacquet-only; the TS CLI already isolates via its cwd-anchored re-spawn): a -g install now (a) pins its workspace root to the install dir so it can't adopt the global-settings pnpm-workspace.yaml, (b) drops the caller project's overrides/catalogs/catalogMode/etc., and (c) anchors its config at the pnpm home so a project .npmrc can't steer the network/TLS/registry of a global fetch. Each is covered by a regression test that fails without the fix.

Squash Commit Body

`pnpm runtime set <name> <version> -g` now installs the runtime
(Node/Deno/Bun) into the global packages directory and links its binary
into the global bin directory, matching the TypeScript pnpm CLI. It
previously errored with a "not supported yet" stub.

The `<name>@runtime:<version>` selector is routed through the existing
global-add pipeline. The wrinkle: pacquet's manifest writer folds a
`runtime:<version>` dependency into `engines.runtime` on save, so a
globally-installed runtime lands under `engines.runtime` with an empty
`dependencies` map. The global scanner and bin-linker read `dependencies`,
so without a fix they would link no binary. The global crate now reifies
`engines.runtime` / `devEngines.runtime` back into dependencies when
reading a group manifest — the same conversion the package manifest
reader already applies — so an installed runtime is treated as the direct
dependency it is. `list -g`, `remove -g`, and `update -g` therefore see
it too.

The TypeScript pnpm CLI already ships this feature, so this brings pacquet
to parity and needs no TypeScript change; pacquet crates are unpublished,
so no changeset is required.

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pacquet/ port, or the description notes what still needs porting.
    (The TypeScript CLI already ships runtime set -g; this PR brings the
    Rust pacquet/ port to parity. No TypeScript-side change is needed.)
  • Added or updated tests. (Global-crate reify unit tests plus the
    runtime-command selector test; verified the full install/list/remove
    lifecycle end-to-end.)
  • Updated the documentation if needed. (The pnpm runtime set -g
    behavior is already documented; this is a parity port with no
    user-visible surface change.)

Written by an agent (Claude Code, claude-opus-4-8).

Summary by CodeRabbit

  • New Features

    • Global installs and updates now use the correct global configuration, improving -g behavior.
    • Runtime selection now supports global installation and shows clearer errors for unsupported runtime names.
  • Bug Fixes

    • Global installs now ignore unrelated workspace files and caller-specific overrides.
    • Runtime version input is validated more strictly to prevent unintended install targets.
    • Global package scanning now detects runtime-based installs more reliably.

`pnpm runtime set <name> <version> -g` now installs the runtime
(Node/Deno/Bun) into the global packages directory and links its binary
into the global bin directory, matching the TypeScript pnpm CLI. It
previously errored with a "not supported yet" stub.

The `<name>@runtime:<version>` selector is routed through the existing
global-add pipeline. The wrinkle: pacquet's manifest writer folds a
`runtime:<version>` dependency into `engines.runtime` on save, so a
globally-installed runtime lands under `engines.runtime` with an empty
`dependencies` map. The global scanner and bin-linker read `dependencies`,
so without a fix they would link no binary. The global crate now reifies
`engines.runtime` / `devEngines.runtime` back into dependencies when
reading a group manifest — the same conversion the package manifest
reader already applies — so an installed runtime is treated as the direct
dependency it is. `list -g`, `remove -g`, and `update -g` therefore see
it too.

The TypeScript pnpm CLI already ships this feature, so this brings pacquet
to parity and needs no TypeScript change; pacquet crates are unpublished,
so no changeset is required.
Copilot AI review requested due to automatic review settings July 5, 2026 06:41

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 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

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

Use the following commands to manage reviews:

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

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds global runtime installation support, shared global package alias scanning, and runtime-name validation across pacquet and pnpm11. It also updates tests and release metadata.

Changes

Global Runtime Install Support

Layer / File(s) Summary
Runtime global dispatch
pacquet/crates/cli/src/cli_args/dispatch.rs, pacquet/crates/cli/src/cli_args/dispatch_install.rs, pacquet/crates/cli/src/cli_args/runtime.rs, pacquet/crates/cli/src/cli_args/runtime/tests.rs
Adds global_config, routes global install/update/remove through it, adds run_global, and updates runtime tests for selector construction and invalid-name handling.
Shared alias scanning
pacquet/crates/global/Cargo.toml, pacquet/crates/global/src/lib.rs, pacquet/crates/global/src/scan.rs, pacquet/crates/cli/src/cli_args/global.rs, pacquet/crates/global/src/scan/tests.rs, pacquet/crates/cli/tests/global.rs
Adds shared direct-dependency alias reading, converts runtime fields into dependency fields during package JSON reading, updates CLI global add to use the shared helper, and expands scan/regression tests for global runtime installs.
Runtime name validation
pacquet/crates/package-manifest/src/lib.rs, pnpm11/engine/runtime/commands/package.json, pnpm11/engine/runtime/commands/src/runtime/runtime.ts, pnpm11/engine/runtime/commands/test/runtime.test.ts, pnpm11/engine/runtime/commands/tsconfig.json, .changeset/validate-runtime-name.md
Adds runtime-alias validation helpers, wires them into pnpm11 runtime command handling, updates tests and TypeScript references, and records the patch release in the changeset.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related issues

  • Rust Roadmap #11633: The changes touch the same runtime command path and add global runtime installation handling plus name validation.

Possibly related PRs

  • pnpm/pnpm#12571: Shares the same runtime command path changes, including global handling and selector validation.
  • pnpm/pnpm#12638: Uses the same global install plumbing that this PR now invokes for runtime set --global.

Suggested labels: product: pacquet

Suggested reviewers: KSXGitHub

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pacquet-global-runtime-install

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-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Enable global runtime installs via pnpm runtime set -g in pacquet

✨ Enhancement 🧪 Tests ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Route pnpm runtime set … -g through the existing global add/install pipeline.
• Reify engines.runtime back into dependency aliases so global scanning/bin linking sees runtimes.
• Add unit tests covering runtime reification and global runtime discovery.
Diagram

graph TD
A["pnpm runtime set -g"] --> B{"--global?"} --> C["RuntimeArgs::run_global"] --> D["global::handle_global_add"] --> E["Global group package.json"] --> F["global::read_package_json\n(reify engines.runtime)"] --> G["scan/list/remove\n+ bin linking"]
B --> H["RuntimeArgs::run (project)"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Persist global runtimes in `dependencies` (skip engines folding)
  • ➕ Avoids needing reification logic in the global crate
  • ➕ Keeps global group manifests closer to how scanners already interpret installs
  • ➖ Diverges global manifest shape from project manifests and pnpm parity expectations
  • ➖ Requires special-casing manifest writer based on context (global vs project)
2. Teach global scanner/bin-linker to read `engines.runtime` directly
  • ➕ Localizes behavior to global scanning/linking without changing JSON parsing step
  • ➖ Duplicates conversion logic already implemented in pacquet-package-manifest
  • ➖ More places to maintain runtime semantics (dependencies vs engines)

Recommendation: Keep the PR’s approach: reuse the already-established convert_engines_runtime_to_dependencies behavior in the global manifest reader. It centralizes the runtime-as-dependency view at the boundary (JSON read) and ensures all downstream global operations (list/remove/update/bin linking) behave consistently without proliferating runtime-specific branches.

Files changed (8) +164 / -42

Enhancement (4) +59 / -34
dispatch_install.rsDispatch 'runtime' command to global install path when '--global' +11/-1

Dispatch 'runtime' command to global install path when '--global'

• Removes the previous early rejection of 'runtime set --global'. When 'args.global' is set, it initializes config/dir and routes execution to 'RuntimeArgs::run_global' with the active reporter; otherwise it preserves the existing project-scoped runtime behavior.

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

global.rsUse global-crate alias reader for direct dependency aliases +3/-18

Use global-crate alias reader for direct dependency aliases

• Replaces the CLI-local JSON parsing helper for dependency aliases with 'pacquet_global::read_direct_dependency_aliases'. This ensures alias discovery includes runtimes reified from 'engines.runtime' during global installs.

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

runtime.rsImplement 'runtime set -g' via 'handle_global_add' +32/-15

Implement 'runtime set -g' via 'handle_global_add'

• Adds 'RuntimeArgs::run_global', building the same '<name>@runtime:<version>' selector as the project path and invoking the existing global-add pipeline. Removes the prior 'GlobalUnsupported' error and documents the global semantics (always saved to 'dependencies').

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

scan.rsExpose direct dependency alias reader that includes reified runtimes +13/-0

Expose direct dependency alias reader that includes reified runtimes

• Adds 'read_direct_dependency_aliases', returning validated direct dependency aliases from a group manifest after runtime reification occurs on read. Wires in a test module for scan-related behaviors.

pacquet/crates/global/src/scan.rs

Bug fix (1) +16 / -3
lib.rsReify 'engines.runtime' into dependencies when reading global manifests +16/-3

Reify 'engines.runtime' into dependencies when reading global manifests

• Enhances 'read_package_json' to call 'convert_engines_runtime_to_dependencies' for both 'devEngines/devDependencies' and 'engines/dependencies'. This makes downloaded runtimes visible to global scanners and bin-linkers that rely on dependency maps.

pacquet/crates/global/src/lib.rs

Tests (2) +88 / -5
tests.rsUpdate runtime tests to assert global selector construction +9/-5

Update runtime tests to assert global selector construction

• Replaces the prior test that asserted '--global' was rejected. Now verifies that global runtime installs still build the correct '<name>@runtime:<version>' selector via 'set_request'.

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

tests.rsAdd tests for runtime reification and global runtime scanning +79/-0

Add tests for runtime reification and global runtime scanning

• Introduces unit tests that model a globally installed runtime stored under 'engines.runtime' with 'onFail: "download"' and a synthesized package bin. Validates that reification produces a direct dependency alias, that non-download engine checks are ignored, and that scanning can discover/link the runtime group on Unix.

pacquet/crates/global/src/scan/tests.rs

Other (1) +1 / -0
Cargo.tomlAdd 'pacquet-package-manifest' dependency to global crate +1/-0

Add 'pacquet-package-manifest' dependency to global crate

• Introduces a dependency on 'pacquet-package-manifest' so the global crate can reuse the shared engines-runtime reification helper.

pacquet/crates/global/Cargo.toml

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

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. allowBuilds saved wrong directory ✓ Resolved 🐞 Bug ☼ Reliability
Description
Global installs now set cfg.workspace_dir to the per-group install_dir, and approve-builds
uses config.workspace_dir as the directory to write pnpm-workspace.yaml (allowBuilds)
decisions. This persists build approvals into the ephemeral install group directory instead of the
stable global packages directory, so approvals won’t be reused across future global installs and can
leave stray workspace manifests under each install group.
Code

pacquet/crates/cli/src/cli_args/global.rs[R289-297]

+    // Pin the group's workspace root to its own install dir (pnpm's
+    // `rootProjectManifestDir: installDir`, `workspaceDir: undefined`). The
+    // install dir sits *under* the global packages dir, which carries a
+    // `pnpm-workspace.yaml` of global settings (`allowBuilds`, `catalog`,
+    // ...). Leaving this unset would let the install pipeline walk up, adopt
+    // that file as the workspace, and then fail trying to enumerate its
+    // non-existent root project. Anchoring here keeps the group install an
+    // isolated single project.
+    cfg.workspace_dir = Some(install_dir.clone());
Evidence
The global install now sets workspace_dir to install_dir; the global approve-builds flow passes
a config clone into ApproveBuildsArgs::prepare, which chooses settings_dir from
config.workspace_dir, and set_allow_builds writes pnpm-workspace.yaml into that directory.
Therefore the approvals are written under the per-group install dir, not the global packages dir
passed as dir.

pacquet/crates/cli/src/cli_args/global.rs[289-333]
pacquet/crates/cli/src/cli_args/global.rs[364-390]
pacquet/crates/cli/src/cli_args/approve_builds.rs[88-160]
pacquet/crates/workspace-manifest-writer/src/lib.rs[164-199]

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

## Issue description
`run_group_install` pins `cfg.workspace_dir = Some(install_dir.clone())` to prevent the install pipeline from walking up and adopting the global settings `pnpm-workspace.yaml`. However, `ApproveBuildsArgs::prepare()` writes `allowBuilds` into `initial_config.workspace_dir` when set. Because global installs now set `workspace_dir` to `install_dir`, approvals are written into the per-group install dir rather than the global packages dir.
### Issue Context
- Global installs intentionally load build-script policy from the global packages directory.
- The approval prompt is also intended to persist decisions in the global packages directory so subsequent global installs reuse them.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/global.rs[289-333]
- pacquet/crates/cli/src/cli_args/global.rs[364-390]
- pacquet/crates/cli/src/cli_args/approve_builds.rs[88-141]
- pacquet/crates/workspace-manifest-writer/src/lib.rs[164-199]
### Proposed fix
1. Keep `cfg.workspace_dir = Some(install_dir.clone())` for the install pipeline isolation.
2. In `prompt_approve_global_builds`, provide a `config_fn` whose returned config has `workspace_dir` set to the **global packages dir** (or `None`), so `approve-builds` persists `allowBuilds` to `global_pkg_dir`.
- Example approach: clone `config`, then set `workspace_dir = Some(global_pkg_dir.to_path_buf())` before leaking for the `config_fn` call.
3. Ensure the rebuild step uses a config that reflects the just-written `allowBuilds` (e.g., reload config after writing, or update `config.allow_builds` in memory before calling `run_rebuild`).
4. Add a regression test: perform a global install that triggers ignored builds, approve them, then run a second global install and assert the prompt does not re-appear and that `pnpm-workspace.yaml` under the **global packages dir** contains the persisted `allowBuilds` entry.

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


2. Project npmrc affects global ✓ Resolved 🐞 Bug ⛨ Security
Description
runtime set -g loads Config from the caller’s --dir and feeds it into the global install
pipeline, so a repo-controlled .npmrc can control proxy/TLS settings used to fetch a
globally-installed runtime. This can downgrade transport security (e.g. strict-ssl=false / custom
cafile) or redirect traffic during a global runtime install that then links binaries into the
global bin dir.
Code

pacquet/crates/cli/src/cli_args/dispatch_install.rs[R319-328]

+    if args.global {
+        let config = (ctx.config)()?;
+        let dir = ctx.dir;
+        return Ok(match ctx.reporter {
+            ReporterType::Default | ReporterType::AppendOnly => {
+                Box::pin(args.run_global::<DefaultReporter>(config, dir))
+            }
+            ReporterType::Ndjson => Box::pin(args.run_global::<NdjsonReporter>(config, dir)),
+            ReporterType::Silent => Box::pin(args.run_global::<SilentReporter>(config, dir)),
+        });
Evidence
The new global-runtime dispatch explicitly pulls config from ctx.config() (which is loaded from
the caller’s --dir) and routes it into the global install pipeline. Config::current() applies
proxy/TLS keys from the nearest .npmrc, and State::init constructs the install HTTP client using
config.proxy/config.tls, so any repo-scoped .npmrc settings will affect global runtime
downloads unless they are explicitly stripped/reloaded for the global context.

pacquet/crates/cli/src/cli_args/dispatch_install.rs[315-337]
pacquet/crates/cli/src/cli_args/dispatch.rs[155-187]
pacquet/crates/config/src/lib.rs[1694-1708]
pacquet/crates/config/src/lib.rs[1810-1841]
pacquet/crates/cli/src/state.rs[74-92]
pacquet/crates/cli/src/cli_args/global.rs[268-334]

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

## Issue description
`runtime set -g` currently uses `ctx.config()` (resolved from the caller’s `--dir`) and passes that config into the global-add install pipeline. `Config::current()` explicitly applies proxy/TLS settings from the nearest project `.npmrc`, and `State::init` uses `config.proxy`/`config.tls` to construct the HTTP client for installs. As a result, a malicious repository can influence the network/TLS trust decisions of a *global* runtime install.
### Issue Context
The code already strips some project-scoped resolution settings for global installs (overrides/catalogs/etc.), but it leaves network/TLS settings intact. The new `runtime set -g` path makes this easier to hit because users will run it inside arbitrary repos.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/dispatch_install.rs[319-328]
- pacquet/crates/cli/src/cli_args/runtime.rs[85-106]
- pacquet/crates/cli/src/cli_args/global.rs[268-334]
### What to change
Implement a dedicated “global install config” load that is anchored at PNPM home (or another trusted global location) rather than the caller’s `--dir`, and use it for `runtime set -g` (and ideally all `*-g` installs).
Concretely, one of these approaches:
1. **Preferred (pnpm parity):** Create a helper to load config via `Config::default().current::<Host>(pnpm_home_dir)` and apply CLI overrides, then pass that config to `handle_global_add`.
2. **Alternative:** In `run_group_install`, after cloning `base_config`, explicitly reset network/TLS-related fields that may come from project `.npmrc` (proxy/TLS/local-address/strict-ssl, registry overrides, etc.) and re-load them from trusted user/global sources.
Add a regression test similar to the existing override/catalog tests: create a project `.npmrc` that disables strict SSL (or sets a fake proxy), run `runtime set node 22 -g`, and assert the global install uses the trusted/global config instead of the project-scoped one (e.g., by verifying the effective config seen by the HTTP client or by asserting a request goes to the expected registry).

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


3. Version comma install injection ✓ Resolved 🐞 Bug ⛨ Security
Description
RuntimeArgs::set_request/TypeScript runtimeSet interpolate the user-supplied version/versionSpec
into a single selector (@runtime:) that is forwarded into the global-add pipeline (run_global →
handle_global_add / pnpm add --global). Because global-add splits any selector containing ,
into multiple selectors, a command like pnpm runtime set node 22,evil -g can unintentionally
install/link evil globally in addition to the intended runtime version.
Code

pacquet/crates/cli/src/cli_args/runtime.rs[R128-130]

let version_spec = self.params.get(2).map_or("", |version| version.trim());
let dependency_group = if self.save_dev || !self.save_prod {
  DependencyGroup::Dev
Evidence
Both implementations build the global-add selector by concatenating the raw, user-controlled version
string into ${runtimeName}@runtime:${versionSpec ?? ''} (Rust: concatenating the raw version and
forwarding via RuntimeArgs::run_global into handle_global_add; TypeScript: forwarding into `pnpm
add --global). The cited global-add logic (handle_global_add grouping via split_comma_separated`
/ the globalAdd implementation) explicitly splits any comma-containing parameter into multiple
selectors (with exceptions like URLs/paths noted in the TS context), so embedding a comma in the
versionSpec changes the parsed install targets, leading to extra packages being installed and their
bins linked globally.

pacquet/crates/cli/src/cli_args/runtime.rs[92-106]
pacquet/crates/cli/src/cli_args/runtime.rs[108-137]
pacquet/crates/cli/src/cli_args/global.rs[453-477]
pnpm11/engine/runtime/commands/src/runtime/runtime.ts[101-116]
pnpm11/global/commands/src/globalAdd.ts[176-187]

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

## Issue description
`pnpm runtime set <name> <version> -g` is routed through the global-add pipeline, which treats comma-separated input as multiple selectors. Because `RuntimeArgs::set_request` / `runtimeSet` currently forward the raw user-supplied version/versionSpec inside a single selector (`<name>@runtime:<version>`), a malicious or accidental comma (e.g., `22,evil`) can cause unintended additional packages to be installed and their bins linked globally.
## Issue Context
- Global runtime install flows through `RuntimeArgs::run_global` → `handle_global_add` (Rust) / `runtimeSet` → `pnpm add --global` (TypeScript).
- The global-add grouping logic splits comma-containing params into multiple selectors (noting in the TS context that splitting is avoided for inputs that look like URLs or existing local paths).
- Runtime *name* validation was added, but the *version* remains user-controlled and is concatenated into the same comma-splittable selector string.
## Fix Focus Areas
- pacquet/crates/cli/src/cli_args/runtime.rs[108-138]
- pacquet/crates/cli/src/cli_args/global.rs[453-477]
- pacquet/crates/cli/src/cli_args/runtime/tests.rs[68-98]
- pnpm11/engine/runtime/commands/src/runtime/runtime.ts[101-133]
- pnpm11/global/commands/src/globalAdd.ts[176-187]
- pnpm11/engine/runtime/commands/test/runtime.test.ts[158-174]

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


View more (1)
4. Runtime name selector injection ✓ Resolved 🐞 Bug ⛨ Security
Description
RuntimeArgs::set_request accepts an arbitrary runtime_name and interpolates it into a selector
that run_global forwards into handle_global_add; the global-add pipeline then treats commas as
package separators and leading-dot tokens as local paths. This can make `pnpm runtime set <name>
<ver> -g` install/link unintended extra packages or a local directory’s binaries into the global bin
dir when the user expects only a runtime install.
Code

pacquet/crates/cli/src/cli_args/runtime.rs[R85-103]

+    pub async fn run_global<Reporter: self::Reporter + 'static>(
+        self,
+        config: &'static Config,
+        dir: &Path,
+    ) -> miette::Result<()> {
+        let request = self.set_request()?;
+        Box::pin(handle_global_add::<Reporter>(
+            config,
+            std::slice::from_ref(&request.package_name),
+            PinnedVersion::Major,
+            config.supported_architectures.clone(),
+            dir,
+        ))
+        .await
+    }
+
fn set_request(&self) -> Result<RuntimeSetRequest, RuntimeError> {
let Some(subcommand) = self.params.first() else {
return Err(RuntimeError::NoSubcommand);
Evidence
The runtime name is taken verbatim from CLI args and formatted into a single selector string, then
the global-add pipeline splits comma-separated tokens and rewrites .-prefixed params into
normalized local paths. Repository code also documents/encodes that only a small fixed set of
runtime names is intended, making lack of validation actionable and not just theoretical.

pacquet/crates/cli/src/cli_args/runtime.rs[78-124]
pacquet/crates/cli/src/cli_args/global.rs[445-506]
pacquet/crates/package-manifest/src/lib.rs[335-403]
docker/README.md[8-36]

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

## Issue description
`pnpm runtime set … -g` currently builds the selector from an unvalidated `runtime_name` and forwards it to the global-add pipeline. Because global-add splits selectors on commas and normalizes `.`-prefixed tokens as local paths, a crafted runtime name (e.g. `node,evil` or `./evil`) can unexpectedly install/link additional packages/binaries globally.
### Issue Context
This new behavior is introduced by routing `runtime set -g` through `handle_global_add`, which applies `split_into_groups`/`split_comma_separated` and `resolve_local_param`.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/runtime.rs[85-123]
### Suggested fix
1. Add a validation step in `set_request()` (or immediately before calling `handle_global_add`) to restrict `runtime_name` to the supported runtime identifiers (at minimum `node|deno|bun`, matching the runtime support elsewhere), and reject names containing `,` or path-like prefixes (`.`/`file:`/`link:`/`/`/`~`/Windows drive forms).
2. Return a dedicated `RuntimeError` variant (e.g. `InvalidRuntimeName`) with an `ERR_PNPM_…` code.
3. Add unit tests covering rejection of `runtime set node,evil 22 -g` and `runtime set ./evil 22 -g`.

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



Remediation recommended

5. Global installs drop patches 🐞 Bug ⛨ Security
Description
run_group_install() clears cfg.package_extensions and cfg.patched_dependencies before
performing global installs, so any packageExtensions / patchedDependencies configured via the
pnpm-home pnpm-workspace.yaml will not apply to add -g / update -g / runtime set -g. This
can install globally-resolved dependency graphs without expected manifest fixes or security patches.
Code

pacquet/crates/cli/src/cli_args/global.rs[R309-313]

+    cfg.overrides = None;
+    cfg.catalogs = None;
+    cfg.catalog_mode = CatalogMode::default();
+    cfg.package_extensions = None;
+    cfg.patched_dependencies = None;
Evidence
The global install pipeline explicitly nulls out package_extensions and patched_dependencies
before running installs, even though these settings are loaded from pnpm-workspace.yaml into
Config and are used by the resolver/install pipeline to apply packageExtensions hooks and
patchedDependencies logic.

pacquet/crates/cli/src/cli_args/global.rs[289-314]
pacquet/crates/config/src/workspace_yaml.rs[773-833]
pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs[828-846]
pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs[958-973]

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

## Issue description
Global installs currently drop `Config.package_extensions` and `Config.patched_dependencies` inside `run_group_install()`. Since global commands now load config anchored at the pnpm home, this also drops *trusted pnpm-home* settings that are needed for patching/manifest-fix parity and can be relied on for security patches.
### Issue Context
- `WorkspaceSettings::apply(...)` loads `patchedDependencies` and `packageExtensions` from `pnpm-workspace.yaml` into `Config`.
- The install pipeline consumes `config.package_extensions` (read-package hooks) and `config.resolved_patched_dependencies()` / `patched_dependency_hashes()` (patch application + drift checks).
- Clearing these fields for global installs prevents those mechanisms from running for `-g` flows.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/global.rs[289-314]

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


6. Global config anchor fallback 🐞 Bug ⛨ Security
Description
For -g operations, global_config falls back to anchoring at the caller’s --dir when
default_pnpm_home_dir() returns None, which can re-enable project .npmrc control of
registry/proxy/TLS settings for a global install in HOME-less/container environments. This
undermines the intended security boundary for global fetches/binary linking when global dirs are
provided via overrides/config.
Code

pacquet/crates/cli/src/cli_args/dispatch.rs[R198-200]

+        let pnpm_home_dir = default_pnpm_home_dir::<Host>();
+        let global_config_anchor = pnpm_home_dir.as_deref().unwrap_or(&dir);
+        let global_config = || load_config(global_config_anchor);
Evidence
The CLI explicitly uses unwrap_or(&dir) to select the global config anchor, and
Config::current() applies network/TLS/proxy settings from the nearest .npmrc based on that
anchor; additionally, the config model allows global dir/bin overrides, so global commands may not
necessarily fail just because pnpm home is missing.

pacquet/crates/cli/src/cli_args/dispatch.rs[186-200]
pacquet/crates/config/src/defaults.rs[113-139]
pacquet/crates/config/src/lib.rs[1694-1707]
pacquet/crates/config/src/lib.rs[532-551]

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

## Issue description
`global_config_anchor` falls back to `--dir` when `default_pnpm_home_dir()` is `None`. In that fallback mode, config loading can read the nearest project `.npmrc` and apply its registry/proxy/TLS settings to a global install, which is exactly what the new isolation is trying to prevent.
### Issue Context
- `Config::current()` explicitly applies registry/proxy/TLS settings from the nearest `.npmrc` in the anchor chain.
- `Config` supports explicit `global_dir` / `global_bin_dir` overrides, so global operations may still proceed even when pnpm home cannot be determined.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/dispatch.rs[186-200]
### Proposed fix
- Do **not** fall back to `&dir` for `global_config`.
- If pnpm home cannot be determined (`default_pnpm_home_dir::<Host>() == None`), return an error for global-mutating commands instructing the user to set `PNPM_HOME` (or otherwise ensure a resolvable home), instead of loading project-anchored config.
- Alternatively (if you want to support HOME-less environments), derive a safe global anchor exclusively from trusted global locations (e.g., `PNPM_HOME`), but avoid any anchor that can be repo-controlled via `--dir`.

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



Informational

7. Redundant manifest re-parse 🐞 Bug ➹ Performance
Description
handle_global_add reads/parses the group package.json twice (via read_installed_packages and
read_direct_dependency_aliases), adding avoidable I/O/JSON overhead on the global install path.
This is low impact but easy to consolidate.
Code

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

    let pkgs = read_installed_packages(&install_dir);
-        let aliases = read_aliases(&install_dir);
+        let aliases = read_direct_dependency_aliases(&install_dir);
Evidence
The CLI path calls both functions back-to-back, and both functions independently read
install_dir/package.json via read_package_json, which implies two parses per installed group.

pacquet/crates/cli/src/cli_args/global.rs[99-112]
pacquet/crates/global/src/scan.rs[124-148]

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

## Issue description
`handle_global_add` calls two helpers that both read and parse `install_dir/package.json`, doing redundant work.
### Issue Context
- `read_installed_packages()` calls `read_package_json(install_dir)`.
- `read_direct_dependency_aliases()` also calls `read_package_json(install_dir)`.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/global.rs[107-112]
- pacquet/crates/global/src/scan.rs[124-148]
### Suggested fix
- Read the group manifest once and derive both outputs from it.
- Option A: Add a new helper in `pacquet_global` like `read_group_manifest_deps(install_dir) -> (Vec<PackageBinSource>, Vec<String>)`.
- Option B: Expose an internal helper that returns the parsed manifest `Value` once, then reuse it for both alias extraction and package listing.
- Keep validation behavior consistent (i.e., continue filtering aliases via `dependencies_of`).

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


8. Unneeded spec allocations 🐞 Bug ➹ Performance
Description
handle_global_add now uses read_direct_dependency_aliases(), which builds (alias, spec) pairs
and allocates a String for every dependency spec even though the caller only needs alias keys.
This adds avoidable CPU/allocations to the global install path (including runtime set -g)
proportional to the number of direct dependencies in the group manifest.
Code

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

 let pkgs = read_installed_packages(&install_dir);
-        let aliases = read_aliases(&install_dir);
+        let aliases = read_direct_dependency_aliases(&install_dir);
Evidence
The PR changed global add to call read_direct_dependency_aliases, which in turn calls
dependencies_of. dependencies_of allocates/clones the spec string for every dependency entry,
but read_direct_dependency_aliases discards that spec and keeps only the alias, making those
allocations unnecessary for this code path.

pacquet/crates/cli/src/cli_args/global.rs[99-111]
pacquet/crates/global/src/scan.rs[140-148]
pacquet/crates/global/src/scan.rs[200-221]

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

## Issue description
`handle_global_add()` switched from a keys-only alias reader to `read_direct_dependency_aliases()`. The new helper currently goes through `dependencies_of()`, which materializes `(alias, spec)` pairs and allocates `spec.to_string()` for each dependency, but `read_direct_dependency_aliases()` discards the spec immediately.
This is a small but unnecessary allocation/CPU cost on the global install flow.
## Issue Context
- The global add pipeline only needs direct dependency *aliases* to compute cache keys and detect/replace existing installs.
- Runtime reification can still be preserved by continuing to read via `read_package_json()` (which already performs the engines.runtime -> dependencies conversion).
## Fix Focus Areas
- pacquet/crates/global/src/scan.rs[140-148]
- pacquet/crates/global/src/scan.rs[200-221]
### Suggested implementation direction
- Implement a new helper that returns just validated dependency keys without allocating spec strings (e.g. iterate `dependencies` object keys, filter with `is_valid_dependency_alias`, and `cloned()` the keys).
- Update `read_direct_dependency_aliases()` to use that new helper instead of `dependencies_of()`.
- (Optional, broader) Consider similarly updating `read_installed_packages()` since it also ignores the spec payload.

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


Grey Divider

Qodo Logo

@github-actions

github-actions Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
tarball/download_dependency    1.00      7.1±0.37ms   614.9 KB/sec    1.01      7.1±0.42ms   608.6 KB/sec

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

Copy link
Copy Markdown

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

@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 (1)
pacquet/crates/global/src/scan/tests.rs (1)

46-63: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Add a guard test for ordinary engines.node/engines.npm manifests.

Existing tests cover the runtime shape and its onFail: "warn" variant, but not a plain "engines": {"node": ">=18"} manifest (very common in real packages). Add a case asserting read_direct_dependency_aliases stays empty and read_installed_packages is unaffected for such a manifest, to guard the reification logic's trust boundary.

✅ Suggested additional test
#[test]
fn ordinary_engines_node_range_is_not_reified() {
    let tmp = TempDir::new().unwrap();
    write_json(
        &tmp.path().join("package.json"),
        &json!({
            "engines": { "node": ">=18" },
        }),
    );

    assert!(read_direct_dependency_aliases(tmp.path()).is_empty());
    assert!(read_installed_packages(tmp.path()).is_empty());
}
🤖 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/global/src/scan/tests.rs` around lines 46 - 63, Add a guard
test for plain engines manifests so the scan logic does not reify them as
installed packages or dependency aliases. In the test module around
engines_runtime_without_download_is_not_treated_as_installed, add a case for a
normal package.json with engines.node (and optionally engines.npm) using a
simple range like ">=18", then assert read_direct_dependency_aliases and
read_installed_packages both remain empty. Keep the test focused on the trust
boundary in the scan/reification behavior.
🤖 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/global/src/scan/tests.rs`:
- Around line 46-63: Add a guard test for plain engines manifests so the scan
logic does not reify them as installed packages or dependency aliases. In the
test module around engines_runtime_without_download_is_not_treated_as_installed,
add a case for a normal package.json with engines.node (and optionally
engines.npm) using a simple range like ">=18", then assert
read_direct_dependency_aliases and read_installed_packages both remain empty.
Keep the test focused on the trust boundary in the scan/reification behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 12ffc7ca-6b1f-4dd8-8abd-af5d43c95923

📥 Commits

Reviewing files that changed from the base of the PR and between e0616d3 and baa28c7.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !Cargo.lock
📒 Files selected for processing (8)
  • pacquet/crates/cli/src/cli_args/dispatch_install.rs
  • pacquet/crates/cli/src/cli_args/global.rs
  • pacquet/crates/cli/src/cli_args/runtime.rs
  • pacquet/crates/cli/src/cli_args/runtime/tests.rs
  • pacquet/crates/global/Cargo.toml
  • pacquet/crates/global/src/lib.rs
  • pacquet/crates/global/src/scan.rs
  • pacquet/crates/global/src/scan/tests.rs

@github-actions github-actions Bot added reviewed: qodo reviewed: coderabbit CodeRabbit submitted an approving review labels Jul 5, 2026
@codecov-commenter

codecov-commenter commented Jul 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.51613% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.18%. Comparing base (2b5e9bc) to head (00fa622).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pacquet/crates/cli/src/cli_args/runtime.rs 28.57% 15 Missing ⚠️
...acquet/crates/cli/src/cli_args/dispatch_install.rs 36.36% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12814      +/-   ##
==========================================
+ Coverage   85.07%   85.18%   +0.11%     
==========================================
  Files         415      416       +1     
  Lines       65544    65903     +359     
==========================================
+ Hits        55761    56141     +380     
+ Misses       9783     9762      -21     

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

zkochan added 2 commits July 5, 2026 08:56
`pnpm runtime set <name> <version>` interpolates the runtime name into a
`pnpm add` selector. Because the global-add pipeline splits a selector on
commas and normalizes path-like tokens as local paths, an unsupported
name such as `node,is-positive` or `./foo` could be misread and install
unintended packages or a local directory's bins.

Validate the name against the supported runtimes (node, deno, bun) up
front and error with `ERR_PNPM_INVALID_RUNTIME_NAME` otherwise. Applied to
both the TypeScript CLI (`@pnpm/engine.runtime.commands`) and the Rust
`pacquet/` port so their behavior stays identical.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 76436d7

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 76436d7

A global install creates its group dir under the global packages
directory, which carries a `pnpm-workspace.yaml` of global settings
(allowBuilds, catalog, ...). With no workspace root pinned, the install
pipeline walked up from the group dir, adopted that file as the
workspace, and then failed trying to enumerate its non-existent root
project — breaking `add -g`, `update -g`, and `runtime set -g` on any
machine that already had global settings written there.

Pin the group's workspace root to its own install dir (matching pnpm's
`rootProjectManifestDir: installDir`) so the install stays an isolated
single project. The group's `allowBuilds` is still read from the global
dir explicitly, as before.
@github-actions

github-actions Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 00fa6222b001

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 3.814 ± 0.199 3.544 4.140 1.79 ± 0.14
pacquet@main 3.737 ± 0.106 3.650 4.007 1.76 ± 0.11
pnpr@HEAD 2.127 ± 0.125 1.985 2.339 1.00
pnpr@main 2.223 ± 0.127 2.037 2.398 1.04 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.81369501844,
      "stddev": 0.19899419017317627,
      "median": 3.7864398133400003,
      "user": 3.5411303199999997,
      "system": 3.3619348199999997,
      "min": 3.54425903934,
      "max": 4.14017742334,
      "times": [
        4.14017742334,
        3.54425903934,
        3.62884075434,
        3.82952040734,
        3.7433592193400003,
        3.9735731313400002,
        3.91202692334,
        3.6480145843400003,
        3.67001332834,
        4.04716537334
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.73665819064,
      "stddev": 0.10647625380968624,
      "median": 3.70776344034,
      "user": 3.60614202,
      "system": 3.38242262,
      "min": 3.6496816243400003,
      "max": 4.00738429534,
      "times": [
        3.7219372543400002,
        3.70017607334,
        4.00738429534,
        3.71535080734,
        3.69677121434,
        3.6496816243400003,
        3.7293770853400003,
        3.66245026234,
        3.8191002543400003,
        3.66435303534
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.1272457276400005,
      "stddev": 0.12503747373960944,
      "median": 2.0832842198400003,
      "user": 2.6641323199999993,
      "system": 2.9866572199999997,
      "min": 1.98491141434,
      "max": 2.33919560534,
      "times": [
        2.32557218934,
        2.33919560534,
        2.0319609933400002,
        2.19373897534,
        1.98491141434,
        2.0796450863400002,
        2.08692335334,
        2.01056609834,
        2.15788302034,
        2.06206054034
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.22269065834,
      "stddev": 0.12710107272835974,
      "median": 2.2726744648399997,
      "user": 2.6847739200000005,
      "system": 2.99678532,
      "min": 2.03692428634,
      "max": 2.39815199834,
      "times": [
        2.09334634234,
        2.29157446134,
        2.03692428634,
        2.04881840634,
        2.32701929234,
        2.16782726334,
        2.39815199834,
        2.25793289734,
        2.31789560334,
        2.28741603234
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 651.0 ± 12.2 633.8 674.0 1.00
pacquet@main 676.7 ± 83.6 635.8 911.7 1.04 ± 0.13
pnpr@HEAD 721.4 ± 84.5 671.6 949.8 1.11 ± 0.13
pnpr@main 737.6 ± 50.8 690.0 868.3 1.13 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.65101723958,
      "stddev": 0.012160868786088531,
      "median": 0.6475659228799999,
      "user": 0.38829551999999995,
      "system": 1.3275706,
      "min": 0.63376476788,
      "max": 0.67403221888,
      "times": [
        0.64740328888,
        0.63376476788,
        0.64112544088,
        0.64772855688,
        0.64114893688,
        0.67403221888,
        0.65998087788,
        0.65656312788,
        0.64546581488,
        0.66295936488
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.67673164788,
      "stddev": 0.08364019467416395,
      "median": 0.6507679238799999,
      "user": 0.3836303199999999,
      "system": 1.3343713999999998,
      "min": 0.63578455788,
      "max": 0.91173838488,
      "times": [
        0.6362770948800001,
        0.64820973588,
        0.67019618688,
        0.65332611188,
        0.63891971988,
        0.66574894188,
        0.63957041888,
        0.63578455788,
        0.66754532588,
        0.91173838488
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.72137600258,
      "stddev": 0.08447132164588238,
      "median": 0.69150616738,
      "user": 0.39597871999999995,
      "system": 1.3555296,
      "min": 0.67158360588,
      "max": 0.9497890048800001,
      "times": [
        0.68761574988,
        0.67908674288,
        0.71808172288,
        0.67158360588,
        0.67486931388,
        0.70776218088,
        0.67284764288,
        0.69539658488,
        0.9497890048800001,
        0.75672747688
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.7376289689800001,
      "stddev": 0.050754038256754695,
      "median": 0.72316341638,
      "user": 0.40032752,
      "system": 1.3620652999999998,
      "min": 0.69001847488,
      "max": 0.8682982998800001,
      "times": [
        0.76219544588,
        0.7470854408800001,
        0.71105782088,
        0.72566183188,
        0.69001847488,
        0.70713098988,
        0.72066500088,
        0.8682982998800001,
        0.73940016888,
        0.7047762158800001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.265 ± 0.043 4.165 4.323 2.00 ± 0.10
pacquet@main 4.237 ± 0.044 4.179 4.298 1.99 ± 0.10
pnpr@HEAD 2.221 ± 0.146 2.040 2.496 1.04 ± 0.08
pnpr@main 2.131 ± 0.101 1.994 2.368 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.26538062706,
      "stddev": 0.042810548187688376,
      "median": 4.27434978296,
      "user": 3.75074284,
      "system": 3.3933604799999997,
      "min": 4.16528680646,
      "max": 4.32307441146,
      "times": [
        4.25310937446,
        4.2825453734600005,
        4.25119402446,
        4.28036070646,
        4.28093628646,
        4.30497720046,
        4.32307441146,
        4.26833885946,
        4.16528680646,
        4.24398322746
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.236898119560001,
      "stddev": 0.04427434735249548,
      "median": 4.23259187146,
      "user": 3.765843039999999,
      "system": 3.38134808,
      "min": 4.17881537546,
      "max": 4.29808956146,
      "times": [
        4.18676223146,
        4.1928696404600005,
        4.21819967146,
        4.29808956146,
        4.28078957446,
        4.17881537546,
        4.26330797446,
        4.24698407146,
        4.28739595646,
        4.21576713846
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.2213929175600002,
      "stddev": 0.14591295726852652,
      "median": 2.19329438946,
      "user": 2.49133174,
      "system": 2.91913028,
      "min": 2.03955730446,
      "max": 2.49587261346,
      "times": [
        2.0716010374600002,
        2.2144186564600004,
        2.14220879346,
        2.03955730446,
        2.49587261346,
        2.4206385044600003,
        2.1721701224600003,
        2.13108221946,
        2.2446972934600002,
        2.28168263046
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.13067188446,
      "stddev": 0.10137824949157802,
      "median": 2.11992828196,
      "user": 2.54852554,
      "system": 2.90231278,
      "min": 1.99428289146,
      "max": 2.36829164246,
      "times": [
        2.15678734246,
        2.08789156446,
        2.03555988046,
        2.1317048724600003,
        1.99428289146,
        2.36829164246,
        2.15224833746,
        2.1851239324600003,
        2.1081516914600003,
        2.08667668946
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.388 ± 0.021 1.355 1.409 2.08 ± 0.07
pacquet@main 1.378 ± 0.053 1.331 1.517 2.06 ± 0.10
pnpr@HEAD 0.668 ± 0.020 0.650 0.717 1.00
pnpr@main 0.675 ± 0.015 0.659 0.709 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.3878038943599997,
      "stddev": 0.020595530899392926,
      "median": 1.39453256386,
      "user": 1.3441809,
      "system": 1.7094783599999996,
      "min": 1.35528673736,
      "max": 1.40869655836,
      "times": [
        1.40723082636,
        1.40307247436,
        1.40869655836,
        1.35528673736,
        1.35720050636,
        1.4004004723599999,
        1.38866465536,
        1.36913315336,
        1.40385595736,
        1.38449760236
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.3776110942599997,
      "stddev": 0.05332978135695402,
      "median": 1.36458225236,
      "user": 1.3361987000000002,
      "system": 1.69420026,
      "min": 1.33145649836,
      "max": 1.51655207036,
      "times": [
        1.3487297703599999,
        1.35510688336,
        1.51655207036,
        1.38536403936,
        1.39467249236,
        1.36036335136,
        1.36880115336,
        1.3829150773599999,
        1.33145649836,
        1.33214960636
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.6677385303600001,
      "stddev": 0.019683396289025823,
      "median": 0.6628843923600001,
      "user": 0.336729,
      "system": 1.2800017599999998,
      "min": 0.6500354303600001,
      "max": 0.71742167436,
      "times": [
        0.6500354303600001,
        0.71742167436,
        0.6503522973600001,
        0.6745655513600001,
        0.65778853936,
        0.6573388063600001,
        0.6775547943600001,
        0.6614370283600001,
        0.6665594253600001,
        0.6643317563600001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.67458237536,
      "stddev": 0.015415859442794316,
      "median": 0.6695468438600001,
      "user": 0.34134809999999993,
      "system": 1.2969758599999996,
      "min": 0.6588377823600001,
      "max": 0.70890467036,
      "times": [
        0.70890467036,
        0.67765861636,
        0.6677711483600001,
        0.6622426543600001,
        0.6588377823600001,
        0.6668299593600001,
        0.6652614383600001,
        0.6713225393600001,
        0.69319894936,
        0.6737959953600001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.048 ± 0.068 2.991 3.222 4.66 ± 0.11
pacquet@main 3.003 ± 0.057 2.958 3.154 4.60 ± 0.10
pnpr@HEAD 0.674 ± 0.008 0.660 0.687 1.03 ± 0.02
pnpr@main 0.654 ± 0.007 0.644 0.667 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.0477708172199995,
      "stddev": 0.06814609020103937,
      "median": 3.0176940541199997,
      "user": 1.77835596,
      "system": 1.9712491200000002,
      "min": 2.99051005062,
      "max": 3.22244740562,
      "times": [
        3.0663361946200003,
        3.07789390662,
        3.06088199562,
        2.99051005062,
        3.01395980662,
        3.02142830162,
        3.0108322316200002,
        3.00488850762,
        3.22244740562,
        3.00852977162
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.00312583532,
      "stddev": 0.05729667739730704,
      "median": 2.9808950341200005,
      "user": 1.7434516599999998,
      "system": 1.9612166199999996,
      "min": 2.95807664762,
      "max": 3.15367052062,
      "times": [
        2.97913115962,
        3.0319750456200003,
        2.95807664762,
        2.97027789562,
        2.96635190862,
        2.9792955296200003,
        3.00242173562,
        2.98249453862,
        3.15367052062,
        3.00756337162
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.67424911062,
      "stddev": 0.008492523403419583,
      "median": 0.6723755971200001,
      "user": 0.33550236,
      "system": 1.3230849199999999,
      "min": 0.66024844262,
      "max": 0.68708634962,
      "times": [
        0.66924690162,
        0.68048691662,
        0.6829535236200001,
        0.67105811362,
        0.66764872262,
        0.67369308062,
        0.66820431762,
        0.68708634962,
        0.66024844262,
        0.68186473762
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.65356182292,
      "stddev": 0.006535582924182424,
      "median": 0.65337783212,
      "user": 0.33985115999999993,
      "system": 1.2754509200000002,
      "min": 0.64354314162,
      "max": 0.66662219562,
      "times": [
        0.66662219562,
        0.65266497562,
        0.6554782906200001,
        0.64918559062,
        0.6555449896200001,
        0.64354314162,
        0.64661913462,
        0.6523169546200001,
        0.65409068862,
        0.65955226762
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 613.4 ± 8.4 606.0 633.4 5.69 ± 0.09
pacquet@main 605.9 ± 8.1 595.3 620.0 5.62 ± 0.09
pnpr@HEAD 107.8 ± 0.9 104.8 109.1 1.00
pnpr@main 108.0 ± 1.0 106.7 110.1 1.00 ± 0.01
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6134391907600001,
      "stddev": 0.008420118238644008,
      "median": 0.6117317692600001,
      "user": 0.5816617399999999,
      "system": 0.14950139999999998,
      "min": 0.60603943276,
      "max": 0.63339999276,
      "times": [
        0.6151988877600001,
        0.6144844687600001,
        0.60723801676,
        0.60897906976,
        0.60657881276,
        0.60603943276,
        0.6188536317600001,
        0.60730045676,
        0.61631913776,
        0.63339999276
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.60586905276,
      "stddev": 0.00811010374498688,
      "median": 0.6038236857600001,
      "user": 0.57349324,
      "system": 0.1506305,
      "min": 0.59533773376,
      "max": 0.62001611676,
      "times": [
        0.60006419576,
        0.60162047776,
        0.6082422817600001,
        0.6002083647600001,
        0.62001611676,
        0.6162682527600001,
        0.59901185976,
        0.6118943507600001,
        0.59533773376,
        0.6060268937600001
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10782566056000002,
      "stddev": 0.0008904650052628879,
      "median": 0.10808850176000001,
      "user": 0.02739062,
      "system": 0.0178281,
      "min": 0.10484449576,
      "max": 0.10914389876000001,
      "times": [
        0.10728014276,
        0.10759530376000001,
        0.10484449576,
        0.10816787976000002,
        0.10673699976,
        0.10826476276000001,
        0.10837601776000001,
        0.10863868476,
        0.10786629676000001,
        0.10764749876000002,
        0.10890825076,
        0.10808850176000001,
        0.10735141876000001,
        0.10720133576,
        0.10856283676,
        0.10813118076000001,
        0.10862626176000001,
        0.10836798476000001,
        0.10688227076000001,
        0.10704445076,
        0.10914389876000001,
        0.10809800876,
        0.10797751476,
        0.10741020876000001,
        0.10842930776000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.10797223071999999,
      "stddev": 0.001018568498522823,
      "median": 0.10793158076,
      "user": 0.027165340000000003,
      "system": 0.018673940000000003,
      "min": 0.10672610476000001,
      "max": 0.11006547776,
      "times": [
        0.10858060976000002,
        0.10816465276000001,
        0.10674431276000002,
        0.10901000776000001,
        0.10678641476,
        0.10838487376000001,
        0.10997958876000001,
        0.10706624076000001,
        0.10718568576000001,
        0.10869534376000001,
        0.10766233676,
        0.10677711376000001,
        0.10835709276000001,
        0.11006547776,
        0.10740458176,
        0.10672610476000001,
        0.10801577076,
        0.10884944776000001,
        0.10812090076000001,
        0.10793158076,
        0.10735257376000001,
        0.10779862976000001,
        0.10972790676000001,
        0.10714129976,
        0.10677721976000001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 6.551 ± 0.141 6.351 6.792 1.34 ± 0.04
pacquet@main 6.564 ± 0.098 6.447 6.715 1.34 ± 0.04
pnpr@HEAD 5.036 ± 0.116 4.904 5.238 1.03 ± 0.03
pnpr@main 4.890 ± 0.122 4.732 5.161 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 6.551178212139999,
      "stddev": 0.14074352601482112,
      "median": 6.503470185339999,
      "user": 3.6932434600000006,
      "system": 3.6603431800000004,
      "min": 6.3506449818399995,
      "max": 6.79179596384,
      "times": [
        6.66819176884,
        6.43195972284,
        6.44313781084,
        6.79179596384,
        6.3506449818399995,
        6.65325693384,
        6.47429597284,
        6.69155859584,
        6.50295770184,
        6.50398266884
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 6.56421784784,
      "stddev": 0.09752041513749955,
      "median": 6.5537541818400005,
      "user": 3.7782954600000003,
      "system": 3.6726581800000004,
      "min": 6.44711205384,
      "max": 6.71455067884,
      "times": [
        6.55463078584,
        6.48586861884,
        6.55287757784,
        6.46584918684,
        6.61662626084,
        6.44711205384,
        6.48099605284,
        6.71455067884,
        6.61433281384,
        6.70933444884
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 5.035714247539999,
      "stddev": 0.11589947401993711,
      "median": 4.99001047334,
      "user": 2.7520113600000005,
      "system": 3.2233707800000007,
      "min": 4.90407504484,
      "max": 5.2384205678399995,
      "times": [
        5.02632712384,
        4.9465974588399995,
        4.97621233484,
        4.90407504484,
        5.11223418984,
        4.95333421984,
        4.98124559084,
        4.998775355839999,
        5.21992058884,
        5.2384205678399995
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 4.88990779804,
      "stddev": 0.12204735404975686,
      "median": 4.85853811334,
      "user": 2.80492186,
      "system": 3.17449358,
      "min": 4.73220600484,
      "max": 5.16102138684,
      "times": [
        5.00390153884,
        4.84014851084,
        4.860323194839999,
        5.16102138684,
        4.9555842738399996,
        4.85675303184,
        4.79234507384,
        4.87035689884,
        4.73220600484,
        4.82643806584
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12814
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,265.38 ms
(+0.71%)Baseline: 4,235.19 ms
5,082.23 ms
(83.93%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
3,047.77 ms
(+0.85%)Baseline: 3,022.16 ms
3,626.60 ms
(84.04%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
1,387.80 ms
(+3.39%)Baseline: 1,342.34 ms
1,610.81 ms
(86.16%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
613.44 ms
(-2.22%)Baseline: 627.35 ms
752.82 ms
(81.49%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
3,813.70 ms
(-5.72%)Baseline: 4,045.09 ms
4,854.11 ms
(78.57%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
6,551.18 ms
(-4.71%)Baseline: 6,875.12 ms
8,250.14 ms
(79.41%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
651.02 ms
(+2.34%)Baseline: 636.12 ms
763.34 ms
(85.29%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 5, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12814
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,221.39 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
674.25 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
667.74 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
107.83 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
2,127.25 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
5,035.71 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
721.38 ms
🐰 View full continuous benchmarking report in Bencher

Copilot AI review requested due to automatic review settings July 5, 2026 07:58

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 2a76582

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 2a76582

…tion config

A global install runs in-process against the config already loaded from
the caller's directory, so it inherited that project's dependency-graph
settings. When the caller was a repo whose `overrides` referenced a
`catalog:` (e.g. pnpm's own workspace), the isolated global install — which
sees no catalogs — failed resolving the override with
`ERR_PNPM_CATALOG_IN_OVERRIDES`; an inherited `catalogMode: strict` would
likewise reject the install against an empty catalog.

Clear the project-scoped resolution config (overrides, catalogs,
catalogMode, packageExtensions, patchedDependencies) on the per-group
config, matching pnpm, which runs the global install with `cwd` set to the
pnpm home directory. Affects `add -g`, `update -g`, and `runtime set -g`
alike.

@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 (1)
pacquet/crates/cli/tests/global.rs (1)

143-181: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Regression test correctly targets the override/catalog-leak fix.

The test setup (workspace overrides referencing catalog: + catalogMode: strict) matches the fix described in the commit summary, and asserting success() here would fail without the cfg.overrides = None; cfg.catalogs = None; cfg.catalog_mode = CatalogMode::default(); fix in pacquet/crates/cli/src/cli_args/global.rs. This satisfies the "regression-meaningful" requirement.

One optional improvement: this test's structure (create pnpm_home/global_bin, write workspace yaml, run add -g, assert success, check bin exists, drop cleanup) is essentially identical to the preceding global_add_ignores_ambient_global_workspace_yaml test (lines 103-142, not shown in this diff but referenced in the summary). Consider extracting a small helper (e.g., run_global_add_and_assert_bin_exists(workspace, expected_bin)) to reduce duplication between the two tests.

♻️ Sketch of a shared helper
+fn assert_global_add_succeeds(workspace: &Path, pnpm_home: &Path, package: &str, expected_bin: &str) {
+    use assert_cmd::assert::OutputAssertExt;
+    let global_bin = pnpm_home.join("bin");
+    fs::create_dir_all(&global_bin).expect("create global bin dir");
+    global_command(workspace, pnpm_home)
+        .with_arg("add")
+        .with_arg("-g")
+        .with_arg(package)
+        .assert()
+        .success();
+    assert!(global_bin.join(expected_bin).exists());
+}

As per path instructions, "missed reuse or duplication across the monorepo" is in scope for correctness/maintainability depth.

🤖 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/tests/global.rs` around lines 143 - 181, The regression
test in global_add_ignores_caller_project_overrides is correct, but it
duplicates the setup/assertion flow used by
global_add_ignores_ambient_global_workspace_yaml. Extract the shared
global-add-and-bin-exists sequence into a small helper in the global.rs test
module, then reuse it from both tests while keeping the specific workspace YAML
setup separate so the override/catalog regression remains covered.

Source: Path instructions

🤖 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/tests/global.rs`:
- Around line 143-181: The regression test in
global_add_ignores_caller_project_overrides is correct, but it duplicates the
setup/assertion flow used by global_add_ignores_ambient_global_workspace_yaml.
Extract the shared global-add-and-bin-exists sequence into a small helper in the
global.rs test module, then reuse it from both tests while keeping the specific
workspace YAML setup separate so the override/catalog regression remains
covered.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f61a4215-f157-4264-bd1b-05163b8958ff

📥 Commits

Reviewing files that changed from the base of the PR and between 2a76582 and 59a58f6.

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

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 59a58f6

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 59a58f6

zkochan added 2 commits July 5, 2026 20:51
`pnpm runtime set <name> <version>` interpolates the version into the same
`<name>@runtime:<version>` selector the global-add pipeline splits on
commas. The name is already validated to a known runtime, but the version
was not, so `runtime set node 22,evil -g` could smuggle in a second install
target. Reject a comma in the version in both stacks; no valid runtime
version (semver, dist-tag, channel) contains one.
A `-g` install ran against the config loaded from the caller's `--dir`, so
a project `.npmrc` could steer the network / TLS / registry decisions of a
*global* install (e.g. `strict-ssl=false`, a proxy, a custom `cafile`, or a
registry redirect) — a repo the user merely `cd`-ed into could downgrade
transport security or redirect traffic for a globally-linked binary.

pnpm avoids this by running the global install with `cwd` set to the pnpm
home dir. Mirror that: load a second config anchored at the pnpm home
(resolved from `PNPM_HOME` / platform defaults, never the project) and use
it for `add -g`, `update -g`, `remove -g`, and `runtime set -g`. Local-path
selectors are still resolved relative to the caller's directory.

The global e2e tests now seed the mocked registry / store at the pnpm home,
since the isolated install no longer reads the workspace `.npmrc`.
Copilot AI review requested due to automatic review settings July 5, 2026 18:53

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 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 (1)
pacquet/crates/cli/src/cli_args/dispatch_install.rs (1)

319-328: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add an e2e for runtime set … -g

pacquet/crates/cli/tests/global.rs covers add -g, but this newly enabled runtime path still lacks end-to-end coverage. Add a global round-trip test here so the dispatch branch and global_config isolation stay covered.

🤖 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/dispatch_install.rs` around lines 319 - 328,
The global dispatch branch in dispatch_install should be covered by an
end-to-end test for the runtime `set ... -g` path, since only `add -g` is
currently exercised. Add a new round-trip test in the global test suite using
the existing global test helpers and assertions around
`dispatch_install`/`run_global`, verifying that `global_config` is used and that
the global state remains isolated from the local config path.

Source: Path instructions

🤖 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/dispatch_install.rs`:
- Around line 319-328: The global dispatch branch in dispatch_install should be
covered by an end-to-end test for the runtime `set ... -g` path, since only `add
-g` is currently exercised. Add a new round-trip test in the global test suite
using the existing global test helpers and assertions around
`dispatch_install`/`run_global`, verifying that `global_config` is used and that
the global state remains isolated from the local config path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6a928721-bd8e-45ee-835c-e98a0047ac16

📥 Commits

Reviewing files that changed from the base of the PR and between 59a58f6 and ac551a3.

📒 Files selected for processing (8)
  • .changeset/validate-runtime-name.md
  • pacquet/crates/cli/src/cli_args/dispatch.rs
  • pacquet/crates/cli/src/cli_args/dispatch_install.rs
  • pacquet/crates/cli/src/cli_args/runtime.rs
  • pacquet/crates/cli/src/cli_args/runtime/tests.rs
  • pacquet/crates/cli/tests/global.rs
  • pnpm11/engine/runtime/commands/src/runtime/runtime.ts
  • pnpm11/engine/runtime/commands/test/runtime.test.ts
✅ Files skipped from review due to trivial changes (1)
  • .changeset/validate-runtime-name.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • pacquet/crates/cli/src/cli_args/runtime/tests.rs
  • pnpm11/engine/runtime/commands/test/runtime.test.ts
  • pnpm11/engine/runtime/commands/src/runtime/runtime.ts
  • pacquet/crates/cli/src/cli_args/runtime.rs

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

Copy link
Copy Markdown

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

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

Copy link
Copy Markdown

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

`approve-builds` writes the `allowBuilds` decision to `config.workspace_dir`,
falling back to the passed dir (the global packages dir). Pinning the group
install's `workspace_dir` to the per-group install dir (to keep the install
pipeline from adopting the global settings workspace) meant the approval
landed in that throwaway install dir instead — so it wasn't reused by later
global installs and left a stray `pnpm-workspace.yaml` under each group.

Clear `workspace_dir` on the config used for the approval so the decision
persists to the stable global packages dir; the rebuild keeps the install
dir anchor so it still doesn't walk up.

The global e2e tests now pin a per-test store via `pnpm-workspace.yaml`
(`storeDir` isn't read from `.npmrc`), so a build's side-effects cache can't
leak across runs and hide the ignored-build approval flow.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 00fa622

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 00fa622

@zkochan
zkochan merged commit 23996e9 into main Jul 5, 2026
35 checks passed
@zkochan
zkochan deleted the pacquet-global-runtime-install branch July 5, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review reviewed: qodo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants