Skip to content

feat(pacquet): complete git dependency parity - #13169

Merged
zkochan merged 9 commits into
mainfrom
git-deps
Jul 20, 2026
Merged

zkochan merged 9 commits into
mainfrom
git-deps

Conversation

@zkochan

@zkochan zkochan commented Jul 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Completes the Git-hosted dependencies section of #13167 for pacquet.

  • supports alias-less Git shorthand and URL adds by resolving the repository package name before manifest mutation
  • reuses unchanged Git lockfile resolutions and reports package manifest versions in root logs
  • adds per-run pnpr fixture substitutions and ports the remaining Git-hosted regression suites

The TypeScript CLI already implements these behaviors; this PR brings pacquet to parity. The two large-repository performance benchmarks remain intentionally out of scope per the tracker.

Squash Commit Body

Resolve alias-less Git selectors before updating the project manifest so pacquet can use the fetched package name. Reuse unchanged Git entries from the wanted lockfile to keep moving refs pinned during unrelated changes, and source direct-dependency log versions from lockfile package metadata.

Add per-run pnpr fixture substitutions for registry packages with local Git dependencies and port the remaining Git-hosted install, build, peer, partial-commit, and prepare-failure coverage.

Related to pnpm/pnpm#13167

Checklist

  • The change is implemented in both the TypeScript CLI and the Rust
    pnpm/ port, or the description notes what still needs porting.
  • Added a changeset (pnpm changeset) if this PR changes any published
    package. Keep it short and written for pnpm users — it becomes a release note.
  • Added or updated tests.
  • Updated the documentation if needed.

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


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features
    • Added support for adding Git dependencies without specifying an alias.
  • Bug Fixes
    • Git-hosted dependency preparation failures are now surfaced.
    • Invalid Git commit values are rejected before any fetching begins.
    • Preserves already-locked Git commits when unrelated dependencies change.
    • Improves pnpm:root event output for Git resolutions, including more accurate version reporting.
  • Chores / Tests
    • Expanded and improved end-to-end and unit test coverage for Git-hosted installs.

Copilot AI review requested due to automatic review settings July 20, 2026 11:05

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

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Git-hosted dependency parity is expanded across aliasless adds, lockfile reuse, install version reporting, fetcher error handling, fixture registries, Git command construction, and end-to-end coverage.

Changes

Git-hosted dependency parity

Layer / File(s) Summary
Aliasless Git add resolution
pnpm/crates/package-manager/...
Aliasless Git selectors are resolved through GitResolver, with package-name extraction, normalized specifiers, new errors, and updated configuration lifetimes.
Git lockfile reuse and install metadata
pnpm/crates/resolving-deps-resolver/..., pnpm/crates/package-manager/...
Equivalent Git resolutions reuse locked metadata, synthesized results retain Git versions, and install events report manifest versions.
Git fetcher validation and prepare failures
pnpm/crates/git-fetcher/..., pnpm/plans/TEST_PORTING.md
Tests cover partial-commit rejection and propagation of failed prepare scripts; corresponding porting records are updated.
Git command construction
pnpm/crates/resolving-git-resolver/...
Probe and resolution paths share git ls-remote argument construction with explicit repository argument separation.
Substituted registry fixture storage
pnpr/crates/pnpr-fixtures/..., pnpm/crates/testing-utils/...
Fixture manifests and tarballs support per-run substitutions, with registries using explicit storage paths.
Git-hosted integration coverage
pnpm/crates/cli/tests/git_hosted_install.rs, .changeset/git-hosted-dependency-parity.md
Integration tests cover Git URL adds, prepare reinstalls, locked commits, peers, updates, linker modes, and the release note records the resulting behaviors.

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

Sequence Diagram(s)

sequenceDiagram
  participant AddWorkflow
  participant GitResolver
  participant LockfileReuse
  participant SymlinkDirectDependencies
  AddWorkflow->>GitResolver: resolve aliasless Git dependency
  GitResolver-->>AddWorkflow: return package name and normalized specifier
  AddWorkflow->>LockfileReuse: reuse equivalent locked Git resolution
  LockfileReuse-->>SymlinkDirectDependencies: provide package metadata
  SymlinkDirectDependencies-->>AddWorkflow: emit installed package version
Loading

Possibly related issues

  • pnpm/pnpm#11633 — Covers the Git-hosted dependency parity work advanced by these resolver, installer, and test changes.
  • pnpm/pnpm#13167 — Tracks the aliasless adds, locked-commit reuse, logging, fixture, and ported-test behaviors implemented here.

Possibly related PRs

  • pnpm/pnpm#13145 — Updates the same Git-hosted test-porting plan with related coverage.
  • pnpm/pnpm#13160 — Adds related Git install, prepare, reinstall, and test coverage.

Suggested labels: product: pacquet, product: pnpr

Suggested reviewers: copilot

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch git-deps

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

pacquet: complete Git dependency parity (alias-less add, lock reuse, log versions)

✨ Enhancement 🧪 Tests 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Resolve alias-less Git add selectors by fetching the repo manifest name before saving.
• Reuse unchanged Git lockfile resolutions and log Git package versions from lockfile metadata.
• Add per-run registry fixture substitutions and port remaining Git-hosted regression suites.
Diagram

graph TD
  CLI["pacquet CLI"] --> PM["package-manager (add/install)"] --> Reuse["lockfile reuse"] --> Lock[("pnpm-lock.yaml packages")]
  PM --> GitRes["git resolver/fetcher"] --> Remote["git remote / local repo"]
  PM --> Linker["symlink direct deps"] --> Logs["pnpm:root added logs"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Derive name from URL path only (no fetch)
  • ➕ Avoids network/git operations during add for hosted URLs
  • ➕ Simpler error surface (no Git resolution needed to save manifest)
  • ➖ Incorrect when package name differs from repo/project name (common case)
  • ➖ Still doesn’t address cases where normalized save spec differs from input
2. Defer alias-less Git naming until install (manifest stores placeholder)
  • ➕ Keeps add fast and side-effect free; name resolved during install where fetch already happens
  • ➖ Leaves the project manifest in an invalid/placeholder state
  • ➖ Breaks expectations that pnpm add immediately records a correct dependency entry
3. Broader lockfile reuse heuristic for all non-semver resolutions
  • ➕ Could reduce network work beyond Git (tarballs, directories)
  • ➖ Higher correctness risk: lockfile often lacks enough resolver state for safe reuse
  • ➖ Harder to reason about and test; Git is the main parity gap called out here

Recommendation: The PR’s approach (resolve alias-less Git selectors to the fetched manifest name before manifest mutation, and add a targeted Git-aware lockfile reuse path) is the safest way to reach pnpm parity while keeping correctness guarantees. The alternatives either produce incorrect names, leave manifests in a bad state, or expand reuse beyond what the lockfile can safely reproduce.

Files changed (20) +623 / -228

Enhancement (6) +193 / -61
add.rsResolve alias-less Git selectors before updating manifests +82/-8

Resolve alias-less Git selectors before updating manifests

• Detects alias-less Git specifiers and resolves them via GitResolver to obtain the package name and normalized save specifier before manifest mutation. Introduces add-specific errors for Git resolution failures and inability to determine package names; threads a 'static config reference to support the new resolver path.

pnpm/crates/package-manager/src/add.rs

install_frozen_lockfile.rsThread lockfile packages metadata into direct-dep linker +2/-0

Thread lockfile packages metadata into direct-dep linker

• Passes lockfile.packages into symlink_direct_dependencies so root log events can use per-package manifest metadata (not just importer version slots).

pnpm/crates/package-manager/src/install_frozen_lockfile.rs

install_with_fresh_lockfile.rsProvide packages map during fresh-lockfile materialization +1/-0

Provide packages map during fresh-lockfile materialization

• Threads materialization_lockfile.packages into symlink_direct_dependencies for consistent root-log version reporting during installs with a newly generated lockfile.

pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs

symlink_direct_dependencies.rsReport Git package versions from lockfile package metadata +16/-3

Report Git package versions from lockfile package metadata

• Extends SymlinkDirectDependencies to accept an optional lockfile packages map and uses PackageMetadata.version for pnpm:root added events when available. This fixes Git dependencies whose importer version slot is URL-shaped rather than semver.

pnpm/crates/package-manager/src/symlink_direct_dependencies.rs

lockfile_reuse.rsReuse Git resolutions and synthesize Git resolve results from lockfile +59/-41

Reuse Git resolutions and synthesize Git resolve results from lockfile

• Extends reusable_importer_dep to keep Git selectors pinned by reusing the exact locked package key when the specifier is unchanged (or hosted-equivalent). Updates synthesize_reused_result to support Git and git-hosted tarball entries using lockfile package metadata (including manifest version), avoiding registry/git remote lookups.

pnpm/crates/resolving-deps-resolver/src/lockfile_reuse.rs

lib.rsSupport per-run manifest substitutions in fixture storage and tarballs +33/-9

Support per-run manifest substitutions in fixture storage and tarballs

• Adds build_storage_at_with_substitutions and threads substitutions through fixture loading. Ensures substituted package.json content is also embedded into generated tarballs (not just packuments).

pnpr/crates/pnpr-fixtures/src/lib.rs

Refactor (1) +1 / -1
resolve_dependency_tree.rsRoute importer reuse through full lockfile +1/-1

Route importer reuse through full lockfile

• Updates the reuse call site to pass the whole Lockfile into reusable_importer_dep after its signature change (needed for packages metadata checks).

pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs

Tests (7) +372 / -145
git_hosted_install.rsPort remaining Git-hosted install regression coverage +173/-125

Port remaining Git-hosted install regression coverage

• Adds end-to-end tests for alias-less Git add, locked-commit reuse on unrelated adds, peer/alias scenarios via registry fixtures, and reinstall/build behavior (isolated/hoisted). Updates expectations to assert root log versions and removes the previous known-failures stubs.

pnpm/crates/cli/tests/git_hosted_install.rs

tests.rsValidate partial Git commits without invoking git +35/-0

Validate partial Git commits without invoking git

• Adds a test ensuring abbreviated commits are rejected early as InvalidCommit, even if the configured git binary is missing.

pnpm/crates/git-fetcher/src/fetcher/tests.rs

tests.rsSurface prepare script failures for git-hosted tarballs +45/-0

Surface prepare script failures for git-hosted tarballs

• Adds a test that runs a failing prepare script and asserts the error is reported as a lifecycle failure when builds are allowed.

pnpm/crates/git-fetcher/src/tarball_fetcher/tests.rs

tests.rsAdjust add tests for leaked static Config +4/-4

Adjust add tests for leaked static Config

• Updates tests to leak Config via Box::leak to satisfy new &'static Config requirements introduced by alias-less Git resolution.

pnpm/crates/package-manager/src/add/tests.rs

tests.rsUpdate symlink-direct-deps tests for new packages parameter +10/-0

Update symlink-direct-deps tests for new packages parameter

• Adjusts all unit tests to pass packages: None now that SymlinkDirectDependenciesOptions includes optional lockfile package metadata.

pnpm/crates/package-manager/src/symlink_direct_dependencies/tests.rs

tests.rsAdd coverage for Git reuse and synthesized Git results +67/-15

Add coverage for Git reuse and synthesized Git results

• Refactors test fixtures to build full Lockfile objects and adds tests ensuring unchanged Git specifiers reuse locked commits and that synthesized Git ResolveResults carry manifest versions and correct resolved_via/id shape.

pnpm/crates/resolving-deps-resolver/src/lockfile_reuse/tests.rs

tests.rsVerify substitutions apply to both packuments and tarball manifests +38/-1

Verify substitutions apply to both packuments and tarball manifests

• Adds a regression test that builds fixture storage with substitutions and asserts the replaced dependency spec appears in both the generated packument JSON and the tarball’s package/package.json.

pnpr/crates/pnpr-fixtures/src/tests.rs

Documentation (2) +17 / -12
git-hosted-dependency-parity.mdAdd pacquet changeset for Git dependency parity +5/-0

Add pacquet changeset for Git dependency parity

• Adds a release note announcing alias-less Git adds, Git lock reuse, and improved log version reporting for Git dependencies.

.changeset/git-hosted-dependency-parity.md

TEST_PORTING.mdMark Git-hosted parity suites as fully ported +12/-12

Mark Git-hosted parity suites as fully ported

• Updates the porting plan checklist to reflect newly implemented alias-less Git add, locked-commit reuse, registry fixture Git subdeps via substitution, and additional fetcher/tarball failure coverage.

pnpm/plans/TEST_PORTING.md

Other (4) +40 / -9
Cargo.lockAdd tempfile to dependency graph +1/-0

Add tempfile to dependency graph

• Updates the lockfile to include the tempfile crate used by new dev/test code.

Cargo.lock

bin.rsAdd mocked registry helper with per-run fixture substitutions +23/-1

Add mocked registry helper with per-run fixture substitutions

• Introduces add_mocked_registry_with_substitutions to build fixture storage under the test temp root with exact-string replacements, enabling fixtures to reference per-run git+file:// repos.

pnpm/crates/testing-utils/src/bin.rs

registry.rsAllow starting test registry with custom storage directory +13/-8

Allow starting test registry with custom storage directory

• Refactors TestRegistry to store a URL string and adds start_with_storage to spawn a registry backed by a caller-provided fixture storage path.

pnpm/crates/testing-utils/src/registry.rs

Cargo.tomlAdd tempfile dev-dependency for fixtures tests +3/-0

Add tempfile dev-dependency for fixtures tests

• Adds tempfile under dev-dependencies to support new per-run substitution tests.

pnpr/crates/pnpr-fixtures/Cargo.toml

@github-actions

github-actions Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
lockfile/parse_pnpm_lock       1.00     10.5±0.20ms    35.5 MB/sec    1.00     10.5±0.06ms    35.7 MB/sec
packument/parse                1.00     37.8±0.83µs  1752.6 MB/sec    1.00     37.9±0.19µs  1752.3 MB/sec
tarball/download_dependency    1.00      2.8±0.12ms  1535.4 KB/sec    1.00      2.8±0.15ms  1529.7 KB/sec

Copilot AI review requested due to automatic review settings July 20, 2026 11:10

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-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

Copilot AI review requested due to automatic review settings July 20, 2026 11:14

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-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@greptile-apps

greptile-apps Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The change is safe to merge: it adds well-tested git-dependency features with no regressions to the registry or lockfile paths.

All five previously-stubbed known-failure test cases are now replaced by real integration tests that pass. The lock-reuse path is tested with semver and git fixtures. The -- separator addition to ls-remote is a security hardening with unit test coverage. No correctness issues were found across the resolution, manifest mutation, or symlink paths.

No files require special attention.

Reviews (5): Last reviewed commit: "test(pacquet): move git runner tests" | Re-trigger Greptile

Comment thread pnpm/crates/package-manager/src/add.rs Resolved
Copilot AI review requested due to automatic review settings July 20, 2026 11:21

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-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

Copilot AI review requested due to automatic review settings July 20, 2026 11:23

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-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@codecov-commenter

codecov-commenter commented Jul 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.17486% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.50%. Comparing base (b92edcb) to head (957d2f5).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pnpm/crates/resolving-git-resolver/src/runners.rs 85.71% 3 Missing ⚠️
...ates/resolving-deps-resolver/src/lockfile_reuse.rs 94.73% 2 Missing ⚠️
pnpr/crates/pnpr-fixtures/src/lib.rs 92.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13169      +/-   ##
==========================================
+ Coverage   86.44%   86.50%   +0.05%     
==========================================
  Files         508      509       +1     
  Lines       85086    85775     +689     
==========================================
+ Hits        73555    74196     +641     
- Misses      11531    11579      +48     

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

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

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. Git option-argument injection ✓ Resolved 🐞 Bug ⛨ Security ⭐ New
Description
The new alias-less git add path invokes GitResolver for user-controlled git specifiers, and the
git resolver’s ls-remote runner constructs git ls-remote <repo> <ref> without an argument
terminator (--). This allows a crafted committish/ref (e.g. option-shaped, starting with -) to
be interpreted by git as a flag rather than data, changing subprocess behavior on a
repo-controlled install/add path.
Code

pnpm/crates/package-manager/src/add.rs[R629-636]

+    let parsed =
+        pacquet_resolving_parse_wanted_dependency::parse_wanted_dependency(package_selector);
+    let aliasless_git = match (parsed.alias.as_deref(), parsed.bare_specifier.as_deref()) {
+        (None, Some(specifier))
+            if pacquet_resolving_git_resolver::parse_bare_specifier(specifier).is_some() =>
+        {
+            Some(resolve_aliasless_git(specifier, config, http_client_arc).await?)
+        }
Evidence
The PR adds an alias-less git detection path that calls resolve_aliasless_git(), which uses
GitResolver (and thus RealGitRunner) on the user-provided specifier. The git resolver’s runner
builds git ls-remote without --, and git committish/ref strings are sourced from the URL
fragment parsing without guarding against option-shaped values. The repo already documents the need
for -- in git subprocess calls elsewhere (git fetcher) to keep attacker-controlled values out of
git’s option parser, reinforcing that this is a real class of risk.

pnpm/crates/package-manager/src/add.rs[629-636]
pnpm/crates/package-manager/src/add.rs[767-813]
pnpm/crates/resolving-git-resolver/src/parse_bare_specifier.rs[104-113]
pnpm/crates/resolving-git-resolver/src/runners.rs[119-136]
pnpm/crates/git-fetcher/src/fetcher.rs[235-243]

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

## Issue description
Alias-less git adds now route user input through `GitResolver`, which shells out to `git ls-remote`. The current runner builds `git ls-remote <repo> <ref> <ref^{}>` without `--`, so option-shaped refs/committishes can be parsed as git flags (argument injection), violating the repo security rule to never pass attacker-controlled values as executable flags.

## Issue Context
- The alias-less git add path is new and calls `resolve_aliasless_git()` when the argument is a bare git specifier.
- Git committish/ref values come from URL fragments and are not validated to avoid option-shaped strings.

## Fix Focus Areas
- pnpm/crates/package-manager/src/add.rs[629-636]
- pnpm/crates/resolving-git-resolver/src/runners.rs[55-66]
- pnpm/crates/resolving-git-resolver/src/runners.rs[119-136]
- pnpm/crates/resolving-git-resolver/src/parse_bare_specifier.rs[104-113]

### Concrete fix
1) In `RealGitRunner::run_ls_remote_blocking`, insert `--` before the repo argument:
  - Build argv as: `git ls-remote -- <repo> <ref> <ref^{}>`
2) In `RealGitProbe::ls_remote_exit_code`, also add `--` before `<repo>`:
  - `git ls-remote --exit-code -- <repo> HEAD`
3) (Optional hardening) Reject refs containing whitespace/newlines early (before spawning git), or ensure they’re always passed after `--`.
4) Add a regression test that a `#--help`/option-shaped committish does not alter execution (or is rejected) and is treated as data, not a flag.

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


2. Unvalidated git package name ✓ Resolved 🐞 Bug ≡ Correctness
Description
resolve_aliasless_git() uses the fetched repo’s package.json name (or hosted project name) as
the dependency key without validating it as a safe/valid dependency alias, so `pacquet add
<git-spec>` can persist an invalid dependency key and then fail later during resolution, leaving the
project manifest modified into a broken state.
Code

pnpm/crates/package-manager/src/add.rs[R791-801]

+    let package_name = result
+        .manifest
+        .as_ref()
+        .and_then(|manifest| manifest.get("name"))
+        .and_then(serde_json::Value::as_str)
+        .map(str::to_string)
+        .or_else(|| HostedGit::from_url(specifier).map(|hosted| hosted.project))
+        .ok_or_else(|| AddError::GitPackageName { specifier: specifier.to_string() })?;
+    let manifest_specifier =
+        result.normalized_bare_specifier.unwrap_or_else(|| normalized_save_specifier(specifier));
+    Ok(AliaslessGitDependency { package_name, manifest_specifier })
Evidence
The new add flow derives and persists a git package name with no validation, but the dependency
resolver rejects invalid aliases, creating a mismatch that can leave the manifest in an
unrecoverable state after add runs.

pnpm/crates/package-manager/src/add.rs[624-802]
pnpm/crates/package-manifest/src/lib.rs[349-379]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[352-359]

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 alias-less git add path derives `package_name` from a fetched git manifest and writes it into the workspace manifest without validating it as a safe dependency alias. The resolver later rejects invalid aliases, so `add` can persist a broken `package.json` and then fail during the follow-up install.

### Issue Context
- `resolve_aliasless_git()` extracts `manifest["name"]` and returns it as `package_name`.
- `PackageManifest::add_dependency()` inserts the dependency key verbatim (no alias validation).
- Dependency resolution rejects invalid dependency aliases up front.

### Fix Focus Areas
- pnpm/crates/package-manager/src/add.rs[762-802]

### Suggested fix
1. Validate the derived `package_name` with the same rule used by the resolver (e.g. `pacquet_resolving_deps_resolver::is_valid_dependency_alias` or the underlying `is_valid_old_npm_package_name`).
2. If invalid, return a dedicated `AddError` (e.g. `InvalidGitPackageName { specifier, name }`) and **do not** mutate the manifest.
3. Add a test that a git repo whose `package.json.name` is invalid causes `pnpm add <git-url>` to fail without changing `package.json`.

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



Remediation recommended

3. Redundant git resolution work 🐞 Bug ➹ Performance ⭐ New
Description
pacquet add <git-specifier> now performs an upfront git resolution/fetch to discover the remote
package name before mutating the manifest, and then immediately runs the normal install pipeline
which will resolve git dependencies again. This can add redundant git ls-remote and
manifest-fetch/checkout work to the add hot path when caches don’t fully cover the second pass.
Code

pnpm/crates/package-manager/src/add.rs[R767-783]

+async fn resolve_aliasless_git(
+    specifier: &str,
+    config: &'static Config,
+    http_client: &Arc<ThrottledClient>,
+) -> Result<AliaslessGitDependency, AddError> {
+    let resolver = GitResolver::new(
+        Arc::new(RealGitProbe::new(Arc::clone(http_client))),
+        Arc::new(RealGitRunner::new()),
+    )
+    .with_fetch_context(GitFetchContext {
+        http_client: Arc::clone(http_client),
+        store_dir: &config.store_dir,
+        store_index_writer: None,
+        auth_headers: Arc::clone(&config.auth_headers),
+        retry_opts: crate::retry_config::retry_opts_from_config(config),
+        git_shallow_hosts: config.git_shallow_hosts.clone(),
+    });
Evidence
resolve_aliasless_git() constructs a GitResolver with a fetch context and calls
Resolver::resolve(), which reads package metadata during resolution. The GitResolver
implementation notes that git deps already require extra fetch work per install because resolution
reads the manifest and the install pass re-fetches for preparation; adding a pre-resolution step for
add increases the chance of redundant work.

pnpm/crates/package-manager/src/add.rs[629-642]
pnpm/crates/package-manager/src/add.rs[767-813]
pnpm/crates/resolving-git-resolver/src/git_resolver.rs[25-47]

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

## Issue description
To support alias-less git adds, `resolve_aliasless_git()` runs a full git resolution (including manifest read) before the manifest is updated. The subsequent `Install` run must still resolve and materialize the dependency, which can repeat `ls-remote` and manifest-fetch/checkout work.

## Issue Context
`GitResolver` explicitly performs fetch/checkout work during resolution to read `package.json` metadata, and the install/fetch phase may re-fetch for preparation/materialization. Adding a pre-resolution step on `add` can therefore introduce additional work beyond the existing git install behavior.

## Fix Focus Areas
- pnpm/crates/package-manager/src/add.rs[629-642]
- pnpm/crates/package-manager/src/add.rs[767-813]
- pnpm/crates/resolving-git-resolver/src/git_resolver.rs[25-47]

### Potential fixes
1) Carry forward the pre-resolved git result into the subsequent install resolution phase via a small per-command resolution cache keyed by the exact wanted specifier (so the install resolver can skip repeating `ls-remote`/manifest-read when it’s the same selector).
2) If plumbing a cache is too invasive, at least avoid repeating work within a single `add` invocation by caching `resolve_aliasless_git(specifier)` results across selectors (in case the same spec is provided more than once).
3) Add tracing around the alias-less path to quantify duplicate git operations so future perf work can be validated (e.g., count `ls-remote` invocations per `add`).

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


4. Test registry never stops 🐞 Bug ☼ Reliability
Description
TestRegistry::start_with_storage() spawns a new registry thread per call but TestRegistry only
stores the URL string (no shutdown/join handle), so substituted-registry tests can leak
threads/listeners and may outlive the temp storage directory created under the test TempDir.
Code

pnpm/crates/testing-utils/src/registry.rs[R10-29]

#[must_use]
pub struct TestRegistry {
-    instance: &'static TestRegistryInstance,
+    url: String,
}

impl TestRegistry {
    pub fn start() -> Self {
-        Self { instance: TestRegistryInstance::get() }
+        Self { url: TestRegistryInstance::get().url.clone() }
+    }
+
+    pub fn start_with_storage(storage: &Path) -> Self {
+        Self { url: TestRegistryInstance::start(storage.to_path_buf()).url }
    }

    #[must_use]
    pub fn url(&self) -> String {
-        self.instance.url.clone()
+        self.url.clone()
    }
}
Evidence
The new start_with_storage path creates per-test registries that are not tied to object lifetime,
while the calling harness intentionally places storage under a TempDir that is dropped at test end.

pnpm/crates/testing-utils/src/registry.rs[10-67]
pnpm/crates/testing-utils/src/bin.rs[61-110]

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

### Issue description
`TestRegistry::start_with_storage()` starts a registry server in a new thread but returns a value that only holds the URL. There is no shutdown signaling or thread join, so each substituted registry can run until process exit and may keep serving from a temp storage directory that gets deleted when the test TempDir is dropped.

### Issue Context
- `CommandTempCwd::add_mocked_registry_with_substitutions()` builds storage under the test TempDir and then calls `start_with_storage()`.
- `TestRegistryInstance::start()` spawns a thread and discards the join handle.

### Fix Focus Areas
- pnpm/crates/testing-utils/src/registry.rs[15-67]
- pnpm/crates/testing-utils/src/bin.rs[61-110]

### Suggested fix
- Make `TestRegistry` own the running server lifecycle:
 - Store a shutdown sender (e.g., `tokio::sync::oneshot::Sender<()>`) and a `JoinHandle<()>` (or thread `JoinHandle`).
 - In `Drop` for `TestRegistry`, signal shutdown and join the thread.
- Alternatively, avoid per-test servers by reusing a singleton registry process and varying storage via request routing, or place substituted storage outside the TempDir so it remains valid for the full process lifetime.

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


5. AddError wraps git error codes 📘 Rule violation ≡ Correctness
Description
pnpm add <git-specifier> failures are now surfaced via new pacquet-specific diagnostic codes
(ERR_PNPM_PACKAGE_MANAGER_ADD_RESOLVE_GIT, ERR_PNPM_PACKAGE_MANAGER_ADD_GIT_PACKAGE_NAME) rather
than the more specific git-layer error codes used by the TypeScript CLI. This risks user-visible
error-code/message divergence between the TS and Rust stacks for git dependency add failures.
Code

pnpm/crates/package-manager/src/add.rs[R128-138]

+    #[display("Failed to resolve git dependency {specifier:?}: {source}")]
+    #[diagnostic(code(ERR_PNPM_PACKAGE_MANAGER_ADD_RESOLVE_GIT))]
+    ResolveGit {
+        specifier: String,
+        #[error(source)]
+        source: pacquet_resolving_resolver_base::ResolveError,
+    },
+
+    #[display("Could not determine the package name of git dependency {specifier:?}")]
+    #[diagnostic(code(ERR_PNPM_PACKAGE_MANAGER_ADD_GIT_PACKAGE_NAME))]
+    GitPackageName { specifier: String },
Evidence
The PR adds new AddError variants with explicit diagnostic codes for git resolution/name-detection
failures in pacquet’s add implementation. In the TypeScript stack, git failures are typically
surfaced with specific PnpmError codes at the git-fetcher/git-resolver layers (e.g.
ERR_PNPM_INVALID_GIT_COMMIT, ERR_PNPM_GIT_CHECKOUT_FAILED, ERR_PNPM_GIT_AMBIGUOUS_REF), so
introducing new higher-level codes in only one stack risks contract divergence.

AGENTS.md: Keep TypeScript pnpm CLI and Rust pacquet CLI Behaviorally In Sync for User-Visible Changes
pnpm/crates/package-manager/src/add.rs[128-138]
pnpm11/fetching/git-fetcher/src/index.ts[29-45]
pnpm11/resolving/git-resolver/src/index.ts[138-147]

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

## Issue description
`AddError` introduces new top-level diagnostic codes for git add failures, which can hide or replace the more specific git-layer error codes that the TypeScript CLI exposes (e.g. `ERR_PNPM_INVALID_GIT_COMMIT`, `ERR_PNPM_GIT_AMBIGUOUS_REF`). This can break parity for user-visible error codes/messages.

## Issue Context
The repo’s parity requirement expects user-visible contracts (including error codes/messages) to stay behaviorally aligned between the TypeScript CLI and Rust pacquet.

## Fix Focus Areas
- pnpm/crates/package-manager/src/add.rs[128-138]

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



Informational

6. Fixtures rebuilt every test 🐞 Bug ➹ Performance
Description
add_mocked_registry_with_substitutions() rebuilds the entire pnpr fixture storage (walk all
fixtures + rebuild tarballs) every time substitutions are used, which can unnecessarily slow the
test suite as more git-hosted tests adopt substitutions.
Code

pnpm/crates/testing-utils/src/bin.rs[R61-87]

+    /// Create a mock registry whose generated fixture manifests have exact
+    /// strings replaced for this test run. The storage lives under the
+    /// command fixture's temp root, so `git+file://` replacements remain
+    /// valid for the registry's lifetime.
+    #[must_use]
+    pub fn add_mocked_registry_with_substitutions(
+        self,
+        substitutions: &[(&str, &str)],
+    ) -> CommandTempCwd<AddMockedRegistry> {
        let store_dir = self.root.path().join("pacquet-store");
        let cache_dir = self.root.path().join("pacquet-cache");
        let npmrc_path = self.workspace.join(".npmrc");
        let npmrc_text = text_block_fnl! {
            "store-dir=../pacquet-store"
            "cache-dir=../pacquet-cache"
        };
-        let mock_instance = TestRegistry::start();
+        let mock_instance = if substitutions.is_empty() {
+            TestRegistry::start()
+        } else {
+            let registry_storage = self.root.path().join("registry-storage");
+            pnpr_fixtures::build_storage_at_with_substitutions(
+                &pnpr_fixtures::packages_dir(),
+                &registry_storage,
+                substitutions,
+            );
+            TestRegistry::start_with_storage(&registry_storage)
+        };
Evidence
The call site rebuilds storage under registry-storage for every substituted test, and the fixture
builder’s implementation performs a full rebuild over all fixtures.

pnpm/crates/testing-utils/src/bin.rs[61-87]
pnpr/crates/pnpr-fixtures/src/lib.rs[54-131]

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

### Issue description
Substitution-based tests rebuild the full registry fixture storage from scratch for each test invocation, which scales poorly as more tests use substitutions.

### Issue Context
`build_storage_at_with_substitutions()` removes the output dir and rebuilds storage by iterating all fixture manifests and building tarballs.

### Fix Focus Areas
- pnpm/crates/testing-utils/src/bin.rs[61-87]
- pnpr/crates/pnpr-fixtures/src/lib.rs[44-131]

### Suggested fix
- Cache built storages keyed by the substitutions set (e.g., hash of pairs) in a process-global temp location, and reuse across tests.
- Or generate a base storage once and apply substitutions only to the impacted packages (only those manifests containing the `from` strings).

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


Grey Divider

Previous review results

Review updated until commit 957d2f5

Results up to commit 0c7ccd6 ⚖️ Balanced


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


Action required
1. Unvalidated git package name ✓ Resolved 🐞 Bug ≡ Correctness
Description
resolve_aliasless_git() uses the fetched repo’s package.json name (or hosted project name) as
the dependency key without validating it as a safe/valid dependency alias, so `pacquet add
<git-spec>` can persist an invalid dependency key and then fail later during resolution, leaving the
project manifest modified into a broken state.
Code

pnpm/crates/package-manager/src/add.rs[R791-801]

+    let package_name = result
+        .manifest
+        .as_ref()
+        .and_then(|manifest| manifest.get("name"))
+        .and_then(serde_json::Value::as_str)
+        .map(str::to_string)
+        .or_else(|| HostedGit::from_url(specifier).map(|hosted| hosted.project))
+        .ok_or_else(|| AddError::GitPackageName { specifier: specifier.to_string() })?;
+    let manifest_specifier =
+        result.normalized_bare_specifier.unwrap_or_else(|| normalized_save_specifier(specifier));
+    Ok(AliaslessGitDependency { package_name, manifest_specifier })
Evidence
The new add flow derives and persists a git package name with no validation, but the dependency
resolver rejects invalid aliases, creating a mismatch that can leave the manifest in an
unrecoverable state after add runs.

pnpm/crates/package-manager/src/add.rs[624-802]
pnpm/crates/package-manifest/src/lib.rs[349-379]
pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs[352-359]

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 alias-less git add path derives `package_name` from a fetched git manifest and writes it into the workspace manifest without validating it as a safe dependency alias. The resolver later rejects invalid aliases, so `add` can persist a broken `package.json` and then fail during the follow-up install.

### Issue Context
- `resolve_aliasless_git()` extracts `manifest["name"]` and returns it as `package_name`.
- `PackageManifest::add_dependency()` inserts the dependency key verbatim (no alias validation).
- Dependency resolution rejects invalid dependency aliases up front.

### Fix Focus Areas
- pnpm/crates/package-manager/src/add.rs[762-802]

### Suggested fix
1. Validate the derived `package_name` with the same rule used by the resolver (e.g. `pacquet_resolving_deps_resolver::is_valid_dependency_alias` or the underlying `is_valid_old_npm_package_name`).
2. If invalid, return a dedicated `AddError` (e.g. `InvalidGitPackageName { specifier, name }`) and **do not** mutate the manifest.
3. Add a test that a git repo whose `package.json.name` is invalid causes `pnpm add <git-url>` to fail without changing `package.json`.

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



Remediation recommended
2. AddError wraps git error codes 📘 Rule violation ≡ Correctness
Description
pnpm add <git-specifier> failures are now surfaced via new pacquet-specific diagnostic codes
(ERR_PNPM_PACKAGE_MANAGER_ADD_RESOLVE_GIT, ERR_PNPM_PACKAGE_MANAGER_ADD_GIT_PACKAGE_NAME) rather
than the more specific git-layer error codes used by the TypeScript CLI. This risks user-visible
error-code/message divergence between the TS and Rust stacks for git dependency add failures.
Code

pnpm/crates/package-manager/src/add.rs[R128-138]

+    #[display("Failed to resolve git dependency {specifier:?}: {source}")]
+    #[diagnostic(code(ERR_PNPM_PACKAGE_MANAGER_ADD_RESOLVE_GIT))]
+    ResolveGit {
+        specifier: String,
+        #[error(source)]
+        source: pacquet_resolving_resolver_base::ResolveError,
+    },
+
+    #[display("Could not determine the package name of git dependency {specifier:?}")]
+    #[diagnostic(code(ERR_PNPM_PACKAGE_MANAGER_ADD_GIT_PACKAGE_NAME))]
+    GitPackageName { specifier: String },
Evidence
The PR adds new AddError variants with explicit diagnostic codes for git resolution/name-detection
failures in pacquet’s add implementation. In the TypeScript stack, git failures are typically
surfaced with specific PnpmError codes at the git-fetcher/git-resolver layers (e.g.
ERR_PNPM_INVALID_GIT_COMMIT, ERR_PNPM_GIT_CHECKOUT_FAILED, ERR_PNPM_GIT_AMBIGUOUS_REF), so
introducing new higher-level codes in only one stack risks contract divergence.

AGENTS.md: Keep TypeScript pnpm CLI and Rust pacquet CLI Behaviorally In Sync for User-Visible Changes
pnpm/crates/package-manager/src/add.rs[128-138]
pnpm11/fetching/git-fetcher/src/index.ts[29-45]
pnpm11/resolving/git-resolver/src/index.ts[138-147]

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

## Issue description
`AddError` introduces new top-level diagnostic codes for git add failures, which can hide or replace the more specific git-layer error codes that the TypeScript CLI exposes (e.g. `ERR_PNPM_INVALID_GIT_COMMIT`, `ERR_PNPM_GIT_AMBIGUOUS_REF`). This can break parity for user-visible error codes/messages.

## Issue Context
The repo’s parity requirement expects user-visible contracts (including error codes/messages) to stay behaviorally aligned between the TypeScript CLI and Rust pacquet.

## Fix Focus Areas
- pnpm/crates/package-manager/src/add.rs[128-138]

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


3. Test registry never stops 🐞 Bug ☼ Reliability
Description
TestRegistry::start_with_storage() spawns a new registry thread per call but TestRegistry only
stores the URL string (no shutdown/join handle), so substituted-registry tests can leak
threads/listeners and may outlive the temp storage directory created under the test TempDir.
Code

pnpm/crates/testing-utils/src/registry.rs[R10-29]

#[must_use]
pub struct TestRegistry {
-    instance: &'static TestRegistryInstance,
+    url: String,
}

impl TestRegistry {
    pub fn start() -> Self {
-        Self { instance: TestRegistryInstance::get() }
+        Self { url: TestRegistryInstance::get().url.clone() }
+    }
+
+    pub fn start_with_storage(storage: &Path) -> Self {
+        Self { url: TestRegistryInstance::start(storage.to_path_buf()).url }
    }

    #[must_use]
    pub fn url(&self) -> String {
-        self.instance.url.clone()
+        self.url.clone()
    }
}
Evidence
The new start_with_storage path creates per-test registries that are not tied to object lifetime,
while the calling harness intentionally places storage under a TempDir that is dropped at test end.

pnpm/crates/testing-utils/src/registry.rs[10-67]
pnpm/crates/testing-utils/src/bin.rs[61-110]

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

### Issue description
`TestRegistry::start_with_storage()` starts a registry server in a new thread but returns a value that only holds the URL. There is no shutdown signaling or thread join, so each substituted registry can run until process exit and may keep serving from a temp storage directory that gets deleted when the test TempDir is dropped.

### Issue Context
- `CommandTempCwd::add_mocked_registry_with_substitutions()` builds storage under the test TempDir and then calls `start_with_storage()`.
- `TestRegistryInstance::start()` spawns a thread and discards the join handle.

### Fix Focus Areas
- pnpm/crates/testing-utils/src/registry.rs[15-67]
- pnpm/crates/testing-utils/src/bin.rs[61-110]

### Suggested fix
- Make `TestRegistry` own the running server lifecycle:
 - Store a shutdown sender (e.g., `tokio::sync::oneshot::Sender<()>`) and a `JoinHandle<()>` (or thread `JoinHandle`).
 - In `Drop` for `TestRegistry`, signal shutdown and join the thread.
- Alternatively, avoid per-test servers by reusing a singleton registry process and varying storage via request routing, or place substituted storage outside the TempDir so it remains valid for the full process lifetime.

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



Informational
4. Fixtures rebuilt every test 🐞 Bug ➹ Performance
Description
add_mocked_registry_with_substitutions() rebuilds the entire pnpr fixture storage (walk all
fixtures + rebuild tarballs) every time substitutions are used, which can unnecessarily slow the
test suite as more git-hosted tests adopt substitutions.
Code

pnpm/crates/testing-utils/src/bin.rs[R61-87]

+    /// Create a mock registry whose generated fixture manifests have exact
+    /// strings replaced for this test run. The storage lives under the
+    /// command fixture's temp root, so `git+file://` replacements remain
+    /// valid for the registry's lifetime.
+    #[must_use]
+    pub fn add_mocked_registry_with_substitutions(
+        self,
+        substitutions: &[(&str, &str)],
+    ) -> CommandTempCwd<AddMockedRegistry> {
        let store_dir = self.root.path().join("pacquet-store");
        let cache_dir = self.root.path().join("pacquet-cache");
        let npmrc_path = self.workspace.join(".npmrc");
        let npmrc_text = text_block_fnl! {
            "store-dir=../pacquet-store"
            "cache-dir=../pacquet-cache"
        };
-        let mock_instance = TestRegistry::start();
+        let mock_instance = if substitutions.is_empty() {
+            TestRegistry::start()
+        } else {
+            let registry_storage = self.root.path().join("registry-storage");
+            pnpr_fixtures::build_storage_at_with_substitutions(
+                &pnpr_fixtures::packages_dir(),
+                &registry_storage,
+                substitutions,
+            );
+            TestRegistry::start_with_storage(&registry_storage)
+        };
Evidence
The call site rebuilds storage under registry-storage for every substituted test, and the fixture
builder’s implementation performs a full rebuild over all fixtures.

pnpm/crates/testing-utils/src/bin.rs[61-87]
pnpr/crates/pnpr-fixtures/src/lib.rs[54-131]

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

### Issue description
Substitution-based tests rebuild the full registry fixture storage from scratch for each test invocation, which scales poorly as more tests use substitutions.

### Issue Context
`build_storage_at_with_substitutions()` removes the output dir and rebuilds storage by iterating all fixture manifests and building tarballs.

### Fix Focus Areas
- pnpm/crates/testing-utils/src/bin.rs[61-87]
- pnpr/crates/pnpr-fixtures/src/lib.rs[44-131]

### Suggested fix
- Cache built storages keyed by the substitutions set (e.g., hash of pairs) in a process-global temp location, and reuse across tests.
- Or generate a base storage once and apply substitutions only to the impacted packages (only those manifests containing the `from` strings).

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


Qodo Logo

Comment thread pnpm/crates/package-manager/src/add.rs Resolved
@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

Copilot AI review requested due to automatic review settings July 20, 2026 11:37

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.

Comment thread pnpm/crates/package-manager/src/add.rs Resolved
@qodo-code-review

Copy link
Copy Markdown

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

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.

Copilot AI review requested due to automatic review settings July 20, 2026 11:55

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-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

Copilot AI review requested due to automatic review settings July 20, 2026 11:59

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-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

Copilot AI review requested due to automatic review settings July 20, 2026 12:07

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-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 957d2f5

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@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)
pnpm/crates/resolving-deps-resolver/src/lockfile_reuse/tests.rs (1)

96-115: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add coverage for the normalized-equivalence and git-hosted-tarball reuse paths.

Both new tests use exact-string-match specifiers and only the LockfileResolution::Git variant, so the git_specifiers_are_equivalent branch in reusable_importer_dep (lockfile_reuse.rs line 108) and the Tarball { git_hosted: Some(true) } arms in both reusable_importer_dep and synthesize_reused_result (lockfile_reuse.rs lines 101-105, 172) remain unexercised — matching the Codecov patch-coverage gap called out in the PR description.

Consider adding:

  • A reuse test where the manifest specifier is a syntactically different but equivalent git form (e.g. shorthand vs. full URL) than the locked one, asserting reuse still occurs.
  • A synthesize_reused_result/reusable_importer_dep test using LockfileResolution::Tarball with git_hosted: Some(true)).

As per path instructions, "Ensure tests prove the regression ... not just coverage."

Also applies to: 188-212

🤖 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 `@pnpm/crates/resolving-deps-resolver/src/lockfile_reuse/tests.rs` around lines
96 - 115, Extend the lockfile reuse tests around reusable_importer_dep and
synthesize_reused_result to cover normalized-equivalent git specifiers, using
syntactically different forms that resolve to the same repository and asserting
the locked package is reused. Add coverage for LockfileResolution::Tarball with
git_hosted set to true, verifying both reusable_importer_dep and
synthesize_reused_result preserve reuse behavior and produce the expected
result.

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 `@pnpm/crates/resolving-deps-resolver/src/lockfile_reuse/tests.rs`:
- Around line 96-115: Extend the lockfile reuse tests around
reusable_importer_dep and synthesize_reused_result to cover
normalized-equivalent git specifiers, using syntactically different forms that
resolve to the same repository and asserting the locked package is reused. Add
coverage for LockfileResolution::Tarball with git_hosted set to true, verifying
both reusable_importer_dep and synthesize_reused_result preserve reuse behavior
and produce the expected result.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1a6fa94c-0e28-461f-a729-70df5d0e4aa0

📥 Commits

Reviewing files that changed from the base of the PR and between 0c7ccd6 and 957d2f5.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !Cargo.lock
📒 Files selected for processing (21)
  • .changeset/git-hosted-dependency-parity.md
  • pnpm/crates/cli/tests/git_hosted_install.rs
  • pnpm/crates/git-fetcher/src/fetcher/tests.rs
  • pnpm/crates/git-fetcher/src/tarball_fetcher/tests.rs
  • pnpm/crates/package-manager/src/add.rs
  • pnpm/crates/package-manager/src/add/tests.rs
  • pnpm/crates/package-manager/src/install_frozen_lockfile.rs
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpm/crates/package-manager/src/symlink_direct_dependencies.rs
  • pnpm/crates/package-manager/src/symlink_direct_dependencies/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/lockfile_reuse.rs
  • pnpm/crates/resolving-deps-resolver/src/lockfile_reuse/tests.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
  • pnpm/crates/resolving-git-resolver/src/runners.rs
  • pnpm/crates/resolving-git-resolver/src/runners/tests.rs
  • pnpm/crates/testing-utils/src/bin.rs
  • pnpm/crates/testing-utils/src/registry.rs
  • pnpm/plans/TEST_PORTING.md
  • pnpr/crates/pnpr-fixtures/Cargo.toml
  • pnpr/crates/pnpr-fixtures/src/lib.rs
  • pnpr/crates/pnpr-fixtures/src/tests.rs
🚧 Files skipped from review as they are similar to previous changes (17)
  • .changeset/git-hosted-dependency-parity.md
  • pnpm/crates/testing-utils/src/bin.rs
  • pnpr/crates/pnpr-fixtures/Cargo.toml
  • pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pnpr/crates/pnpr-fixtures/src/tests.rs
  • pnpm/crates/package-manager/src/add/tests.rs
  • pnpm/crates/package-manager/src/symlink_direct_dependencies.rs
  • pnpm/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
  • pnpm/crates/package-manager/src/install_frozen_lockfile.rs
  • pnpr/crates/pnpr-fixtures/src/lib.rs
  • pnpm/crates/git-fetcher/src/fetcher/tests.rs
  • pnpm/crates/package-manager/src/symlink_direct_dependencies/tests.rs
  • pnpm/crates/git-fetcher/src/tarball_fetcher/tests.rs
  • pnpm/crates/package-manager/src/add.rs
  • pnpm/plans/TEST_PORTING.md
  • pnpm/crates/cli/tests/git_hosted_install.rs
  • pnpm/crates/testing-utils/src/registry.rs

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants