Skip to content

feat(pacquet-cli): add fetch command - #12588

Merged
zkochan merged 7 commits into
pnpm:mainfrom
kairosci:feat/pacquet-fetch
Jun 25, 2026
Merged

zkochan merged 7 commits into
pnpm:mainfrom
kairosci:feat/pacquet-fetch

Conversation

@kairosci

@kairosci kairosci commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Ports the pnpm fetch command to the pacquet Rust CLI. Fetches packages from the lockfile into the virtual store without resolving or writing a lockfile, by running the install pipeline with frozen_lockfile=true and ignore_manifest_check=true. The --prod and --dev flags filter which dependency groups are fetched.

Related to #11633

Squash Commit Body

Ports the fetch command from pnpm to pacquet. The CliCommand::Fetch variant dispatches to FetchArgs::run. The command requires a lockfile (state(true)), sets frozen_lockfile and ignore_manifest_check to true, and uses the prod/dev flags to filter DependencyGroup membership. Optional dependencies are always included. No changeset because pacquet is not a published package.

Related to pnpm/pnpm#11633

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust pacquet/ port, or the description notes what still needs porting. Implemented in pacquet only; the TypeScript CLI already has this command at pnpm11/installing/commands/src/fetch.ts.
  • No changeset needed pacquet-internal changes do not affect published packages.
  • Tests added for fetch command execution with and without lockfile.
  • No documentation changes needed.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added a new pacquet fetch command under the package store command group, with --prod/-P and --dev/-D flags to choose which dependency groups to fetch.
  • Bug Fixes

    • Ensures fetch follows the same reporting/execution behavior as related install-family commands.
  • Tests

    • Added integration tests verifying fetch fails without a lockfile.
    • Added coverage confirming fetch succeeds after a lockfile is generated and populates the package store.

@kairosci
kairosci requested a review from zkochan as a code owner June 22, 2026 15:12
@coderabbitai

coderabbitai Bot commented Jun 22, 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

Adds a new pacquet fetch CLI subcommand with --prod (-P) and --dev (-D) flags. The command determines dependency groups to include and delegates to the existing Install implementation with frozen-lockfile enforced and KeepAll seed update policy. Integration tests verify failure without a lockfile and success after one is generated.

Changes

fetch subcommand

Layer / File(s) Summary
FetchArgs struct and run implementation
pacquet/crates/cli/src/cli_args/fetch.rs
Defines FetchArgs clap struct with --prod/--dev flags. run computes dependency groups (both Prod+Dev when flags are equal, otherwise the flagged group; always includes Optional), derives the lockfile path from the manifest directory, and calls Install with frozen-lockfile, KeepAll seed policy, non-full, non-dry-run, and checksum-update-disabled settings.
CLI wiring
pacquet/crates/cli/src/cli_args.rs
Exports pub mod fetch, imports FetchArgs, adds CliCommand::Fetch(FetchArgs) to the "package store" subcommand group, adds Fetch to the install-family matcher for reporter footer behavior, adds a clippy allow attribute for large stack frames, and dispatches CliCommand::Fetch to args.run::<Reporter>(state(true)?) for all reporter types.
Integration tests
pacquet/crates/cli/tests/fetch.rs
Adds test imports, a pacquet_at helper that locates the pacquet binary and sets its working directory, fetch_requires_existing_lockfile (asserts pacquet fetch fails without a lockfile), and fetch_succeeds_with_lockfile (runs pacquet install --lockfile-only first, then asserts pacquet fetch succeeds and verifies the package store is populated without creating node_modules).

Possibly related PRs

  • pnpm/pnpm#12046: Introduced the lockfile_only flag and its handling in Install/InstallWithFreshLockfile, which the new fetch command explicitly sets to false in its Install construction.
  • pnpm/pnpm#12542: Extends pacquet/crates/cli/src/cli_args.rs to add new CliCommand subcommands and hook them into the shared is_install_family footer detection and CLI dispatch, following the same pattern as the fetch command wiring.
  • pnpm/pnpm#12497: Extends pacquet/crates/cli/src/cli_args.rs by adding a new CliCommand variant and a corresponding CliArgs::run dispatch path for a different subcommand, demonstrating the same CLI integration pattern.

Suggested reviewers

  • zkochan

🎯 2 (Simple) | ⏱️ ~10 minutes

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

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

feat(pacquet-cli): add fetch command and metadata cache subcommands
✨ Enhancement 🧪 Tests ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

Description

• Add fetch command to prefetch lockfile packages into the virtual store.
• Add cache subcommand group to list/view/delete registry metadata cache files.
• Expose resolver mirror helpers and add tests covering cache CLI side effects.
Diagram

graph TD
A["pacquet CLI"] --> B["Fetch command"] --> C["Install pipeline"] --> D[("Virtual store")]
A --> E["Cache command"] --> F["mirror module"] --> G["Metadata cache FS"]
F --> D
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Dedicated lockfile-prefetch pipeline (no Install)
  • ➕ Reduces risk of unintended side effects from full install pipeline stages
  • ➕ Potentially faster by skipping non-fetch steps and observer hooks
  • ➕ Clearer separation between 'prefetch' and 'install'
  • ➖ Duplicates logic already implemented/maintained in Install
  • ➖ Higher chance of divergence vs pnpm semantics over time
2. Expose an explicit `InstallMode::FetchOnly` configuration
  • ➕ Keeps reuse of Install while making intent explicit and auditable
  • ➕ Centralizes behavior toggles (frozen/ignore-manifest/lockfile-only) in one place
  • ➖ Requires API changes in pacquet_package_manager
  • ➖ May be overkill until more fetch-specific behavior is needed

Recommendation: The current approach—reusing pacquet_package_manager::Install with frozen_lockfile=true and ignore_manifest_check=true—is a good default because it maximizes behavioral consistency with installs and minimizes duplicated logic. If fetch grows additional semantics (e.g., stricter store-only behavior, perf tuning, or reduced side effects), consider formalizing a FetchOnly/mode flag in the Install API to make the contract explicit and easier to test.

Files changed (7) +396 / -1

Enhancement (4) +309 / -1
cli_args.rsWire 'cache' and 'fetch' into CLI command parsing and dispatch +23/-0

Wire 'cache' and 'fetch' into CLI command parsing and dispatch

• Registers new 'cache' and 'fetch' modules and adds 'CliCommand' variants. Dispatches 'cache' directly with a loaded 'Config', and dispatches 'fetch' through the reporter-specific async path while requiring lockfile state.

pacquet/crates/cli/src/cli_args.rs

cache.rsImplement metadata cache management subcommands +221/-0

Implement metadata cache management subcommands

• Introduces 'cache list', 'list-registries', 'view', and 'delete' commands. Uses resolver mirror helpers to encode package names and load cached metadata, supports glob-like selection, prevents path traversal, and optionally checks store-index presence when presenting cached vs non-cached versions.

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

fetch.rsAdd 'fetch' command that prefetches lockfile dependencies via Install +64/-0

Add 'fetch' command that prefetches lockfile dependencies via Install

• Implements 'fetch' with '--prod'/'--dev' filtering (optional always included) and runs the install pipeline in a fetch-like configuration (frozen lockfile, ignore manifest check, not lockfile-only). Wraps failures with a 'fetching dependencies' context message.

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

lib.rsExport 'mirror' module publicly for CLI use +1/-1

Export 'mirror' module publicly for CLI use

• Makes the 'mirror' module public so the CLI cache command can call mirror helpers (e.g., registry name encoding and metadata loading).

pacquet/crates/resolving-npm-resolver/src/lib.rs

Refactor (1) +3 / -0
mirror.rsAnnotate mirror helper APIs with '#[must_use]' +3/-0

Annotate mirror helper APIs with '#[must_use]'

• Adds '#[must_use]' to metadata-related helper functions to discourage accidental ignoring of their return values, improving correctness at call sites.

pacquet/crates/resolving-npm-resolver/src/mirror.rs

Tests (1) +83 / -0
cache.rsAdd CLI integration tests for cache listing and deletion +83/-0

Add CLI integration tests for cache listing and deletion

• Adds tests asserting 'cache list-registries', 'cache list', and 'cache delete' outputs and filesystem side effects using a temp cwd and mocked registry setup.

pacquet/crates/cli/tests/cache.rs

Other (1) +1 / -0
Cargo.tomlAdd 'wax' dependency for glob-based cache walking +1/-0

Add 'wax' dependency for glob-based cache walking

• Adds the 'wax' crate to support glob construction and directory walking used by the new cache subcommands.

pacquet/crates/cli/Cargo.toml

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

qodo-free-for-open-source-projects Bot commented Jun 22, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (17) 📘 Rule violations (0) 📎 Requirement gaps (0) 📜 Skill insights (0)

Context used
✅ Tickets: 🎫 Rust Roadmap

Grey Divider


Action required

1. Workspace lockfile path mismatch 🐞 Bug ≡ Correctness
Description
pacquet fetch initializes State from --dir’s package.json directory and derives
lockfile_path from that manifest, so in a pnpm workspace it can look for pnpm-lock.yaml in a
package subdirectory instead of the workspace root and fail with NoLockfile despite a root
lockfile existing. It also keys lockfile-verification caching/recording on the passed
lockfile_path, so using a subdir path in a workspace can prevent the cache shortcut from ever
hitting and record verification under the wrong path.
Code

pacquet/crates/cli/src/cli_args/fetch.rs[R26-38]

+        let lockfile_path = manifest
+            .path()
+            .parent()
+            .map(|parent| parent.join(pacquet_lockfile::Lockfile::FILE_NAME));
+
+        Install {
+            tarball_mem_cache: std::sync::Arc::clone(tarball_mem_cache),
+            http_client,
+            http_client_arc: std::sync::Arc::clone(http_client),
+            config,
+            manifest,
+            lockfile: pacquet_lockfile::MaybeLazyLockfile::Lazy(lockfile),
+            lockfile_path: lockfile_path.as_deref(),
Evidence
The CLI state initialization loads the wanted lockfile from the manifest’s parent directory, but the
installer defines the workspace root as the lockfileDir for workspaces and uses that root to
derive/write the lockfile and to key lockfile-verification caching. Because fetch reuses
State::init and derives lockfile_path from manifest.path().parent(), it can point at a package
subdir instead of the workspace root in a monorepo, causing missing-lockfile failures and defeating
verification cache reuse.

pacquet/crates/cli/src/state.rs[59-73]
pacquet/crates/lockfile/src/lazy_lockfile.rs[19-58]
pacquet/crates/cli/src/cli_args/fetch.rs[16-42]
pacquet/crates/package-manager/src/install.rs[551-566]
pacquet/crates/package-manager/src/install.rs[857-860]
pacquet/crates/package-manager/src/install.rs[1426-1440]
pacquet/crates/config/src/lib.rs[985-992]

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

## Issue description
`pacquet fetch` currently derives the lockfile directory/path from the manifest directory (the CLI `--dir`), but the installer treats the workspace root (nearest ancestor `pnpm-workspace.yaml`) as the lockfileDir. In a workspace, running `pacquet fetch` from a package subdirectory (or using `--dir packages/a`) can therefore miss the real root `pnpm-lock.yaml` and fail, and it can defeat the lockfile-verification stat cache by keying it on the wrong path.
## Issue Context
- `State::init` wires `LazyLockfile` to load from `<manifest_parent>/pnpm-lock.yaml`.
- The installer itself finds `workspace_root` and treats it as the lockfileDir.
- Lockfile verification caching/recording is keyed on `derived_lockfile_path`, which is sourced from the caller-provided `lockfile_path` when `Some`.
## Fix Focus Areas
- pacquet/crates/cli/src/cli_args.rs[294-339]
- pacquet/crates/cli/src/cli_args.rs[530-540]
- pacquet/crates/cli/src/cli_args/fetch.rs[26-38]
### Suggested approach (keep it minimal for this PR)
- In the `CliCommand::Fetch` dispatch, compute a fetch-root directory as `config.workspace_dir.clone().unwrap_or_else(|| dir.clone())`, and initialize `State` using `<fetch_root>/package.json` (so `State::init`’s `LazyLockfile::deferred(parent)` points at the workspace root).
- Ensure `FetchArgs::run` uses the same root for `lockfile_path` (this may become automatic if `manifest` is the workspace-root manifest).
This makes `pacquet fetch` behave correctly when invoked from a workspace subdirectory and keeps lockfile-verification caching keyed to the real workspace lockfile path.

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


2. Fetch ignores trustLockfile 🐞 Bug ➹ Performance
Description
FetchArgs::run hard-codes trust_lockfile=false, so pacquet fetch always runs the lockfile
supply-chain verification fan-out even when config sets trustLockfile=true to skip it. This can
add substantial registry I/O and memory and can reintroduce the CI OOM scenario trust_lockfile was
added to avoid.
Code

pacquet/crates/cli/src/cli_args/fetch.rs[R43-48]

+            frozen_lockfile: true,
+            prefer_frozen_lockfile: None,
+            ignore_manifest_check: true,
+            skip_runtimes: false,
+            trust_lockfile: false,
+            update_checksums: false,
Evidence
Fetch hard-codes trust_lockfile: false, while the install pipeline uses trust_lockfile as the
gate to skip building/running resolution verifiers; config docs explicitly call out OOM risk and the
purpose of trust_lockfile to avoid it.

pacquet/crates/cli/src/cli_args/fetch.rs[43-48]
pacquet/crates/package-manager/src/install.rs[793-835]
pacquet/crates/config/src/lib.rs[1321-1337]

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

## Issue description
`pacquet fetch` currently forces `trust_lockfile: false`, which ignores `config.trust_lockfile` (the documented escape hatch to skip verifier fan-out for large lockfiles / memory-constrained CI). This makes fetch slower and can cause memory blowups on large workspaces.
### Issue Context
- `Config::trust_lockfile` is explicitly documented as an opt-out to avoid OOM on multi-thousand-entry workspaces.
- `Install` uses `trust_lockfile` to decide whether to build/run resolution verifiers.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/fetch.rs[31-59]
### Suggested fix
Set `trust_lockfile` based on configuration (and/or add a `--trust-lockfile` flag for fetch and OR it with config, matching install semantics). For example:
- `trust_lockfile: config.trust_lockfile` (or `config.trust_lockfile || trust_lockfile_flag`)

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


3. Fetch runs build scripts 🐞 Bug ⛨ Security
Description
FetchArgs::run calls the normal Install pipeline, which (on the frozen-lockfile path) runs
BuildModules and thus executes dependency lifecycle scripts and re-links bins, so pacquet fetch
is not a fetch-only operation and can execute attacker-controlled package scripts. This is both a
security risk (RCE via dependency scripts) and a performance regression versus pnpm’s
virtualStoreOnly fetch semantics.
Code

pacquet/crates/cli/src/cli_args/fetch.rs[R31-63]

+        Install {
+            tarball_mem_cache: std::sync::Arc::clone(tarball_mem_cache),
+            http_client,
+            http_client_arc: std::sync::Arc::clone(http_client),
+            config,
+            manifest,
+            lockfile: pacquet_lockfile::MaybeLazyLockfile::Lazy(lockfile),
+            lockfile_path: lockfile_path.as_deref(),
+            dependency_groups: std::iter::empty()
+                .chain(include_prod.then_some(DependencyGroup::Prod))
+                .chain(include_dev.then_some(DependencyGroup::Dev))
+                .chain(Some(DependencyGroup::Optional)),
+            frozen_lockfile: true,
+            prefer_frozen_lockfile: None,
+            ignore_manifest_check: true,
+            skip_runtimes: false,
+            trust_lockfile: false,
+            update_checksums: false,
+            is_full_install: false,
+            resolved_packages,
+            supported_architectures: config.supported_architectures.clone(),
+            node_linker: config.node_linker,
+            lockfile_only: false,
+            dry_run: false,
+            update_seed_policy: pacquet_package_manager::UpdateSeedPolicy::KeepAll,
+            auth_override: None,
+            resolution_observer: None,
+            catalogs_override: None,
+        }
+        .run::<Reporter>()
+        .await
+        .wrap_err("fetching dependencies")
+    }
Evidence
The new fetch command runs Install::run, and on the frozen-lockfile path pacquet always runs the
build phase that executes dependency lifecycle scripts; is_full_install only gates the *project’s*
lifecycle scripts, not dependency builds.

pacquet/crates/cli/src/cli_args/fetch.rs[16-63]
pacquet/crates/package-manager/src/install_frozen_lockfile.rs[1270-1301]
pacquet/crates/package-manager/src/install_frozen_lockfile.rs[454-488]
pacquet/crates/package-manager/src/install.rs[1637-1654]
pnpm11/installing/commands/src/fetch.ts[74-86]

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

## Issue description
`pacquet fetch` currently dispatches to the full `pacquet_package_manager::Install` frozen-lockfile pipeline, which runs the dependency build phase (`BuildModules`) and performs post-import linking. A fetch command should populate the store/virtual store without executing dependency lifecycle scripts and without doing full node_modules linking.
### Issue Context
- The pnpm reference implementation sets `virtualStoreOnly: true` for `fetch`, explicitly skipping post-import linking.
- In pacquet, the frozen-lockfile path always runs `run_build_phase`, which executes dependency lifecycle scripts via `BuildModules`.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/fetch.rs[16-63]
- pacquet/crates/package-manager/src/install.rs[1600-1660]
- pacquet/crates/package-manager/src/install_frozen_lockfile.rs[1245-1320]
### What to change
- Introduce a dedicated “fetch/virtual-store-only” mode (boolean flag or separate entrypoint) that:
- fetches/extracts packages into the store/virtual store,
- skips `run_build_phase` / `BuildModules` (no lifecycle scripts),
- skips post-import linking work that is not required for fetch (direct dep symlinks, bin linking, hoisting/top-level relinks), matching pnpm’s `virtualStoreOnly` intent.
- Wire `pacquet fetch` to that mode instead of full `Install::run`.

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


View more (2)
4. --dev includes optional deps 🐞 Bug ➹ Performance
Description
FetchArgs::run always includes DependencyGroup::Optional, so pacquet fetch --dev will still
fetch optional dependencies, contradicting pnpm’s fetch --dev semantics (“Only development
packages will be fetched”) and causing extra work. This diverges from the pnpm reference, where
optionalDependencies are only included when production deps are included.
Code

pacquet/crates/cli/src/cli_args/fetch.rs[R39-42]

+            dependency_groups: std::iter::empty()
+                .chain(include_prod.then_some(DependencyGroup::Prod))
+                .chain(include_dev.then_some(DependencyGroup::Dev))
+                .chain(Some(DependencyGroup::Optional)),
Evidence
The Rust implementation unconditionally includes Optional, while pnpm’s fetch sets
optionalDependencies based on production !== false, excluding optional deps when production is
disabled (the --dev case).

pacquet/crates/cli/src/cli_args/fetch.rs[21-43]
pnpm11/installing/commands/src/fetch.ts[22-39]
pnpm11/installing/commands/src/fetch.ts[51-59]

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

## Issue description
`pacquet fetch` always includes `DependencyGroup::Optional`, even when `--dev` is specified. This contradicts pnpm fetch, where optional deps are excluded when production deps are excluded.
### Issue Context
In pnpm’s fetch handler, `optionalDependencies` follows the production flag (optional is false when `--dev` implies production=false).
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/fetch.rs[21-43]
- pnpm11/installing/commands/src/fetch.ts[51-59]
### What to change
- Change the dependency group iterator to only include `Optional` when production deps are included (or otherwise match pnpm’s include rules).
- e.g. replace `.chain(Some(DependencyGroup::Optional))` with `.chain(include_prod.then_some(DependencyGroup::Optional))` (or the exact rule you intend, but keep parity with pnpm fetch).

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


5. Unused import breaks clippy 🐞 Bug ⚙ Maintainability
Description
cli_args/cache.rs imports wax::walk::Entry but never uses it; CI runs clippy with warnings
denied, so this is a build-breaker. This will fail cargo clippy -- -D warnings in the repo’s lint
gate.
Code

pacquet/crates/cli/src/cli_args/cache.rs[11]

+use wax::walk::Entry;
Evidence
The new file imports Entry without referencing it, and the workspace lint configuration explicitly
denies warnings, which includes unused imports.

pacquet/crates/cli/src/cli_args/cache.rs[8-13]
justfile[72-75]

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

## Issue description
`use wax::walk::Entry;` is unused, and the repo’s clippy gate denies warnings, so this is a hard CI failure.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/cache.rs[8-13]
- justfile[72-75]
### What to change
- Delete the unused import (or use it if it was intended).
- Re-run `cargo clippy --all-targets --workspace -- -D warnings`.

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



Remediation recommended

6. Fetch store assert too weak 🐞 Bug ⚙ Maintainability
Description
fetch_succeeds_with_lockfile only asserts that /v11 exists after pacquet fetch, but other
commands (notably install --lockfile-only) can create store scaffolding (including an empty
v11/index.db) without fetching package content. This test can therefore pass even if fetch
regresses to a no-op with respect to actual store population.
Code

pacquet/crates/cli/tests/fetch.rs[R55-58]

+    assert!(
+        store_dir.join("v11").exists(),
+        "fetch must populate the store",
+    );
Evidence
The new test’s assertion (/v11 exists) is not a reliable indicator of fetched content because the
test suite documents that --lockfile-only can create store scaffolding (including an empty
v11/index.db) without downloading tarballs; therefore v11/ may exist even when nothing was
fetched.

pacquet/crates/cli/tests/fetch.rs[50-58]
pacquet/crates/cli/tests/lockfile_only.rs[26-29]

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 `fetch_succeeds_with_lockfile` integration test currently treats the existence of `<store>/v11` as proof that `pacquet fetch` populated the store. However, the store directory and even an empty index DB can be created without fetching package content (e.g. by `install --lockfile-only`), so the assertion does not actually validate fetch’s behavior.
### Issue Context
The repo already has utilities to inspect store contents (e.g. reading `<store>/v11/index.db`) and other tests explicitly avoid counting scaffolding as “fetched content”.
### Fix Focus Areas
- pacquet/crates/cli/tests/fetch.rs[35-60]
### What to change
- Capture store state before running `fetch` (after `install --lockfile-only`).
- After `fetch`, assert evidence of real package content, e.g.:
- Use `pacquet/crates/cli/tests/_utils.rs::index_file_contents(store_dir)` and assert it becomes non-empty or grows.
- And/or assert that CAS blobs exist under `v11/files/...` (similar to `cas_blobs()` logic in `pacquet/crates/cli/tests/lockfile_only.rs`).
- Keep the assertion focused on “package content fetched”, not mere directory existence.

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


7. Fetch materializes node_modules 🐞 Bug ➹ Performance
Description
FetchArgs::run invokes pacquet_package_manager::Install with lockfile_only=false and
dry_run=false, so the install pipeline is allowed to perform materialization work instead of
limiting itself to fetching/extracting into the store. On the frozen-lockfile path, the installer
explicitly imports packages into node_modules/... and creates symlinks under node_modules/, so
pacquet fetch can unexpectedly mutate project directories.
Code

pacquet/crates/cli/src/cli_args/fetch.rs[R31-55]

+        Install {
+            tarball_mem_cache: std::sync::Arc::clone(tarball_mem_cache),
+            http_client,
+            http_client_arc: std::sync::Arc::clone(http_client),
+            config,
+            manifest,
+            lockfile: pacquet_lockfile::MaybeLazyLockfile::Lazy(lockfile),
+            lockfile_path: lockfile_path.as_deref(),
+            dependency_groups: std::iter::empty()
+                .chain(include_prod.then_some(DependencyGroup::Prod))
+                .chain(include_dev.then_some(DependencyGroup::Dev))
+                .chain(Some(DependencyGroup::Optional)),
+            frozen_lockfile: true,
+            prefer_frozen_lockfile: None,
+            ignore_manifest_check: true,
+            skip_runtimes: false,
+            trust_lockfile: false,
+            update_checksums: false,
+            is_full_install: false,
+            resolved_packages,
+            supported_architectures: config.supported_architectures.clone(),
+            node_linker: config.node_linker,
+            lockfile_only: false,
+            dry_run: false,
+            update_seed_policy: pacquet_package_manager::UpdateSeedPolicy::KeepAll,
Evidence
FetchArgs::run explicitly sets lockfile_only: false and dry_run: false, which makes
resolve_only = lockfile_only || dry_run false in Install::run, so materialization is not
suppressed. The frozen-lockfile installer’s own documentation states it imports into
node_modules/... and creates node_modules/ symlinks, meaning fetch can mutate project
directories when routed through that path.

pacquet/crates/cli/src/cli_args/fetch.rs[16-59]
pacquet/crates/package-manager/src/install.rs[519-523]
pacquet/crates/package-manager/src/install_frozen_lockfile.rs[46-54]

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

## Issue description
`pacquet fetch` is intended to prefetch packages into the store/virtual-store without doing a full project materialization. However, `FetchArgs::run` currently calls the normal `Install` pipeline with `lockfile_only=false` and `dry_run=false`, which allows node_modules-related materialization steps to run on the frozen-lockfile path.
## Issue Context
The frozen-lockfile installer’s documented behavior includes importing into `node_modules/.pacquet/...` and creating `node_modules/<name>` symlinks. That is more invasive (and slower) than a fetch-only command.
## Fix approach
- Introduce an explicit “fetch/store-only” mode in the package-manager layer (e.g., a boolean on `Install` / `InstallFrozenLockfile`) that:
- fetches tarballs and extracts into the store
- updates store index as needed
- skips `node_modules` linking, `.modules.yaml` writes, current-lockfile writes, and workspace-state writes
- Wire `pacquet fetch` to enable that mode.
- Alternatively (if you already have a lower-level component that only does store population), call that directly from `FetchArgs::run` instead of `Install`.
## Fix Focus Areas
- pacquet/crates/cli/src/cli_args/fetch.rs[31-55]
- pacquet/crates/package-manager/src/install.rs[519-523]
- pacquet/crates/package-manager/src/install_frozen_lockfile.rs[46-54]

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


8. Fetch scans workspace always 🐞 Bug ➹ Performance
Description
FetchArgs::run routes pacquet fetch through pacquet_package_manager::Install, which always
performs workspace discovery and walks workspace project manifests. This adds install-like
filesystem overhead to a command whose contract is store-prefetch, and can significantly slow CI
prefetch in large workspaces.
Code

pacquet/crates/cli/src/cli_args/fetch.rs[R31-63]

+        Install {
+            tarball_mem_cache: std::sync::Arc::clone(tarball_mem_cache),
+            http_client,
+            http_client_arc: std::sync::Arc::clone(http_client),
+            config,
+            manifest,
+            lockfile: pacquet_lockfile::MaybeLazyLockfile::Lazy(lockfile),
+            lockfile_path: lockfile_path.as_deref(),
+            dependency_groups: std::iter::empty()
+                .chain(include_prod.then_some(DependencyGroup::Prod))
+                .chain(include_dev.then_some(DependencyGroup::Dev))
+                .chain(Some(DependencyGroup::Optional)),
+            frozen_lockfile: true,
+            prefer_frozen_lockfile: None,
+            ignore_manifest_check: true,
+            skip_runtimes: false,
+            trust_lockfile: false,
+            update_checksums: false,
+            is_full_install: false,
+            resolved_packages,
+            supported_architectures: config.supported_architectures.clone(),
+            node_linker: config.node_linker,
+            lockfile_only: false,
+            dry_run: false,
+            update_seed_policy: pacquet_package_manager::UpdateSeedPolicy::KeepAll,
+            auth_override: None,
+            resolution_observer: None,
+            catalogs_override: None,
+        }
+        .run::<Reporter>()
+        .await
+        .wrap_err("fetching dependencies")
+    }
Evidence
Fetch constructs and runs Install; Install::run_inner always computes workspace_root and calls
load_workspace_projects, which causes the workspace scan overhead regardless of fetch semantics.

pacquet/crates/cli/src/cli_args/fetch.rs[31-63]
pacquet/crates/package-manager/src/install.rs[561-610]

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

## Issue description
`pacquet fetch` currently calls the full `Install` pipeline, which unconditionally performs workspace discovery (`find_workspace_dir`) and scans workspace projects (`load_workspace_projects`). For a fetch-only operation this introduces avoidable filesystem work that scales with workspace size.
### Issue Context
The new fetch command is intended to prefetch from the lockfile into the store. The install pipeline’s workspace prelude is useful for a full install, but is expensive and not obviously needed for store-only prefetch.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/fetch.rs[31-63]
- pacquet/crates/package-manager/src/install.rs[561-610]
### Suggested direction
Introduce a fetch-specific pipeline (or an `Install` mode/flag) that bypasses workspace discovery + workspace project walking when the operation only needs the wanted lockfile’s package set and store writes.

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


View more (6)
9. Large stack lint disabled 🐞 Bug ⚙ Maintainability
Description
CliArgs::run now blanket-suppresses clippy::large_stack_frames, removing a guardrail that
previously forced boxing/refactors when the CLI dispatch future grows. This makes it easier for
future command additions to increase dispatch-frame size without detection, despite the file already
treating this lint as meaningful elsewhere.
Code

pacquet/crates/cli/src/cli_args.rs[R254-257]

+    #[allow(
+        clippy::large_stack_frames,
+        reason = "the run function dispatches all CLI commands and contains large types like Install on the stack"
+    )]
Evidence
The diff adds a whole-function #[allow(clippy::large_stack_frames)] on CliArgs::run, while the
same file explicitly boxes install futures to avoid this lint, indicating it is intended as an
active constraint in this codebase.

pacquet/crates/cli/src/cli_args.rs[249-258]
pacquet/crates/cli/src/cli_args.rs[440-451]

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

## Issue description
`CliArgs::run` globally allows `clippy::large_stack_frames`, which weakens an existing guardrail meant to keep the CLI dispatch future small.
### Issue Context
This file already boxes specific futures to satisfy the same lint, so suppressing it at the whole-function level makes it harder to notice future growth/regressions in the dispatch frame.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args.rs[254-257]
- pacquet/crates/cli/src/cli_args.rs[442-445]
### Suggested fix directions
- Prefer removing the function-level `#[allow(clippy::large_stack_frames)]`.
- If the lint is firing due to the match/dispatch shape, move the command match into a helper that returns a boxed future (or box the large variants) so the top-level `run()` future stays small.
- If suppression is truly required, narrow it to the minimal scope/construct that triggers the lint rather than the entire function.

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


10. Fetch skips config deps 🐞 Bug ➹ Performance
Description
FetchArgs::run directly runs the Install pipeline but does not run the configDependencies
install + updateConfig hook steps that the install command executes first, so pacquet fetch
can leave configDependency artifacts unfetched and diverge from later pacquet install behavior
(notably in offline/CI workflows). This reduces fetch’s effectiveness as a prefetch step because
subsequent installs may still need network/store work for configDependencies.
Code

pacquet/crates/cli/src/cli_args/fetch.rs[R31-63]

+        Install {
+            tarball_mem_cache: std::sync::Arc::clone(tarball_mem_cache),
+            http_client,
+            http_client_arc: std::sync::Arc::clone(http_client),
+            config,
+            manifest,
+            lockfile: pacquet_lockfile::MaybeLazyLockfile::Lazy(lockfile),
+            lockfile_path: lockfile_path.as_deref(),
+            dependency_groups: std::iter::empty()
+                .chain(include_prod.then_some(DependencyGroup::Prod))
+                .chain(include_dev.then_some(DependencyGroup::Dev))
+                .chain(Some(DependencyGroup::Optional)),
+            frozen_lockfile: true,
+            prefer_frozen_lockfile: None,
+            ignore_manifest_check: true,
+            skip_runtimes: false,
+            trust_lockfile: false,
+            update_checksums: false,
+            is_full_install: false,
+            resolved_packages,
+            supported_architectures: config.supported_architectures.clone(),
+            node_linker: config.node_linker,
+            lockfile_only: false,
+            dry_run: false,
+            update_seed_policy: pacquet_package_manager::UpdateSeedPolicy::KeepAll,
+            auth_override: None,
+            resolution_observer: None,
+            catalogs_override: None,
+        }
+        .run::<Reporter>()
+        .await
+        .wrap_err("fetching dependencies")
+    }
Evidence
pacquet install explicitly installs configDependencies and runs updateConfig hooks before
initializing State and proceeding, but pacquet fetch does not run these steps and instead
immediately runs Install, so configDependency artifacts may not be prefetched by fetch.

pacquet/crates/cli/src/cli_args.rs[544-585]
pacquet/crates/cli/src/config_deps.rs[36-52]
pacquet/crates/cli/src/cli_args/fetch.rs[16-63]

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

## Issue description
`pacquet fetch` currently constructs and runs `pacquet_package_manager::Install` directly from an already-initialized `State`. Unlike `pacquet install`, it does not first materialize `configDependencies` nor run `updateConfig` hooks, which can cause fetch to miss prefetching packages needed for a later install (and cause behavioral divergence).
### Issue Context
`pacquet install` runs a pre-install pipeline step that (a) resolves/installs `configDependencies` and (b) runs `updateConfig` hooks before initializing `State` and executing the main `Install`.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/fetch.rs[16-63]
- pacquet/crates/cli/src/cli_args.rs[544-585]
- pacquet/crates/cli/src/config_deps.rs[36-52]
### Proposed fix
- Refactor the fetch dispatch to mirror the `InstallPipeline` shape:
- Load a mutable config (`&'static mut Config`) like `install` does.
- Determine `config_root` (workspace root) the same way `install` does.
- Call `config_deps::install_config_deps::<Reporter>(cfg, &config_root, /*frozen*/ true).await?`.
- Call `config_deps::run_update_config_hooks::<Reporter>(cfg, &config_root).await?`.
- Then call `State::init(...)` and execute the fetch’s `Install { ... }.run::<Reporter>().await`.
- Add an integration test where `pnpm-workspace.yaml` declares `configDependencies` and verify `pacquet fetch` causes those packages to be present in the store / no extra network is needed when running a subsequent offline install.

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


11. Fetch trusts lockfile URLs 🐞 Bug ⛨ Security
Description
FetchArgs::run hard-sets Install::ignore_manifest_check=true, bypassing the manifest↔lockfile
freshness gate and treating a stale/attacker-controlled pnpm-lock.yaml as authoritative. Because
tarball URLs are taken directly from lockfile resolutions and fetched over HTTP, running `pacquet
fetch` on untrusted repositories can trigger outbound requests to attacker-chosen hosts (SSRF-style
internal access / outbound download DoS).
Code

pacquet/crates/cli/src/cli_args/fetch.rs[R43-47]

+            frozen_lockfile: true,
+            prefer_frozen_lockfile: None,
+            ignore_manifest_check: true,
+            skip_runtimes: false,
+            trust_lockfile: false,
Evidence
The new fetch command explicitly bypasses the freshness check, and the install pipeline later uses
tarball URLs from lockfile resolutions as direct HTTP request targets, which means the bypass makes
untrusted lockfile contents sufficient to cause outbound requests.

pacquet/crates/cli/src/cli_args/fetch.rs[31-59]
pacquet/crates/package-manager/src/install.rs[1720-1741]
pacquet/crates/package-manager/src/install_package_by_snapshot.rs[589-613]
pacquet/crates/tarball/src/lib.rs[1517-1555]

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

## Issue description
`pacquet fetch` currently sets `ignore_manifest_check: true`, which disables the manifest↔lockfile freshness gate. This makes the lockfile alone sufficient to drive which tarball URLs are fetched, which is risky when `fetch` is run in automation on untrusted repos/PRs.
### Issue Context
The install pipeline uses lockfile resolutions (including arbitrary tarball URLs) for downloads; skipping the freshness gate removes the primary check that the lockfile corresponds to the current project intent.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/fetch.rs[31-59]
### Suggested fix
- Set `ignore_manifest_check: false` for `fetch` by default.
- If parity requires bypassing the gate in some workflows, add an explicit `--ignore-manifest-check` flag to `fetch` (default false) and thread it into `Install::ignore_manifest_check`.
- Consider additionally failing when the lockfile is out of date (unless the explicit bypass flag is provided), to keep `fetch` from acting on unrelated lockfiles.

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


12. Fetch ignores skipRuntimes 🐞 Bug ➹ Performance
Description
FetchArgs::run hard-codes skip_runtimes=false, so pacquet fetch will not honor
config.skip_runtimes (and has no CLI equivalent of install’s --no-runtime). This causes
unnecessary runtime archive fetch/materialization work for CI setups that intentionally
pre-provision runtimes.
Code

pacquet/crates/cli/src/cli_args/fetch.rs[R45-47]

+            ignore_manifest_check: true,
+            skip_runtimes: false,
+            trust_lockfile: false,
Evidence
Fetch hard-codes skip_runtimes: false even though config defines skip_runtimes and install
explicitly merges config + CLI to compute the effective value.

pacquet/crates/cli/src/cli_args/fetch.rs[45-47]
pacquet/crates/config/src/lib.rs[588-599]
pacquet/crates/cli/src/cli_args/install.rs[399-410]

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

## Issue description
`pacquet fetch` currently forces `skip_runtimes: false`, ignoring `Config::skip_runtimes`. This can cause extra large downloads and work even when the user has explicitly configured runtimes to be skipped.
### Issue Context
`Config::skip_runtimes` is the canonical knob to skip runtime dependencies, and `install` computes `skip_runtimes = config.skip_runtimes || --no-runtime`.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/fetch.rs[43-52]
### Suggested fix
Set `skip_runtimes` from configuration, e.g.:
- `skip_runtimes: config.skip_runtimes`
Optionally add a fetch CLI flag (`--no-runtime`) and merge like install does.

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


13. Fetch writes package.json 🐞 Bug ☼ Reliability
Description
The fetch command dispatch initializes State, and State::init always calls
PackageManifest::create_if_needed, which writes a new package.json when one is missing. This
gives pacquet fetch an unexpected filesystem write side effect in directories that only have a
lockfile (or in automation that expects fetch to be store-only).
Code

pacquet/crates/cli/src/cli_args.rs[R510-519]

+            CliCommand::Fetch(args) => match reporter {
+                ReporterType::Default | ReporterType::AppendOnly => {
+                    Box::pin(args.run::<DefaultReporter>(state(true)?)).await?;
+                }
+                ReporterType::Ndjson => {
+                    Box::pin(args.run::<NdjsonReporter>(state(true)?)).await?;
+                }
+                ReporterType::Silent => {
+                    Box::pin(args.run::<SilentReporter>(state(true)?)).await?;
+                }
Evidence
Fetch dispatch uses State::init (via state(true)?), and State::init always loads the manifest
using create_if_needed, which writes a new manifest when absent via fs::write.

pacquet/crates/cli/src/cli_args.rs[510-519]
pacquet/crates/cli/src/state.rs[59-79]
pacquet/crates/package-manifest/src/lib.rs[87-96]
pacquet/crates/package-manifest/src/lib.rs[125-132]

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

## Issue description
`pacquet fetch` currently goes through `State::init`, which auto-creates `package.json` if it doesn’t exist. For a fetch-only command, this is an unexpected write and can mutate working trees/CI workspaces.
### Issue Context
- `State::init` unconditionally uses `PackageManifest::create_if_needed`.
- `create_if_needed` writes the default manifest via `fs::write` when `package.json` is missing.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args.rs[510-519]
- pacquet/crates/cli/src/state.rs[59-79]
### Suggested fix
Introduce a fetch-specific state/manifest load that requires an existing manifest (e.g., use `PackageManifest::from_path` and return a clear error if missing), or add an option to `State::init` to avoid creating a manifest for read-only commands, and use that for `fetch`.

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


14. Cache wildcards bad registry 🐞 Bug ⛨ Security
Description
CacheCommand uses "*" as the registry directory prefix when config.registry is invalid, which
broadens list/view/delete globs to all registries under the local cache dir. Because config is
loaded with overlays from repo-controlled .npmrc/workspace config, an untrusted repo can cause
cache operations to target unrelated registries (local cache DoS via unintended deletion).
Code

pacquet/crates/cli/src/cli_args/cache.rs[R45-47]

+        let registry_prefix =
+            get_registry_name(&config.registry).unwrap_or_else(|_| "*".to_string());
+
Evidence
The cache command expands globs using a registry prefix derived from config.registry and falls
back to * on error; config is explicitly layered from .npmrc/workspace yaml, so this behavior
can be influenced by repo-provided config.

pacquet/crates/cli/src/cli_args/cache.rs[40-63]
pacquet/crates/cli/src/cli_args/cache.rs[107-126]
pacquet/crates/cli/src/state.rs[25-37]

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

## Issue description
When `get_registry_name(&config.registry)` fails, cache commands fall back to `"*"`, unintentionally expanding glob scope to all registries.
### Issue Context
Config is layered from `.npmrc` / workspace yaml, which per the repo security model is attacker-controlled in untrusted repos. A malicious repo can set an invalid registry value so `pacquet cache delete <pattern>` deletes cache entries across all registries.
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/cache.rs[40-63]
- pacquet/crates/cli/src/cli_args/cache.rs[107-131]
- pacquet/crates/cli/src/state.rs[25-37]
### What to change
- Remove the `"*"` fallback on registry parse failure.
- Instead, return an actionable error (preferred for `delete`/`view`), or require an explicit `--all-registries` flag to opt into wildcard behavior.
- Ensure `list`/`delete`/`view` all share the same safe registry-prefix behavior.

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



Informational

15. Stale lockfile comment 🐞 Bug ⚙ Maintainability
Description
The require_lockfile comment above the state(require_lockfile) helper claims only `install
--frozen-lockfile needs require_lockfile=true, but this PR adds fetch` dispatching through
state(true), making the comment misleading for future changes.
Code

pacquet/crates/cli/src/cli_args.rs[R530-539]

+            CliCommand::Fetch(args) => match reporter {
+                ReporterType::Default | ReporterType::AppendOnly => {
+                    Box::pin(args.run::<DefaultReporter>(state(true)?)).await?;
+                }
+                ReporterType::Ndjson => {
+                    Box::pin(args.run::<NdjsonReporter>(state(true)?)).await?;
+                }
+                ReporterType::Silent => {
+                    Box::pin(args.run::<SilentReporter>(state(true)?)).await?;
+                }
Evidence
The comment states only install --frozen-lockfile needs require_lockfile=true, but the new
fetch command arm clearly calls state(true) (requiring a lockfile).

pacquet/crates/cli/src/cli_args.rs[328-334]
pacquet/crates/cli/src/cli_args.rs[530-539]

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

## Issue description
A comment in `CliArgs::run` documents `require_lockfile` as only needed by `install --frozen-lockfile`, but the new `fetch` command also calls `state(true)`. This is documentation drift introduced by the PR and can cause incorrect assumptions during future command additions/refactors.
### Issue Context
`fetch` now requires a lockfile-loaded `State` even if `config.lockfile=false`, so the comment should either mention `fetch` explicitly or be generalized (e.g., “install --frozen-lockfile and other subcommands that must run with a lockfile”).
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args.rs[328-334]

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


16. Misleading no-lockfile error 🐞 Bug ◔ Observability
Description
pacquet fetch routes through the generic Install pipeline, so a missing lockfile surfaces
InstallError::NoLockfile, whose message is specific to “Headless installation” and instructs users
to run pacquet install, which is misleading for the fetch subcommand and complicates
troubleshooting.
Code

pacquet/crates/cli/src/cli_args/fetch.rs[R31-63]

+        Install {
+            tarball_mem_cache: std::sync::Arc::clone(tarball_mem_cache),
+            http_client,
+            http_client_arc: std::sync::Arc::clone(http_client),
+            config,
+            manifest,
+            lockfile: pacquet_lockfile::MaybeLazyLockfile::Lazy(lockfile),
+            lockfile_path: lockfile_path.as_deref(),
+            dependency_groups: std::iter::empty()
+                .chain(include_prod.then_some(DependencyGroup::Prod))
+                .chain(include_dev.then_some(DependencyGroup::Dev))
+                .chain(Some(DependencyGroup::Optional)),
+            frozen_lockfile: true,
+            prefer_frozen_lockfile: None,
+            ignore_manifest_check: true,
+            skip_runtimes: false,
+            trust_lockfile: false,
+            update_checksums: false,
+            is_full_install: false,
+            resolved_packages,
+            supported_architectures: config.supported_architectures.clone(),
+            node_linker: config.node_linker,
+            lockfile_only: false,
+            dry_run: false,
+            update_seed_policy: pacquet_package_manager::UpdateSeedPolicy::KeepAll,
+            auth_override: None,
+            resolution_observer: None,
+            catalogs_override: None,
+        }
+        .run::<Reporter>()
+        .await
+        .wrap_err("fetching dependencies")
+    }
Evidence
The fetch command directly calls Install::run and therefore inherits its NoLockfile diagnostic,
which is explicitly worded for the install workflow rather than the fetch subcommand.

pacquet/crates/cli/src/cli_args/fetch.rs[17-63]
pacquet/crates/package-manager/src/install.rs[249-256]

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

## Issue description
`pacquet fetch` currently inherits the install-oriented `InstallError::NoLockfile` diagnostic. When users run `pacquet fetch` without `pnpm-lock.yaml`, the error text talks about “Headless installation” and suggests `pacquet install`, instead of clearly stating that `fetch` requires an existing lockfile.
### Issue Context
This happens because `FetchArgs::run` constructs `pacquet_package_manager::Install` directly and forwards its errors unchanged (only adding a generic `wrap_err("fetching dependencies")`).
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/fetch.rs[17-63]
### Suggested fix
In `FetchArgs::run`, intercept the error returned by `Install::run` and, when it is `InstallError::NoLockfile`, return a fetch-specific diagnostic (e.g., “`pacquet fetch` requires an existing pnpm-lock.yaml; run `pacquet install --lockfile-only` (or `pacquet install`) to generate one.”). Keep other errors wrapped as today.
(Alternative: make `InstallError::NoLockfile` text command-agnostic and add command-specific help at the CLI layer, but the minimal fix is to map the error in `fetch.rs`.)

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


17. Fetch bypasses fast-path 🐞 Bug ➹ Performance
Description
pacquet fetch hard-codes is_full_install: false, which disables the optimistic repeat-install
short-circuit in Install::run_inner. As a result, repeated pacquet fetch runs will always
execute the full install prelude (including workspace scans) even when nothing has changed and the
store is already warm.
Code

pacquet/crates/cli/src/cli_args/fetch.rs[R49-50]

+            is_full_install: false,
+            resolved_packages,
Evidence
Fetch sets is_full_install=false; the installer only evaluates the optimistic up-to-date decision
when is_full_install is true, so fetch can never short-circuit.

pacquet/crates/cli/src/cli_args/fetch.rs[43-55]
pacquet/crates/package-manager/src/install.rs[641-654]

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 install pipeline’s optimistic repeat-install fast path is gated on `is_full_install`. Fetch sets `is_full_install=false`, so it can never take the fast path and will repeat setup work on every invocation.
### Issue Context
`is_full_install` also gates project lifecycle scripts, so fetch likely set it to `false` intentionally. However, using it as the fast-path gate couples two concerns (script policy vs. up-to-date detection).
### Fix Focus Areas
- pacquet/crates/cli/src/cli_args/fetch.rs[43-55]
- pacquet/crates/package-manager/src/install.rs[641-654]
### Suggested direction
Split the gating: add a separate flag (e.g. `allow_optimistic_fast_path`) or a fetch-specific early-exit condition that does not require `is_full_install=true` (so fetch can skip repeated workspace/setup work without enabling project scripts).

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


Grey Divider

<img src="https://www.qodo.ai/wp-content/uploads/2025/03/qodo-logo.svg" ...

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

qodo-free-for-open-source-projects Bot commented Jun 22, 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

@kairosci
kairosci force-pushed the feat/pacquet-fetch branch from d446c9c to 612528c Compare June 22, 2026 15:20

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

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

Inline comments:
In `@pacquet/crates/cli/src/cli_args/cache.rs`:
- Around line 113-124: Instead of silently ignoring removal failures with `let
_` on the fs::remove_file calls within the meta_files loop, properly handle and
propagate errors according to the code style guide. When removing files at
file_path and the related meta files in the alternate meta directories, capture
the Result from each fs::remove_file call and either return the error or collect
failures to report alongside successes, so that the deletion status accurately
reflects whether the operations succeeded or failed rather than unconditionally
reporting entries as deleted.
- Around line 180-185: The contains_key method call on the store_index is using
unwrap_or(false) which silently converts any error into a false result,
effectively masking store access failures as cache misses instead of propagating
them. Remove the unwrap_or(false) and replace it with proper error handling
using either the ? operator to propagate the error, or by explicitly handling
the Result according to pacquet's error diagnostics patterns, ensuring that
operational errors from store-index operations are not silently suppressed.

In `@pacquet/crates/cli/tests/cache.rs`:
- Around line 6-83: The test file currently contains only cache-related
integration tests (should_list_registries, should_list_packages,
should_delete_packages) but lacks coverage for the newly introduced fetch
command functionality. Add new integration test functions that exercise the
fetch command end-to-end, including cases for lockfile-required behavior and
dependency-group filtering with --prod and --dev flags. These tests should
interact with CliCommand::Fetch to ensure the fetch functionality is properly
regression tested alongside the existing cache tests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a9a0fcb-cfbc-469f-b2c6-26c59da932a1

📥 Commits

Reviewing files that changed from the base of the PR and between 85d9e77 and d446c9c.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !Cargo.lock
📒 Files selected for processing (7)
  • pacquet/crates/cli/Cargo.toml
  • pacquet/crates/cli/src/cli_args.rs
  • pacquet/crates/cli/src/cli_args/cache.rs
  • pacquet/crates/cli/src/cli_args/fetch.rs
  • pacquet/crates/cli/tests/cache.rs
  • pacquet/crates/resolving-npm-resolver/src/lib.rs
  • pacquet/crates/resolving-npm-resolver/src/mirror.rs

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 3

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

Inline comments:
In `@pacquet/crates/cli/src/cli_args/cache.rs`:
- Around line 113-124: Instead of silently ignoring removal failures with `let
_` on the fs::remove_file calls within the meta_files loop, properly handle and
propagate errors according to the code style guide. When removing files at
file_path and the related meta files in the alternate meta directories, capture
the Result from each fs::remove_file call and either return the error or collect
failures to report alongside successes, so that the deletion status accurately
reflects whether the operations succeeded or failed rather than unconditionally
reporting entries as deleted.
- Around line 180-185: The contains_key method call on the store_index is using
unwrap_or(false) which silently converts any error into a false result,
effectively masking store access failures as cache misses instead of propagating
them. Remove the unwrap_or(false) and replace it with proper error handling
using either the ? operator to propagate the error, or by explicitly handling
the Result according to pacquet's error diagnostics patterns, ensuring that
operational errors from store-index operations are not silently suppressed.

In `@pacquet/crates/cli/tests/cache.rs`:
- Around line 6-83: The test file currently contains only cache-related
integration tests (should_list_registries, should_list_packages,
should_delete_packages) but lacks coverage for the newly introduced fetch
command functionality. Add new integration test functions that exercise the
fetch command end-to-end, including cases for lockfile-required behavior and
dependency-group filtering with --prod and --dev flags. These tests should
interact with CliCommand::Fetch to ensure the fetch functionality is properly
regression tested alongside the existing cache tests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9a9a0fcb-cfbc-469f-b2c6-26c59da932a1

📥 Commits

Reviewing files that changed from the base of the PR and between 85d9e77 and d446c9c.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !Cargo.lock
📒 Files selected for processing (7)
  • pacquet/crates/cli/Cargo.toml
  • pacquet/crates/cli/src/cli_args.rs
  • pacquet/crates/cli/src/cli_args/cache.rs
  • pacquet/crates/cli/src/cli_args/fetch.rs
  • pacquet/crates/cli/tests/cache.rs
  • pacquet/crates/resolving-npm-resolver/src/lib.rs
  • pacquet/crates/resolving-npm-resolver/src/mirror.rs
🛑 Comments failed to post (3)
pacquet/crates/cli/src/cli_args/cache.rs (2)

113-124: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Propagate deletion failures instead of reporting success.

Line 115 and Lines 122-123 ignore remove_file errors, but Lines 128-130 still print those entries as deleted. That can silently misreport failed deletes.

💡 Suggested fix
                 for meta_file in &meta_files {
                     let file_path = cache_dir.join(meta_file);
-                    let _ = fs::remove_file(&file_path);
+                    if let Err(error) = fs::remove_file(&file_path) {
+                        if error.kind() != std::io::ErrorKind::NotFound {
+                            return Err(error).into_diagnostic();
+                        }
+                    }

                     if let Ok(rel_path) = file_path.strip_prefix(&cache_dir) {
                         for meta_dir in
                             [ABBREVIATED_META_DIR, FULL_META_DIR, FULL_FILTERED_META_DIR]
                         {
                             if meta_dir != selected_meta_dir {
-                                let _ =
-                                    fs::remove_file(config.cache_dir.join(meta_dir).join(rel_path));
+                                let alt_path = config.cache_dir.join(meta_dir).join(rel_path);
+                                if let Err(error) = fs::remove_file(&alt_path) {
+                                    if error.kind() != std::io::ErrorKind::NotFound {
+                                        return Err(error).into_diagnostic();
+                                    }
+                                }
                             }
                         }
                     }
                 }

As per coding guidelines, pacquet/CODE_STYLE_GUIDE.md requires propagating errors in new fetch/cache code paths rather than swallowing them.

Also applies to: 128-130

🤖 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/cache.rs` around lines 113 - 124, Instead of
silently ignoring removal failures with `let _` on the fs::remove_file calls
within the meta_files loop, properly handle and propagate errors according to
the code style guide. When removing files at file_path and the related meta
files in the alternate meta directories, capture the Result from each
fs::remove_file call and either return the error or collect failures to report
alongside successes, so that the deletion status accurately reflects whether the
operations succeeded or failed rather than unconditionally reporting entries as
deleted.

Source: Coding guidelines


180-185: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Do not downgrade store-index read errors to cache misses.

Line 184 uses unwrap_or(false), so any contains_key error is silently reported as “not cached”, which can misclassify versions.

💡 Suggested fix
-                        if store_index.contains_key(&key).unwrap_or(false) {
+                        if store_index.contains_key(&key).into_diagnostic()? {
                             cached_versions.push(version.clone());
                         } else {
                             non_cached_versions.push(version.clone());
                         }

As per coding guidelines, pacquet/CODE_STYLE_GUIDE.md asks fetch/cache paths to propagate operational errors via existing diagnostics instead of masking them.

🤖 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/cache.rs` around lines 180 - 185, The
contains_key method call on the store_index is using unwrap_or(false) which
silently converts any error into a false result, effectively masking store
access failures as cache misses instead of propagating them. Remove the
unwrap_or(false) and replace it with proper error handling using either the ?
operator to propagate the error, or by explicitly handling the Result according
to pacquet's error diagnostics patterns, ensuring that operational errors from
store-index operations are not silently suppressed.

Source: Coding guidelines

pacquet/crates/cli/tests/cache.rs (1)

6-83: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add fetch regression coverage (or explicitly prove existing coverage executes fetch).

The newly introduced fetch command path is not covered by the added tests (these are cache-only). Please add fetch-focused integration cases for lockfile-required behavior and --prod/--dev dependency-group filtering, or link existing tests that hit CliCommand::Fetch end-to-end.

As per coding guidelines, REVIEW_GUIDE.md requires meaningful fetch regression coverage and says not to accept “no new tests” unless the current suite demonstrably exercises fetch.

🤖 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/cache.rs` around lines 6 - 83, The test file
currently contains only cache-related integration tests (should_list_registries,
should_list_packages, should_delete_packages) but lacks coverage for the newly
introduced fetch command functionality. Add new integration test functions that
exercise the fetch command end-to-end, including cases for lockfile-required
behavior and dependency-group filtering with --prod and --dev flags. These tests
should interact with CliCommand::Fetch to ensure the fetch functionality is
properly regression tested alongside the existing cache tests.

Source: Coding guidelines

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 612528c

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 612528c

@kairosci
kairosci force-pushed the feat/pacquet-fetch branch from 612528c to 82b58ac Compare June 22, 2026 16:40

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

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

Inline comments:
In `@pacquet/crates/cli/tests/fetch.rs`:
- Around line 25-30: The fetch tests in the file are currently checking only
exit status and do not validate the documented contract of the fetch command.
Enhance the test around the "fetch without lockfile" assertion to verify that
the error output specifically contains a lockfile-related failure message (not
just that the command fails). Additionally, add separate test cases that verify
fetch command semantics: one testing that `fetch --prod` only fetches production
dependencies but still includes optional dependencies, and another testing that
`fetch --dev` only fetches development dependencies but still includes optional
dependencies. Use assertions on the command output or side effects to prove the
concrete filtering behavior, rather than just validating exit status.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ff01518b-3706-4adf-9bfb-a7089b216313

📥 Commits

Reviewing files that changed from the base of the PR and between d446c9c and 82b58ac.

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

Comment thread pacquet/crates/cli/tests/fetch.rs Resolved
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 82b58ac

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 82b58ac

@codecov-commenter

codecov-commenter commented Jun 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.69%. Comparing base (54c5c0e) to head (9e7a3e4).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12588      +/-   ##
==========================================
+ Coverage   88.58%   88.69%   +0.10%     
==========================================
  Files         339      341       +2     
  Lines       49171    50136     +965     
==========================================
+ Hits        43557    44466     +909     
- Misses       5614     5670      +56     

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

@github-actions

github-actions Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 9e7a3e49fd15

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.810 ± 0.199 4.660 5.250 1.59 ± 0.09
pacquet@main 4.656 ± 0.141 4.492 4.928 1.54 ± 0.08
pnpr@HEAD 3.023 ± 0.125 2.901 3.356 1.00
pnpr@main 3.117 ± 0.148 2.971 3.390 1.03 ± 0.06
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.809586855040001,
      "stddev": 0.19928838440900631,
      "median": 4.7280736364400004,
      "user": 3.87212714,
      "system": 3.5521377999999997,
      "min": 4.65968833894,
      "max": 5.25045009294,
      "times": [
        5.25045009294,
        4.66160810294,
        4.70980294094,
        4.89846977594,
        5.0439370419400005,
        4.665017449940001,
        4.7463443319400005,
        4.66524654194,
        4.7953039329400005,
        4.65968833894
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.65601282904,
      "stddev": 0.1405541516865656,
      "median": 4.61295684844,
      "user": 3.8077876399999995,
      "system": 3.5370571999999996,
      "min": 4.49152510594,
      "max": 4.92769579294,
      "times": [
        4.59594458494,
        4.87405907694,
        4.92769579294,
        4.6334932789400005,
        4.59631764194,
        4.68916193794,
        4.526017173940001,
        4.61418316694,
        4.49152510594,
        4.61173052994
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.0228706167400006,
      "stddev": 0.12496569807068847,
      "median": 2.9856391009400003,
      "user": 2.7765666399999995,
      "system": 3.1182890999999997,
      "min": 2.90113371794,
      "max": 3.35638316594,
      "times": [
        2.90113371794,
        2.9867397559400004,
        3.01901527094,
        2.96031335394,
        2.96511740194,
        3.35638316594,
        3.07083267894,
        2.98453844594,
        2.9802470219400004,
        3.00438535394
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.11724964854,
      "stddev": 0.14778402361109697,
      "median": 3.0334858429400002,
      "user": 2.7675648399999995,
      "system": 3.1424285999999997,
      "min": 2.9712874139400003,
      "max": 3.38990622794,
      "times": [
        3.03651652494,
        3.21864898994,
        3.2688450379400003,
        3.38990622794,
        3.24210836994,
        3.0304551609400003,
        3.00330314794,
        3.0142546389400002,
        2.9712874139400003,
        2.9971709729400002
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 683.7 ± 10.4 668.8 700.9 1.00
pacquet@main 704.8 ± 31.0 667.3 780.2 1.03 ± 0.05
pnpr@HEAD 761.4 ± 64.8 714.4 933.4 1.11 ± 0.10
pnpr@main 752.2 ± 16.3 728.9 781.6 1.10 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.68372166262,
      "stddev": 0.010419099675284068,
      "median": 0.68456155042,
      "user": 0.41326436,
      "system": 1.3669416399999998,
      "min": 0.66876915342,
      "max": 0.70085562642,
      "times": [
        0.67459815942,
        0.70085562642,
        0.67781455942,
        0.66876915342,
        0.69264011542,
        0.69481243842,
        0.67227760642,
        0.6844329314200001,
        0.68632586642,
        0.68469016942
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.7047947592200001,
      "stddev": 0.031046460257886148,
      "median": 0.7006213694200001,
      "user": 0.42565796,
      "system": 1.3836935399999999,
      "min": 0.66730151042,
      "max": 0.78016573442,
      "times": [
        0.69986744042,
        0.72735747642,
        0.68540459542,
        0.70576228242,
        0.68285440042,
        0.66730151042,
        0.78016573442,
        0.7065540944200001,
        0.70137529842,
        0.69130475942
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.76144602962,
      "stddev": 0.06482046740639197,
      "median": 0.73964484442,
      "user": 0.44533616,
      "system": 1.4049987399999997,
      "min": 0.71444070042,
      "max": 0.93344844942,
      "times": [
        0.7948135644200001,
        0.71444070042,
        0.76180235842,
        0.73113893742,
        0.73709453542,
        0.73046924242,
        0.75208749042,
        0.71696986442,
        0.93344844942,
        0.74219515342
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.75224671582,
      "stddev": 0.016254246056042605,
      "median": 0.75446642042,
      "user": 0.44271695999999994,
      "system": 1.42209414,
      "min": 0.72893607842,
      "max": 0.78156389742,
      "times": [
        0.73651324142,
        0.75995993342,
        0.78156389742,
        0.76467656342,
        0.73505602642,
        0.72893607842,
        0.74332283742,
        0.76350573942,
        0.75536347942,
        0.75356936142
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 5.028 ± 0.041 4.955 5.099 1.49 ± 0.04
pacquet@main 4.979 ± 0.049 4.912 5.060 1.48 ± 0.04
pnpr@HEAD 3.372 ± 0.093 3.268 3.520 1.00
pnpr@main 3.381 ± 0.069 3.260 3.492 1.00 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 5.027861483080001,
      "stddev": 0.041424145090647485,
      "median": 5.02562452608,
      "user": 3.9884457799999993,
      "system": 3.5134641199999996,
      "min": 4.954768201079999,
      "max": 5.09877834808,
      "times": [
        5.04708189608,
        5.02045360908,
        5.09877834808,
        5.018442589079999,
        4.954768201079999,
        5.0613447980799995,
        5.018498614079999,
        5.03079544308,
        4.97569310008,
        5.0527582320799995
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.97875676578,
      "stddev": 0.04856752263302355,
      "median": 4.972212818579999,
      "user": 3.9842779799999994,
      "system": 3.49431302,
      "min": 4.912165895079999,
      "max": 5.059745909079999,
      "times": [
        4.94579767608,
        5.006087745079999,
        4.92239133908,
        4.912165895079999,
        4.95082062908,
        5.036482727079999,
        5.00965010008,
        5.059745909079999,
        4.97823563408,
        4.9661900030799995
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.3716548649800004,
      "stddev": 0.09320682223595282,
      "median": 3.32939430408,
      "user": 2.8846053799999996,
      "system": 3.30852042,
      "min": 3.26803265308,
      "max": 3.5196771410800003,
      "times": [
        3.50080656708,
        3.32513222808,
        3.30893235408,
        3.26827492008,
        3.5196771410800003,
        3.4341449920800002,
        3.43647044308,
        3.3214209710800002,
        3.3336563800800003,
        3.26803265308
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.38095667068,
      "stddev": 0.06865547324563391,
      "median": 3.3697027465800002,
      "user": 2.90637608,
      "system": 3.3048372200000005,
      "min": 3.26042392308,
      "max": 3.49190496408,
      "times": [
        3.35848162508,
        3.41270026908,
        3.35992487308,
        3.3794806200800003,
        3.42222486108,
        3.49190496408,
        3.31735855908,
        3.46209966408,
        3.34496734808,
        3.26042392308
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.426 ± 0.017 1.390 1.449 1.00
pacquet@main 1.450 ± 0.085 1.413 1.689 1.02 ± 0.06
pnpr@HEAD 1.504 ± 0.031 1.469 1.559 1.05 ± 0.02
pnpr@main 1.491 ± 0.031 1.455 1.571 1.05 ± 0.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.4257510633,
      "stddev": 0.01705936995791644,
      "median": 1.4261599142,
      "user": 1.4135469400000003,
      "system": 1.7247357799999996,
      "min": 1.3903228572,
      "max": 1.4489954232000002,
      "times": [
        1.4162295892,
        1.4259178932,
        1.4211871522000001,
        1.4459056972,
        1.4135542992,
        1.4358794262,
        1.3903228572,
        1.4264019352000001,
        1.4331163602,
        1.4489954232000002
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.4502894119000003,
      "stddev": 0.08471332092462294,
      "median": 1.4198255507000002,
      "user": 1.43425934,
      "system": 1.7236204799999997,
      "min": 1.4127675832000002,
      "max": 1.6887705152,
      "times": [
        1.4246748442000001,
        1.6887705152,
        1.4529905522,
        1.4158336092000001,
        1.4133687912000001,
        1.4216639572,
        1.4178463402,
        1.4127675832000002,
        1.4179871442,
        1.4369907822
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5035781184,
      "stddev": 0.030609546286626068,
      "median": 1.4982293967000002,
      "user": 0.62286924,
      "system": 1.6462999799999998,
      "min": 1.4686845182000001,
      "max": 1.5585962232000001,
      "times": [
        1.5411769542000002,
        1.5037454302000002,
        1.5585962232000001,
        1.4767499612000001,
        1.4927133632,
        1.5306431022000002,
        1.4778267002,
        1.5052609812,
        1.4803839502,
        1.4686845182000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.4914852974000001,
      "stddev": 0.0312825876230705,
      "median": 1.4849382247,
      "user": 0.6488204399999999,
      "system": 1.5917638799999998,
      "min": 1.4550358962,
      "max": 1.5707894312,
      "times": [
        1.4893361622,
        1.5112308862000001,
        1.5707894312,
        1.4882240592,
        1.4816523902,
        1.4734119812000002,
        1.4792952862,
        1.4771708302000002,
        1.4550358962,
        1.4887060512
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.147 ± 0.027 3.120 3.193 2.13 ± 0.04
pacquet@main 3.172 ± 0.057 3.114 3.298 2.14 ± 0.05
pnpr@HEAD 1.480 ± 0.025 1.454 1.524 1.00
pnpr@main 1.493 ± 0.076 1.445 1.701 1.01 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.146567813,
      "stddev": 0.027446726537973042,
      "median": 3.1422510339,
      "user": 1.84923776,
      "system": 2.0450827,
      "min": 3.1195941844,
      "max": 3.1930645523999996,
      "times": [
        3.1283765444,
        3.1574935733999996,
        3.1212541723999996,
        3.1417553004,
        3.1427467674,
        3.1478908224,
        3.1924750264,
        3.1195941844,
        3.1930645523999996,
        3.1210271863999997
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.1723988989999996,
      "stddev": 0.05679745703299382,
      "median": 3.1511960824,
      "user": 1.9367164600000002,
      "system": 1.9987382999999999,
      "min": 3.1137835594,
      "max": 3.2978111273999997,
      "times": [
        3.1563425144,
        3.1137835594,
        3.1372813604,
        3.1394682013999997,
        3.1357846063999997,
        3.1460496503999997,
        3.1778615003999997,
        3.2978111273999997,
        3.1749377994,
        3.2446686704
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4797795603000001,
      "stddev": 0.024752012464091682,
      "median": 1.4718017748999999,
      "user": 0.61145556,
      "system": 1.6059224,
      "min": 1.4540899864,
      "max": 1.5241260824,
      "times": [
        1.5241260824,
        1.5103315674,
        1.5038727224,
        1.4594088084,
        1.4807483364,
        1.4644581984,
        1.4596808594,
        1.4540899864,
        1.4619336904,
        1.4791453514
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.4926236791,
      "stddev": 0.0759463710282812,
      "median": 1.4677749919,
      "user": 0.63558966,
      "system": 1.5711336,
      "min": 1.4453113224,
      "max": 1.7007307214,
      "times": [
        1.7007307214,
        1.4829951724000001,
        1.5194938524,
        1.4620719504000002,
        1.4709606024000002,
        1.4702429114,
        1.4554860794,
        1.4453113224,
        1.4653070724000001,
        1.4536371064
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12588
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
5,027.86 ms
(+5.12%)Baseline: 4,782.99 ms
5,739.59 ms
(87.60%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
3,146.57 ms
(+3.64%)Baseline: 3,035.97 ms
3,643.17 ms
(86.37%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
1,425.75 ms
(+5.95%)Baseline: 1,345.69 ms
1,614.82 ms
(88.29%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
4,809.59 ms
(+2.36%)Baseline: 4,698.68 ms
5,638.42 ms
(85.30%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
683.72 ms
(+8.98%)Baseline: 627.39 ms
752.86 ms
(90.82%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12588
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
3,371.65 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
1,479.78 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
1,503.58 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
3,022.87 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
761.45 ms
🐰 View full continuous benchmarking report in Bencher

@kairosci
kairosci force-pushed the feat/pacquet-fetch branch from 82b58ac to 8b9c70e Compare June 23, 2026 10:28
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 8b9c70e

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 8b9c70e

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

Copy link
Copy Markdown

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

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

Copy link
Copy Markdown

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

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

Copy link
Copy Markdown

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

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

Copy link
Copy Markdown

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

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 3662fc2

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 3662fc2

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

Copy link
Copy Markdown

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

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

Copy link
Copy Markdown

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

kairosci and others added 7 commits June 25, 2026 10:06
Address review feedback on the fetch command:

- Optional dependencies now follow production, matching pnpm's fetch
  (`optionalDependencies: opts.production !== false`), so `pacquet fetch
  --dev` no longer pulls optional deps.
- Honor `config.trustLockfile` and `config.skipRuntimes` instead of
  hardcoding them off, mirroring `pacquet install` (fetch exposes no CLI
  override for either).
- Set the new `disable_optimistic_repeat_install` Install field
  introduced on main, so fetch compiles after the rebase.

Strengthen the integration tests to prove the contract rather than exit
status: the no-lockfile path asserts a lockfile-specific error, and new
cases verify `--prod` keeps optional/drops dev and `--dev` drops both
production and optional.

Written by an agent (Claude Code, claude-opus-4-8).
@zkochan
zkochan force-pushed the feat/pacquet-fetch branch from a7b797f to 9e7a3e4 Compare June 25, 2026 08:28
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 9e7a3e4

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

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 9e7a3e4

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Jun 25, 2026
@zkochan
zkochan added this pull request to the merge queue Jun 25, 2026
Merged via the queue into pnpm:main with commit a06591e Jun 25, 2026
39 checks passed
@kairosci
kairosci deleted the feat/pacquet-fetch branch June 25, 2026 12:21
KSXGitHub pushed a commit that referenced this pull request Jun 25, 2026
Bring the latest `main` (20 commits) into the pack port branch. The
notable incoming changes for this branch:

- #12644 (`test(git-fetcher): cover bundleDependencies closure
  depth cap`) added `bundle_dependencies_closure_stops_past_max_depth`
  to `git-fetcher/src/packlist/tests.rs`. This branch had already
  relocated that file to the standalone `fs-packlist` crate, so the
  change is a modify-vs-rename: git's rename detection carried the new
  test into `fs-packlist/src/tests.rs`, where it compiles and passes
  (the `MAX_BUNDLE_DEPTH` guard it covers lives there). fs-packlist now
  has 26 tests.
- New pacquet CLI commands landed on `main` — audit (#12637,
  #12653), global (#12638), link (#12589),
  fetch (#12588), and list. Their dispatch arms auto-merged
  into `cli_args.rs` alongside this branch's `Pack` arm; the cli crate
  compiles with all of them.

All four textual overlaps (`Cargo.toml`, `Cargo.lock`,
`cli/Cargo.toml`, `cli_args.rs`) auto-merged with no conflict markers.
The merged tree passes `cargo check --workspace --all-targets`; pack
(23), exportable-manifest (28), fs-packlist (26), and git-fetcher (61)
test suites all pass. No documentation in this PR went stale: `main`
did not touch `cli/README.md` or the pack / exportable-manifest /
fs-packlist crates.
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 state: automerge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants