Skip to content

fix(git-resolver): don't record SSH URLs for git deps that didn't ask for SSH - #13290

Merged
zkochan merged 1 commit into
pnpm:mainfrom
Ayush442842q:fix/git-access-ci-github-deps
Aug 6, 2026
Merged

zkochan merged 1 commit into
pnpm:mainfrom
Ayush442842q:fix/git-access-ci-github-deps

Conversation

@Ayush442842q

@Ayush442842q Ayush442842q commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

TypeScript CLI (v11) only. This PR fixes a CI regression where shorthand Git dependencies (such as github:owner/repo) fail to install on CI environments that lack SSH keys, and hardens the git-resolver probing so a transient network failure can no longer poison the lockfile with an SSH URL.

Previously, the resolver could record an SSH URL for a spec that never asked for SSH, in two ways:

  1. If all access probes failed, it unconditionally fell back to an SSH URL representation (git+ssh://...).
  2. If the repository visibility probe (a single HTTP HEAD request with no retries) failed transiently — e.g. GitHub throttling a runner — on a machine that has SSH keys, the SSH git ls-remote probe won and git@host:... was written into the lockfile, breaking every subsequent install on keyless CI even for public repos.

Now:

  • The visibility HEAD probe retries transient failures (429/5xx/network errors) and is issued once per resolution instead of up to three times.
  • For specifiers that did not explicitly ask for SSH, anonymous HTTPS git ls-remote access is probed before SSH, so SSH is only recorded when HTTPS demonstrably cannot reach the repository.
  • If every probe fails, the resolver falls back to HTTPS for shorthand and HTTPS-style specifiers, and only falls back to SSH if the user explicitly provided an SSH URL format.
  • A repository that could not be confirmed public is never resolved to the host's anonymous archive URL (e.g. codeload.github.com, which a private repository's consumers cannot fetch); it stays a type: git resolution against the recorded URL so ambient Git credentials (helpers, tokens) apply.

Behavior note: a private repository reachable both over authenticated HTTPS and over SSH now resolves to its HTTPS URL, where previous versions recorded the SSH URL.

Rust side: this PR originally carried matching pacquet commits; they were superseded by the merged v12 identity redesign (pnpm/pnpm#13684), which removes this bug class structurally (no transport probing at all). The branch has been rebuilt on top of that merge as TypeScript-only, and the changeset no longer targets pacquet.

Fixes pnpm/pnpm#13276.

Squash Commit Body

Two flaws let a transient probe failure record an SSH URL for a spec
that never asked for SSH: the visibility HEAD probe ran once with
retries disabled and treated any failure as private, and the SSH
ls-remote probe ran before the anonymous HTTPS one. On a machine with
SSH keys, a throttled HEAD request resolved a public repo to
git@host:..., breaking later installs on keyless CI runners with
Permission denied (publickey).

The resolver now retries transient HEAD failures, probes anonymous
HTTPS git access before SSH for every representation except explicit
SSH URLs (hosted.default === 'sshurl'), falls back to HTTPS when every
probe fails, and records the host-archive tarball only for repos
proven public - otherwise the resolution stays type: git so ambient
credentials apply.

TypeScript CLI only: pacquet resolves this bug class structurally via
the v12 identity redesign (pnpm/pnpm#13684).

Closes pnpm/pnpm#13276.

Checklist

  • I checked the referenced issue and verified that none of the PRs already linked to it solves it.
  • The change is implemented in both the TypeScript CLI and the Rust pnpm/ port, or the description notes what still needs porting. (TypeScript-only by design: the Rust v12 CLI resolves this bug class via the identity redesign merged in feat(resolving-git-resolver)!: treat hosted git specs as identities, not transport choices #13684.)
  • Added a changeset (pnpm changeset) if this PR changes any published package.
  • Added or updated tests.

Written by an agent (Claude Code, claude-fable-5).

@Ayush442842q
Ayush442842q requested a review from zkochan as a code owner July 25, 2026 02:12
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

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

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

@coderabbitai

coderabbitai Bot commented Jul 25, 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

Git resolver fallbacks now use HTTPS for shorthand and HTTPS-style specifications when probes fail, while retaining SSH fallback for explicitly SSH-style inputs. HTTP visibility probes retry transient failures. Rust and TypeScript implementations, tests, dependencies, and release metadata are updated.

Changes

Git HTTPS fallback

Layer / File(s) Summary
Probe retry behavior
pnpm/crates/resolving-git-resolver/src/runners.rs, pnpm/crates/resolving-git-resolver/src/runners/tests.rs, pnpm11/resolving/git-resolver/src/parseBareSpecifier.ts
HTTP visibility probes retry transient failures with backoff and retain immediate handling for successful or definitive responses.
Rust resolver fallback and validation
pnpm/crates/resolving-git-resolver/src/hosted_git.rs, pnpm/crates/resolving-git-resolver/src/parse_bare_specifier.rs, pnpm/crates/resolving-git-resolver/src/**/tests.rs, pnpm/crates/resolving-git-resolver/Cargo.toml
The Rust resolver selects SSH only for explicit SSH representations and otherwise uses HTTPS, with tests covering probe ordering and HTTPS codeload resolutions.
TypeScript resolver parity and validation
pnpm11/resolving/git-resolver/src/parseBareSpecifier.ts, pnpm11/resolving/git-resolver/test/index.ts
The TypeScript resolver and tests adopt HTTPS-first fallback, HTTPS tarball results, anonymous HTTPS access, and explicit SSH preservation.
Release metadata
.changeset/git-ci-https-fallback.md
A Changesets entry documents probe retries and HTTPS fallback behavior.

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

Assessment against linked issues

Objective Addressed Explanation
Avoid CI failures caused by shorthand github: dependencies resolving through SSH without available SSH keys [#13276] ✅

Sequence Diagram(s)

sequenceDiagram
  participant PackageResolver
  participant GitResolver
  participant GitHub
  participant Codeload
  PackageResolver->>GitResolver: resolve shorthand or HTTPS Git specifier
  GitResolver->>GitHub: probe HTTPS visibility and remote access
  GitHub-->>GitResolver: probe result
  GitResolver->>Codeload: resolve commit tarball when HTTPS Git resolution is unavailable
  Codeload-->>PackageResolver: HTTPS tarball resolution
Loading

Possibly related PRs

  • pnpm/pnpm#13160: Modifies the same Git resolver fallback logic and related hosted Git tests.

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

Suggested reviewers: zkochan

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

@greptile-apps

greptile-apps Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failures remain within the scope of the previous review thread.

Reviews (8): Last reviewed commit: "fix(git-resolver): fall back to HTTPS in..." | Re-trigger Greptile

@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-git-resolver/src/git_resolver/tests.rs (1)

243-248: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a regular rationale comment for this private test.

These rustdoc lines narrate the test scenario and expected resolution. Replace them with a concise // comment explaining only the CI/explicit-HTTPS invariant.

As per path instructions, “Use rustdoc comments for public API contracts and regular comments for implementation rationale. Do not duplicate test behavior in documentation.”

🤖 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-git-resolver/src/git_resolver/tests.rs` around lines
243 - 248, Replace the rustdoc block above the private test with a concise
regular // comment. Keep only the implementation rationale that explicit HTTPS
must remain usable in CI when SSH and anonymous HTTPS probes fail; remove the
step-by-step scenario and expected tarball-resolution details.

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-git-resolver/src/git_resolver/tests.rs`:
- Around line 243-248: Replace the rustdoc block above the private test with a
concise regular // comment. Keep only the implementation rationale that explicit
HTTPS must remain usable in CI when SSH and anonymous HTTPS probes fail; remove
the step-by-step scenario and expected tarball-resolution details.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: bcbfaaf9-e5bd-4946-b47b-de3e29bce3e3

📥 Commits

Reviewing files that changed from the base of the PR and between d47ab91 and 6c321a2.

📒 Files selected for processing (7)
  • .changeset/git-ci-https-fallback.md
  • pnpm/crates/resolving-git-resolver/src/git_resolver/tests.rs
  • pnpm/crates/resolving-git-resolver/src/hosted_git.rs
  • pnpm/crates/resolving-git-resolver/src/parse_bare_specifier.rs
  • pnpm/crates/resolving-git-resolver/src/parse_bare_specifier/tests.rs
  • pnpm11/resolving/git-resolver/src/parseBareSpecifier.ts
  • pnpm11/resolving/git-resolver/test/index.ts

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

codecov-commenter commented Jul 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.49123% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.17%. Comparing base (641ccd3) to head (c8987f0).
⚠️ Report is 43 commits behind head on main.

Files with missing lines Patch % Lines
...resolving-git-resolver/src/parse_bare_specifier.rs 97.22% 1 Missing ⚠️
pnpm/crates/resolving-git-resolver/src/runners.rs 95.23% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13290      +/-   ##
==========================================
+ Coverage   88.00%   88.17%   +0.17%     
==========================================
  Files         567      612      +45     
  Lines       97930    99604    +1674     
==========================================
+ Hits        86179    87823    +1644     
- Misses      11751    11781      +30     

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

@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-git-resolver/src/parse_bare_specifier/tests.rs (1)

123-126: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert the probe behavior, not only the final URL.

Fake records probe calls, but this test never inspects them. A regression that skips or changes the HTTPS/SSH probe sequence could still pass while returning the expected SSH fallback. Assert the expected recorded calls (and ordering/count) alongside fetch_spec.

As per path instructions, REVIEW_GUIDE.md requires regression coverage for both the selected transport and probe behavior.

🤖 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-git-resolver/src/parse_bare_specifier/tests.rs` around
lines 123 - 126, Update the test around kind.finalize(&probe) to assert Fake’s
recorded probe calls in addition to spec.fetch_spec. Verify the expected
HTTPS/SSH probe sequence, including ordering and call count, so the test covers
both selected transport and probe behavior.

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-git-resolver/src/parse_bare_specifier/tests.rs`:
- Around line 123-126: Update the test around kind.finalize(&probe) to assert
Fake’s recorded probe calls in addition to spec.fetch_spec. Verify the expected
HTTPS/SSH probe sequence, including ordering and call count, so the test covers
both selected transport and probe behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7ee11de5-0e2a-42ac-b78a-a3110fefb08d

📥 Commits

Reviewing files that changed from the base of the PR and between 6c321a2 and b1cca05.

📒 Files selected for processing (3)
  • pnpm/crates/resolving-git-resolver/src/git_resolver/tests.rs
  • pnpm/crates/resolving-git-resolver/src/parse_bare_specifier/tests.rs
  • pnpm11/resolving/git-resolver/test/index.ts
💤 Files with no reviewable changes (1)
  • pnpm11/resolving/git-resolver/test/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • pnpm/crates/resolving-git-resolver/src/git_resolver/tests.rs

@github-actions

github-actions Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: c8987f023458

Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. Bencher consumes pacquet@HEAD and pnpr@HEAD.

The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time).

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.728 ± 0.134 2.538 2.917 1.63 ± 0.14
pacquet@main 2.649 ± 0.139 2.472 2.898 1.58 ± 0.14
pnpr@HEAD 1.677 ± 0.122 1.478 1.834 1.00
pnpr@main 1.732 ± 0.138 1.510 1.905 1.03 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.7275738907400005,
      "stddev": 0.13393324754075028,
      "median": 2.71279164174,
      "user": 2.29335488,
      "system": 1.7804692799999997,
      "min": 2.53825423474,
      "max": 2.91729972174,
      "times": [
        2.53825423474,
        2.91230268574,
        2.81574340374,
        2.58878468574,
        2.61305602274,
        2.65046814274,
        2.91729972174,
        2.7395808857399997,
        2.68600239774,
        2.81424672674
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.64873416464,
      "stddev": 0.13917619800597367,
      "median": 2.6003342192399996,
      "user": 2.2023819799999997,
      "system": 1.6912917799999998,
      "min": 2.47158340074,
      "max": 2.89810978474,
      "times": [
        2.58444926574,
        2.56719645274,
        2.47158340074,
        2.69155820774,
        2.89810978474,
        2.57648940574,
        2.5993787947399998,
        2.88698126374,
        2.61030542674,
        2.60128964374
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.67692673674,
      "stddev": 0.12185867715472072,
      "median": 1.66125153824,
      "user": 1.4305934799999995,
      "system": 1.4457087799999997,
      "min": 1.47802501874,
      "max": 1.83435241974,
      "times": [
        1.7965989757399998,
        1.59344054174,
        1.75798454274,
        1.83435241974,
        1.62075213574,
        1.62807020974,
        1.81607425174,
        1.69443286674,
        1.54953640474,
        1.47802501874
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.73232961824,
      "stddev": 0.13844462129416696,
      "median": 1.78655986574,
      "user": 1.6746933799999997,
      "system": 1.67996768,
      "min": 1.50965095574,
      "max": 1.90507122874,
      "times": [
        1.81607785874,
        1.50965095574,
        1.5869613617399998,
        1.84031092074,
        1.75704187274,
        1.82215305874,
        1.90507122874,
        1.8163813387399999,
        1.5386138697399998,
        1.7310337167399998
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 376.8 ± 20.7 348.2 403.6 1.09 ± 0.12
pacquet@main 345.4 ± 31.2 277.3 389.0 1.00
pnpr@HEAD 347.2 ± 30.2 305.4 413.3 1.01 ± 0.13
pnpr@main 425.1 ± 56.6 351.4 530.3 1.23 ± 0.20
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.37675756744000005,
      "stddev": 0.02067183865916729,
      "median": 0.37613369744,
      "user": 0.30966238,
      "system": 0.7030866199999999,
      "min": 0.34815938744,
      "max": 0.40363483644000003,
      "times": [
        0.40363483644000003,
        0.40263020044000003,
        0.39774981444,
        0.37039648244000006,
        0.36587204344,
        0.38187091244000004,
        0.34815938744,
        0.38652120544,
        0.35494731644000005,
        0.35579347544000006
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.34538746074,
      "stddev": 0.031236461014083117,
      "median": 0.3453057984400001,
      "user": 0.30597838,
      "system": 0.6396968199999999,
      "min": 0.27730099744000003,
      "max": 0.38896705844000007,
      "times": [
        0.38896705844000007,
        0.35451520444000006,
        0.35640591644,
        0.33273140244000005,
        0.33467024344,
        0.27730099744000003,
        0.33609639244000006,
        0.37895977444000006,
        0.36365707444000006,
        0.33057054344000003
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.34719966323999996,
      "stddev": 0.03017866204140098,
      "median": 0.34600181544,
      "user": 0.28803118,
      "system": 0.6518081199999999,
      "min": 0.30542338444000006,
      "max": 0.41332641844000007,
      "times": [
        0.37534025644,
        0.34577995844000003,
        0.41332641844000007,
        0.35658432144,
        0.34697148644000003,
        0.30542338444000006,
        0.32911298744000006,
        0.32334899044000004,
        0.32988515644000005,
        0.34622367244
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.42512845334000005,
      "stddev": 0.056611379743693215,
      "median": 0.42113985294000006,
      "user": 0.34567568,
      "system": 0.7190866199999999,
      "min": 0.35135435844,
      "max": 0.53029364644,
      "times": [
        0.38151279944000005,
        0.35135435844,
        0.35137151044000003,
        0.44143000944000005,
        0.41008259644000006,
        0.42605671744000007,
        0.46342770544000006,
        0.53029364644,
        0.41622298844000005,
        0.47953220144
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.998 ± 0.075 2.904 3.160 1.70 ± 0.13
pacquet@main 3.038 ± 0.142 2.880 3.309 1.73 ± 0.15
pnpr@HEAD 1.799 ± 0.120 1.604 2.008 1.02 ± 0.10
pnpr@main 1.760 ± 0.127 1.529 1.911 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.9980535004399997,
      "stddev": 0.07458067646806933,
      "median": 2.98746058474,
      "user": 2.5426973399999997,
      "system": 2.08488014,
      "min": 2.90410413174,
      "max": 3.1596243077399997,
      "times": [
        3.0641102017399997,
        3.1596243077399997,
        3.00907049974,
        2.9200110267399997,
        3.0013094747399998,
        3.0291425187399996,
        2.90410413174,
        2.95485283374,
        2.9736116947399998,
        2.96469831474
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 3.03849425074,
      "stddev": 0.14196056533544893,
      "median": 2.99293054874,
      "user": 2.5236788399999996,
      "system": 2.0360540400000002,
      "min": 2.88001625274,
      "max": 3.3091053587399997,
      "times": [
        3.18758115274,
        3.3091053587399997,
        3.18608602574,
        3.0245229227399997,
        2.96510040874,
        2.98073510474,
        2.95843771674,
        2.88823157174,
        2.88001625274,
        3.00512599274
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.7989981398399997,
      "stddev": 0.12021709762045915,
      "median": 1.77083164124,
      "user": 1.55015594,
      "system": 1.6309227400000001,
      "min": 1.60378147274,
      "max": 2.0077539777399998,
      "times": [
        1.73512138274,
        1.80191245474,
        1.7316983937400001,
        1.7914457667400001,
        1.75021751574,
        1.91730812974,
        2.0077539777399998,
        1.60378147274,
        1.72063838274,
        1.93010392174
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.7595465270400001,
      "stddev": 0.1272659514820241,
      "median": 1.8043242432400002,
      "user": 1.43709034,
      "system": 1.5694010399999998,
      "min": 1.52864942574,
      "max": 1.9108788647400001,
      "times": [
        1.7971163657400002,
        1.52864942574,
        1.6288437317400002,
        1.81708777474,
        1.8115321207400001,
        1.82783081174,
        1.78813336574,
        1.9108788647400001,
        1.60305644074,
        1.88233636874
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 575.5 ± 23.0 547.6 608.7 1.44 ± 0.12
pacquet@main 543.3 ± 47.5 502.4 641.3 1.36 ± 0.16
pnpr@HEAD 399.8 ± 13.7 376.6 420.3 1.00 ± 0.08
pnpr@main 398.7 ± 29.8 353.1 442.8 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5755099405,
      "stddev": 0.023028164818616484,
      "median": 0.567398344,
      "user": 0.76065942,
      "system": 0.94295542,
      "min": 0.5475866805,
      "max": 0.6087345725,
      "times": [
        0.5475866805,
        0.5578517795,
        0.5693122935,
        0.5497644415,
        0.5646353905,
        0.6076062235,
        0.5654843945,
        0.5857704435,
        0.6087345725,
        0.5983531855
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.5432674826999999,
      "stddev": 0.04747784473821738,
      "median": 0.5248959,
      "user": 0.76656042,
      "system": 0.8520861200000001,
      "min": 0.5024036525,
      "max": 0.6412602495,
      "times": [
        0.5824778805,
        0.5024036525,
        0.5030273425,
        0.5106101845,
        0.6412602495,
        0.5981093685,
        0.5187521965,
        0.5317353905,
        0.5310396035,
        0.5132589585
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3997703543000001,
      "stddev": 0.013739991957766954,
      "median": 0.3984937475,
      "user": 0.29687101999999993,
      "system": 0.6456384199999999,
      "min": 0.3766289635,
      "max": 0.4202726005,
      "times": [
        0.4024572615,
        0.40662236350000003,
        0.3945302335,
        0.4202726005,
        0.4156199025,
        0.4106355705,
        0.3936138635,
        0.3906120855,
        0.3766289635,
        0.3867106985
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.3986746841999999,
      "stddev": 0.029819598012241152,
      "median": 0.39370436750000004,
      "user": 0.30055232,
      "system": 0.66528332,
      "min": 0.3531226755,
      "max": 0.4427892295,
      "times": [
        0.4265139125,
        0.4427892295,
        0.4004092145,
        0.4114336095,
        0.3737426925,
        0.3767527355,
        0.3787948195,
        0.3869995205,
        0.4361884325,
        0.3531226755
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.918 ± 0.113 1.808 2.111 4.06 ± 0.78
pacquet@main 1.990 ± 0.117 1.853 2.127 4.22 ± 0.81
pnpr@HEAD 0.472 ± 0.086 0.362 0.650 1.00
pnpr@main 0.696 ± 0.200 0.523 1.203 1.48 ± 0.50
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.91785025012,
      "stddev": 0.11250926485572676,
      "median": 1.88292733662,
      "user": 1.0634684799999998,
      "system": 0.9532408,
      "min": 1.80824062262,
      "max": 2.11060706062,
      "times": [
        2.11060706062,
        2.07374279462,
        2.02131538962,
        1.85098060262,
        1.8264903866200002,
        1.84339183062,
        1.91487407062,
        1.8111876366200002,
        1.80824062262,
        1.91767210662
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.98954384952,
      "stddev": 0.11708329797437687,
      "median": 1.98345268912,
      "user": 1.18802288,
      "system": 1.0529528999999997,
      "min": 1.85291897362,
      "max": 2.12705001862,
      "times": [
        1.86491102562,
        1.8992826796200002,
        1.95345193462,
        2.01345344362,
        1.85810032362,
        1.85291897362,
        2.10750206162,
        2.12227971962,
        2.09648831462,
        2.12705001862
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.47195551302000005,
      "stddev": 0.08576504797305042,
      "median": 0.45540804062000007,
      "user": 0.33851767999999993,
      "system": 0.7509612999999999,
      "min": 0.36232467962000003,
      "max": 0.64954218862,
      "times": [
        0.46456293662000003,
        0.44136491262000005,
        0.49961287162,
        0.52008387262,
        0.54594616062,
        0.64954218862,
        0.44625314462000004,
        0.41185444162,
        0.37800992162,
        0.36232467962000003
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.69631675772,
      "stddev": 0.19976935335961435,
      "median": 0.64926297362,
      "user": 0.50055638,
      "system": 0.9440429000000001,
      "min": 0.52257142562,
      "max": 1.20256150762,
      "times": [
        0.5870984986200001,
        0.68659728962,
        0.61192865762,
        1.20256150762,
        0.71711151462,
        0.7836539426200001,
        0.74925019262,
        0.56812406762,
        0.53427048062,
        0.52257142562
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 355.9 ± 83.8 281.7 560.8 3.41 ± 0.83
pacquet@main 326.9 ± 62.6 260.4 462.0 3.13 ± 0.64
pnpr@HEAD 109.3 ± 11.5 94.7 133.9 1.05 ± 0.13
pnpr@main 104.3 ± 7.0 95.0 117.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.3558666383000001,
      "stddev": 0.08382247015326869,
      "median": 0.31715566250000005,
      "user": 0.32876684,
      "system": 0.12124868,
      "min": 0.2817490875,
      "max": 0.5608083415,
      "times": [
        0.3117269865,
        0.5608083415,
        0.41689709950000003,
        0.39120723550000003,
        0.3202541025,
        0.3565740625,
        0.2940829435,
        0.2817490875,
        0.3140572225,
        0.3113093015
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.3269280120000001,
      "stddev": 0.06260211638641812,
      "median": 0.31228710800000004,
      "user": 0.2956859399999999,
      "system": 0.11891088000000001,
      "min": 0.26038644050000004,
      "max": 0.46199891550000005,
      "times": [
        0.2910368125,
        0.27484360550000003,
        0.3255908765,
        0.30489509350000005,
        0.3196791225,
        0.39104860750000003,
        0.36376557150000005,
        0.46199891550000005,
        0.27603507450000003,
        0.26038644050000004
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.10932170412962965,
      "stddev": 0.011495507221887316,
      "median": 0.1076824635,
      "user": 0.03275729185185185,
      "system": 0.016395346666666664,
      "min": 0.0947262375,
      "max": 0.1339339525,
      "times": [
        0.1018654865,
        0.10287507350000001,
        0.1076824635,
        0.0947262375,
        0.10632348050000001,
        0.12209965350000002,
        0.12003872150000001,
        0.11535368150000001,
        0.11219543050000001,
        0.12966577550000002,
        0.1339339525,
        0.11398524250000001,
        0.12242865150000001,
        0.10646603850000001,
        0.09488792150000001,
        0.12263697250000001,
        0.12644361250000002,
        0.10784281450000001,
        0.09926893950000001,
        0.11181808150000001,
        0.10052922750000001,
        0.09525463950000002,
        0.10216549050000001,
        0.10983379450000001,
        0.09780582150000001,
        0.09482013350000001,
        0.09873867350000001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.10434051702000001,
      "stddev": 0.006953573212462496,
      "median": 0.10248833650000001,
      "user": 0.03132623999999999,
      "system": 0.013526920000000003,
      "min": 0.09495329350000001,
      "max": 0.11717521350000001,
      "times": [
        0.11175451150000001,
        0.11077362950000001,
        0.10205677750000001,
        0.11489198550000002,
        0.1092414715,
        0.10739388050000001,
        0.1090708615,
        0.09834601650000001,
        0.09495329350000001,
        0.10076430950000001,
        0.09611735150000002,
        0.09733985650000002,
        0.09833747050000001,
        0.11717521350000001,
        0.11140752050000001,
        0.1105996535,
        0.09815445750000001,
        0.09933462350000001,
        0.10248833650000001,
        0.1053523365,
        0.10683270750000001,
        0.0964550645,
        0.11500655050000001,
        0.0969362685,
        0.09772877750000002
      ]
    }
  ]
}

Scenario: Isolated linker: peer-heavy resolve, hot cache, offline

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.014 ± 0.224 0.761 1.435 1.00
pacquet@main 1.186 ± 0.345 0.743 1.720 1.17 ± 0.43
pnpm@HEAD 4.284 ± 0.373 3.770 4.758 4.22 ± 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.0140686773822223,
      "stddev": 0.22434410537313595,
      "median": 0.98705882816,
      "user": 0.9394805844444445,
      "system": 0.16039069333333333,
      "min": 0.7612668371600001,
      "max": 1.43477632916,
      "times": [
        1.20567067216,
        1.18675952116,
        0.80081793816,
        0.7612668371600001,
        0.81094485916,
        0.9260932751600001,
        0.98705882816,
        1.43477632916,
        1.01322983616
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.1861399008266666,
      "stddev": 0.34482654743989005,
      "median": 1.1656134681599999,
      "user": 1.124891362222222,
      "system": 0.1976594711111111,
      "min": 0.74321576716,
      "max": 1.72047623716,
      "times": [
        1.20834193516,
        1.05702023716,
        0.9108457321600001,
        1.72047623716,
        1.1656134681599999,
        1.70044431916,
        1.29803239916,
        0.8712690121600001,
        0.74321576716
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 4.283795133493333,
      "stddev": 0.37287859495364717,
      "median": 4.4237296301599995,
      "user": 6.607410139999999,
      "system": 0.4070752488888889,
      "min": 3.77026484916,
      "max": 4.758348778159999,
      "times": [
        4.4237296301599995,
        3.82427748116,
        3.77026484916,
        4.45652483916,
        4.55542420116,
        4.758348778159999,
        4.62510748216,
        4.27189618116,
        3.86858275916
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.856 ± 0.226 4.520 5.179 1.32 ± 0.08
pacquet@main 4.785 ± 0.265 4.536 5.485 1.30 ± 0.09
pnpr@HEAD 3.738 ± 0.173 3.526 4.095 1.02 ± 0.06
pnpr@main 3.682 ± 0.157 3.527 3.908 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.85645253436,
      "stddev": 0.22578658609845478,
      "median": 4.897009339359999,
      "user": 2.66629404,
      "system": 2.00798832,
      "min": 4.519608874859999,
      "max": 5.17859632486,
      "times": [
        4.693216682859999,
        5.06779804486,
        4.63948068886,
        5.17859632486,
        5.02320506586,
        4.970739507859999,
        4.519608874859999,
        4.6253652998599994,
        5.023235682859999,
        4.823279170859999
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.78468136476,
      "stddev": 0.2654465397846592,
      "median": 4.72296456386,
      "user": 2.77677994,
      "system": 2.0191183199999996,
      "min": 4.535671488859999,
      "max": 5.48535504986,
      "times": [
        5.48535504986,
        4.80743393886,
        4.64568233286,
        4.69455556086,
        4.535671488859999,
        4.77795237886,
        4.613695326859999,
        4.66202899286,
        4.75137356686,
        4.8730650108599995
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.7381289703600005,
      "stddev": 0.17263787377287326,
      "median": 3.7128608093600004,
      "user": 1.77648924,
      "system": 1.71432702,
      "min": 3.52604248486,
      "max": 4.09451765386,
      "times": [
        3.60563532186,
        4.09451765386,
        3.85133863586,
        3.5973345238600003,
        3.86075628886,
        3.6485763758600003,
        3.8096756608600004,
        3.77714524286,
        3.6102675148600003,
        3.52604248486
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.6815194185599998,
      "stddev": 0.15682051767342609,
      "median": 3.62161673436,
      "user": 1.70802144,
      "system": 1.58656782,
      "min": 3.52735543586,
      "max": 3.90761550286,
      "times": [
        3.87020438986,
        3.52999756786,
        3.60789629886,
        3.63533716986,
        3.90761550286,
        3.8571441868600003,
        3.54445688286,
        3.52735543586,
        3.79071116286,
        3.54447558786
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13290
Testbedpacquet

🚨 2 Alerts

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
isolated-linker.fresh-install.hot-cache.hot-storeLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
547.59 ms
(+20.51%)Baseline: 454.40 ms
545.28 ms
(100.42%)

isolated-linker.fresh-resolve.hot-cache.offlineLatency
milliseconds (ms)
📈 plot
🚷 threshold
🚨 alert (🔔)
281.75 ms
(+33.27%)Baseline: 211.42 ms
253.70 ms
(111.06%)

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
2,904.10 ms
(+7.14%)Baseline: 2,710.57 ms
3,252.69 ms
(89.28%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,808.24 ms
(+0.32%)Baseline: 1,802.50 ms
2,163.00 ms
(83.60%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
🚨 view alert (🔔)
547.59 ms
(+20.51%)Baseline: 454.40 ms
545.28 ms
(100.42%)

isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
🚨 view alert (🔔)
281.75 ms
(+33.27%)Baseline: 211.42 ms
253.70 ms
(111.06%)

isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,538.25 ms
(+2.99%)Baseline: 2,464.49 ms
2,957.39 ms
(85.83%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,519.61 ms
(+0.23%)Baseline: 4,509.23 ms
5,411.08 ms
(83.53%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
348.16 ms
(+15.17%)Baseline: 302.30 ms
362.75 ms
(95.98%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
761.27 ms
(+5.21%)Baseline: 723.58 ms
868.30 ms
(87.67%)
🐰 View full continuous benchmarking report in Bencher

@github-actions

github-actions Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13290
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
1,430.66 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
283.45 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
294.09 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
83.41 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,364.05 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,450.50 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
245.86 ms
🐰 View full continuous benchmarking report in Bencher

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Changeset uses historical phrasing 📘 Rule violation ⚙ Maintainability ⭐ New
Description
The changeset text references prior behavior (previous versions recorded), which violates the rule
to describe current behavior only. This can leave long-lived release notes/documentation mixing
current contract with historical implementation detail.
Code

.changeset/git-ci-https-fallback.md[13]

+Note that a private repository that is reachable both over authenticated HTTPS and over SSH now resolves to its HTTPS URL, where previous versions recorded the SSH URL.
Relevance

●●● Strong

They often accept tweaks to make changeset text user-facing/contract-focused; this is a simple
rewording.

PR-#13658
PR-#13594

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 772199 forbids historical/temporal references in added/modified comments/doc text.
Line 13 explicitly references previous versions, which is historical phrasing rather than a
current-behavior description.

Rule 772199: Comments must describe current behavior, not historical implementations
.changeset/git-ci-https-fallback.md[13-13]

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 changeset includes historical phrasing (`previous versions recorded`) instead of describing the current behavior/contract.

## Issue Context
Compliance requires comments/doc text to describe current behavior, not past implementations.

## Fix Focus Areas
- .changeset/git-ci-https-fallback.md[13-13]

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


2. Hosted tarball contract broken 🐞 Bug ⚙ Maintainability
Description
parseBareSpecifier.ts now returns hosted objects where tarball can be undefined, but the
exported HostedPackageSpec.hosted.tarball type still requires a function. This makes the
TypeScript contract unsound and can lead to incorrect downstream assumptions (even if current
in-repo usage is guarded).
Code

pnpm11/resolving/git-resolver/src/parseBareSpecifier.ts[R122-125]

+      // Same rationale as the early return above: without proof that the repo
+      // is public, the host's anonymous archive endpoint cannot be assumed to
+      // work, so the resolution must stay `type: git`.
+      tarball: repoIsPublic ? hosted.tarball : undefined,
Relevance

●●● Strong

Team often fixes tarball optionality/type-safety issues; making contract sound aligns with prior
accepted guards.

PR-#11509
PR-#12491

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The exported HostedPackageSpec type requires hosted.tarball to be a function, but the new return
path assigns undefined for non-public repos. Current consumer code happens to use optional
chaining, indicating the runtime shape is now “optional tarball”.

pnpm11/resolving/git-resolver/src/parseBareSpecifier.ts[9-17]
pnpm11/resolving/git-resolver/src/parseBareSpecifier.ts[116-126]
pnpm11/resolving/git-resolver/src/index.ts[61-70]

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

### Issue description
`HostedPackageSpec.hosted.tarball` is typed as a required function, but the resolver now conditionally sets it to `undefined` when the repo is not proven public. This breaks the TS API contract and can mislead consumers.

### Issue Context
Current in-repo usage calls `hosted.tarball?.()` defensively, but the type still promises `tarball` exists whenever `hosted` exists.

### Fix Focus Areas
- pnpm11/resolving/git-resolver/src/parseBareSpecifier.ts[9-17]
- pnpm11/resolving/git-resolver/src/parseBareSpecifier.ts[116-126]

### Suggested fix
Update `HostedPackageSpec` so `hosted.tarball` is optional (e.g. `tarball?: () => string | undefined`) or always provide a function (e.g. `tarball: () => undefined`) when disabling tarballs. Ensure any consumers remain compatible with the chosen contract.

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


3. Release note overstates SSH 🐞 Bug ⚙ Maintainability
Description
The changeset says the resolver “no longer records an SSH URL unless the user explicitly wrote one”,
but both Rust and TS can still record an SSH URL for non-SSH specifiers when HTTPS probes/fallbacks
don’t produce a fetchSpec and SSH ls-remote succeeds. This can mislead users and create confusion
when lockfiles still contain SSH URLs for private/HTTPS-blocked repos.
Code

.changeset/git-ci-https-fallback.md[7]

+Fixed a CI regression where `github:owner/repo` dependencies (and other shorthand Git specifiers) would fail to install with `Permission denied (publickey)` on CI runners that lack SSH keys. The Git resolver no longer records an SSH URL unless the user explicitly wrote one (e.g. `git+ssh://` or `git@host:...`):
Relevance

●●● Strong

Team often accepts changeset rewording to match actual behavior/scope; misleading absolutes are
corrected.

PR-#11362
PR-#12772

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Both stacks still attempt/choose SSH even when the original specifier was not SSH, after HTTPS paths
fail to set a fetchSpec; therefore the changeset’s absolute statement is inaccurate.

pnpm/crates/resolving-git-resolver/src/parse_bare_specifier.rs[229-290]
pnpm11/resolving/git-resolver/src/parseBareSpecifier.ts[71-114]

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 changeset headline claims SSH URLs are never recorded unless explicitly provided by the user. However, the resolver still may record SSH for non-SSH specifiers when HTTPS is unreachable but SSH is reachable.

## Issue Context
Both resolver implementations (Rust + TS) still have a non-explicit-SSH path that selects SSH after exhausting HTTPS options. The changeset should describe the actual behavior to avoid misleading release notes.

## Fix Focus Areas
- .changeset/git-ci-https-fallback.md[7-11]

## Suggested change
Reword the opening sentence to something like:
- “The Git resolver now prefers anonymous HTTPS for shorthand/HTTPS-style specifiers and will only record SSH after HTTPS access is proven unreachable (or when the user explicitly provided an SSH URL).”
And ensure bullets 10–11 don’t imply SSH is impossible for non-SSH specifiers, only deprioritized.

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


View more (2)
4. No TS test for retries 📘 Rule violation ▣ Testability
Description
TypeScript now passes a retry policy to fetchWithDispatcher in isRepoPublic, but the TypeScript
test changes in this PR don’t assert that this retry contract exists, while Rust adds explicit tests
for transient (429) retry behavior. This violates the requirement that cross-stack behavior changes
have mirrored tests in both TypeScript and Rust.
Code

pnpm11/resolving/git-resolver/src/parseBareSpecifier.ts[R144-149]

+    const response = await fetchWithDispatcher(httpsUrl.replace(/\.git$/, ''), {
+      method: 'HEAD',
+      redirect: 'manual',
+      retry: { retries: 2, factor: 2, minTimeout: 500, maxTimeout: 2_000 },
+      dispatcherOptions,
+    })
Relevance

●● Moderate

Repo values Rust/TS parity, but adding a TS assertion for retry options may be seen as over-specific
to implementation details.

PR-#13074
PR-#13132

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The rule requires mirrored tests for behavior changes across Rust and TypeScript. TypeScript changes
isRepoPublic to pass a specific retry policy to fetchWithDispatcher, while Rust adds tests that
assert retry behavior on transient statuses; the updated TypeScript tests in this PR cover HTTPS/SSH
fallback but do not assert the new retry policy/contract.

Rule 2255044: Cross-stack behavior changes must have mirrored tests in Rust and TypeScript
pnpm11/resolving/git-resolver/src/parseBareSpecifier.ts[136-149]
pnpm/crates/resolving-git-resolver/src/runners/tests.rs[35-57]
pnpm11/resolving/git-resolver/test/index.ts[540-563]

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

## Issue description
TypeScript changed the visibility probe to use fetch-layer retries (`retry: { retries: 2, ... }`), but there is no TypeScript test change in this PR that asserts this new retry contract, while Rust added coverage for retrying transient statuses (e.g. 429).

## Issue Context
This PR changes the same user-visible hosted-git resolution behavior in both TypeScript and Rust. Per compliance, behavior changes that exist in both stacks must have mirrored tests in both stacks so one side doesn’t silently drift/regress.

## Fix Focus Areas
- pnpm11/resolving/git-resolver/src/parseBareSpecifier.ts[144-149]
- pnpm11/resolving/git-resolver/test/index.ts[540-563]
- pnpm/crates/resolving-git-resolver/src/runners/tests.rs[35-57]

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


5. HEAD retries all errors 🐞 Bug ➹ Performance
Description
RealGitProbe::https_head_ok now retries (with backoff sleeps) even when the HEAD request fails
with a non-HTTP transport error (e.g. DNS/TLS/malformed URL), because Err(_) responses fall
through to the retry/sleep path. This can add avoidable per-dependency latency (at least 1.5s of
backoff plus request timeouts) in offline/misconfigured environments and makes install time more
sensitive to unreachable Git hosts.
Code

pnpm/crates/resolving-git-resolver/src/runners.rs[R52-75]

+            // Transient failures (429/5xx/network errors) are retried so
+            // host throttling of CI runners is not mistaken for a private
+            // repository. Mirrors the upstream fetch layer's retry policy
+            // (`retries: 2, factor: 2, minTimeout: 500, maxTimeout: 2000`).
+            let mut delay = std::time::Duration::from_millis(500);
+            for attempt in 0..3 {
+                let guard = self.http_client.acquire().await;
+                let response = guard.head(stripped).send().await;
+                drop(guard);
+                if let Ok(resp) = response {
+                    let status = resp.status();
+                    if status.is_success() {
+                        return true;
+                    }
+                    let transient = status.is_server_error()
+                        || matches!(status.as_u16(), 408 | 409 | 420 | 429);
+                    if !transient {
+                        return false;
+                    }
+                }
+                if attempt < 2 {
+                    tokio::time::sleep(delay).await;
+                    delay *= 2;
+                }
Relevance

●● Moderate

Retry semantics on transport errors are subjective; team cares about retryable vs non-retryable
classification but may keep simple retries.

PR-#12655

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The retry loop only checks transientness for HTTP status codes inside the Ok(resp) branch; any
request error (Err(_)) proceeds to tokio::time::sleep(delay) and retries, which directly causes
the extra latency on permanent transport failures.

pnpm/crates/resolving-git-resolver/src/runners.rs[45-78]

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

### Issue description
`https_head_ok()` retries and sleeps after **any** request error because only `Ok(resp)` is classified; `Err(err)` skips classification and still backs off. This causes unnecessary delays for permanent failures (DNS NXDOMAIN, TLS/cert errors, invalid URLs) and increases worst-case install time.

### Issue Context
The intent is to avoid mistaking CI throttling (429/5xx) for a private repo, but retrying all errors broadens the retry scope beyond “transient”.

### Fix Focus Areas
- pnpm/crates/resolving-git-resolver/src/runners.rs[45-78]

### How to fix
- Classify `Err(err)` and retry **only** for clearly transient transport errors (e.g. `err.is_timeout()`, `err.is_connect()`, possibly `err.is_request()` depending on how `ThrottledClient` wraps errors).
- For non-transient errors (TLS/cert, invalid URL, etc.), return `false` immediately (no backoff sleep).
- Optionally cap request-level timeouts for this probe (if not already configured via the client) so retries don’t multiply long timeouts.

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



Informational

6. Real-time sleeps in test 🐞 Bug ➹ Performance
Description
The new 429 retry test triggers the production backoff sleeps (500ms then 1s), adding ~1.5s of
wall-clock time to the unit test suite. This is avoidable by pausing Tokio time or injecting a
no-sleep backoff for tests.
Code

pnpm/crates/resolving-git-resolver/src/runners/tests.rs[R35-56]

+#[tokio::test]
+async fn head_probe_accepts_success_without_retrying() {
+    let mut server = mockito::Server::new_async().await;
+    let mock = server.mock("HEAD", "/foo/bar").with_status(200).expect(1).create_async().await;
+    assert!(real_probe().https_head_ok(&format!("{}/foo/bar.git", server.url())).await);
+    mock.assert_async().await;
+}
+
+#[tokio::test]
+async fn head_probe_does_not_retry_definitive_statuses() {
+    let mut server = mockito::Server::new_async().await;
+    let mock = server.mock("HEAD", "/foo/bar").with_status(404).expect(1).create_async().await;
+    assert!(!real_probe().https_head_ok(&format!("{}/foo/bar.git", server.url())).await);
+    mock.assert_async().await;
+}
+
+#[tokio::test]
+async fn head_probe_retries_transient_statuses_to_exhaustion() {
+    let mut server = mockito::Server::new_async().await;
+    let mock = server.mock("HEAD", "/foo/bar").with_status(429).expect(3).create_async().await;
+    assert!(!real_probe().https_head_ok(&format!("{}/foo/bar.git", server.url())).await);
+    mock.assert_async().await;
Relevance

●●● Strong

Avoiding real backoff sleeps in async tests is a common, low-risk improvement; likely accepted to
speed CI.

PR-#12655

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The implementation sleeps on retry, and the new test explicitly drives a 3-attempt 429 path, so it
will incur the two backoff sleeps.

pnpm/crates/resolving-git-resolver/src/runners.rs[52-75]
pnpm/crates/resolving-git-resolver/src/runners/tests.rs[31-57]

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 retry test exercises real backoff delays, which slows CI/test runs unnecessarily.

### Issue Context
`https_head_ok()` uses `tokio::time::sleep` for backoff. The mockito test that expects 3 HEADs on 429 will necessarily wait for the two sleeps.

### Fix Focus Areas
- pnpm/crates/resolving-git-resolver/src/runners/tests.rs[35-57]
- pnpm/crates/resolving-git-resolver/src/runners.rs[52-75]

### How to fix
- Prefer a paused clock for this test (e.g. `#[tokio::test(start_paused = true)]` / `tokio::time::pause()` + `advance()`), which requires enabling Tokio’s `test-util` feature for dev builds.
- Alternatively, refactor `https_head_ok()` to take an injectable sleeper/backoff strategy (production uses real sleep; tests use a no-op sleeper) so retry behavior is tested without wall-clock delay.

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


7. Unnecessary public Rust API ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
HostedGit.default_representation and the Representation enum were made fully pub, even though
the only new consumer shown is within the same crate. This expands API surface and makes future
refactors harder; pub(crate) or an internal accessor would satisfy the new call site without
exporting internals.
Code

pnpm/crates/resolving-git-resolver/src/hosted_git.rs[R94-101]

+    pub default_representation: Representation,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-enum Representation {
+pub enum Representation {
    Shortcut,
    Sshurl,
    Https,
Relevance

●●● Strong

Team often narrows Rust visibility to pub(crate) when only used internally.

PR-#13141

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The only diff-visible consumer of default_representation is the fallback check in
parse_bare_specifier.rs. The crate is not published, so there’s no need to expose these internals
beyond crate scope.

pnpm/crates/resolving-git-resolver/src/hosted_git.rs[82-105]
pnpm/crates/resolving-git-resolver/src/parse_bare_specifier.rs[289-303]
pnpm/crates/resolving-git-resolver/Cargo.toml[1-5]

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 PR makes `HostedGit.default_representation` and `Representation` public, but they’re only needed for an internal fallback decision.

### Issue Context
This crate is `publish = false`, so external semver isn’t impacted, but keeping internals crate-scoped reduces coupling and future maintenance risk.

### Fix Focus Areas
- pnpm/crates/resolving-git-resolver/src/hosted_git.rs[84-105]
- pnpm/crates/resolving-git-resolver/src/parse_bare_specifier.rs[289-303]
- pnpm/crates/resolving-git-resolver/Cargo.toml[1-5]

### Suggested fix
- Change `default_representation` and `Representation` to `pub(crate)` (or keep them private and add a `HostedGit::default_is_ssh()` helper).
- Update the fallback comparison in `parse_bare_specifier.rs` accordingly.

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


8. Brittle probe-order assertions ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
The new tests assert the full, ordered probe.calls sequence (including duplicated HTTPS HEAD
probes), which couples the test to internal implementation details and can cause test-only failures
during harmless refactors (e.g., changing probe ordering/retry strategy). The contract under test
here is primarily the resulting fetch_spec, so these strict sequence assertions add maintenance
friction without increasing behavioral coverage.
Code

pnpm/crates/resolving-git-resolver/src/parse_bare_specifier/tests.rs[R117-125]

+    assert_eq!(
+        probe.calls.lock().unwrap().as_slice(),
+        [
+            "head https://github.com/foo/private-repo.git",
+            "ls [email protected]:foo/private-repo.git",
+            "head https://github.com/foo/private-repo.git",
+            "ls https://github.com/foo/private-repo.git",
+            "head https://github.com/foo/private-repo",
+        ],
Relevance

●● Moderate

Team sometimes prefers asserting exact order in regression tests; probe-call order may be
intentionally locked down.

PR-#13463

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new tests pin the exact probe.calls array, including duplicate head https://... entries,
which directly reflects internal control-flow in from_hosted_git() and will break if probe
order/duplication changes even when fetch_spec remains the same.

pnpm/crates/resolving-git-resolver/src/parse_bare_specifier/tests.rs[111-146]
pnpm/crates/resolving-git-resolver/src/parse_bare_specifier.rs[221-286]

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 tests for "all probes fail" currently assert an exact list and order of probe calls. This locks in internal probing mechanics (including duplicate HEAD probes) and makes future changes to probing behavior fail tests even if the externally observable outcome (`fetch_spec`) remains correct.

### Issue Context
These tests are verifying fallback selection; the implementation in `from_hosted_git()` performs multiple probes and may evolve (e.g., reordering, deduping probes, adding caching, changing retry strategy). The tests should avoid asserting full call ordering unless that ordering is a deliberate, stable contract.

### Fix Focus Areas
- pnpm/crates/resolving-git-resolver/src/parse_bare_specifier/tests.rs[111-146]

### Suggested change
- Keep the `fetch_spec` assertions as the primary behavioral contract.
- Replace `assert_eq!(calls, [...])` with narrower assertions, e.g.:
 - assert that specific probes were attempted using `assert!(calls.contains(&"...".to_string()))`, or
 - assert only key invariants (like "at least one HTTPS HEAD happened" and "an SSH ls-remote probe happened") without ordering/duplication constraints.
- If call ordering is intentionally contractual, add a comment explaining why the order matters so future maintainers understand why it is pinned.

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


View more (1)
9. Private tarball fallback ✓ Resolved 🐞 Bug ☼ Reliability
Description
On the “all probes failed” path, the resolver now falls back to an HTTPS fetchSpec while still
returning hosted: Some(hosted), which makes later resolution choose a host tarball (archive) URL.
For private repos (or environments where archive endpoints are blocked), this can produce a tarball
URL that cannot be fetched even though git ls-remote/clone over HTTPS with credential helpers
could succeed.
Code

pnpm/crates/resolving-git-resolver/src/parse_bare_specifier.rs[R289-303]

+    // Final fallback: use SSH only when the user explicitly chose it. For
+    // shorthand specifiers like `github:owner/repo` the representation is
+    // `Shortcut`, and using SSH fails on CI runners that lack SSH keys even
+    // for public repos. Fall back to HTTPS for every other representation.
+    let fetch_spec = fetch_spec.unwrap_or_else(|| {
+        if hosted.default_representation == Representation::Sshurl {
+            hosted
+                .sshurl(HostedGit::no_committish())
+                .unwrap_or_else(|| hosted.shortcut(HostedOpts::default()))
+        } else {
+            hosted
+                .https(HostedGit::no_committish_no_git_plus())
+                .unwrap_or_else(|| hosted.shortcut(HostedOpts::default()))
+        }
+    });
Relevance

● Weak

Similar “avoid hosted tarball for private/credentialed HTTPS” change was explicitly rejected in git
resolver.

PR-#13160

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rust explicitly warns that a host archive URL “carries none of this URL's credentials” and therefore
private repos must not resolve to archives, but the new final fallback can still return `hosted:
Some(hosted) with an HTTPS fetchSpec, which pick_resolution()` converts into a tarball. The TS
resolver has the same behavior: any hosted non-SSH fetchSpec becomes a tarball resolution, and the
new fallback prefers HTTPS for non-sshurl defaults.

pnpm/crates/resolving-git-resolver/src/parse_bare_specifier.rs[246-274]
pnpm/crates/resolving-git-resolver/src/parse_bare_specifier.rs[289-313]
pnpm/crates/resolving-git-resolver/src/git_resolver.rs[258-272]
pnpm11/resolving/git-resolver/src/parseBareSpecifier.ts[83-136]
pnpm11/resolving/git-resolver/src/index.ts[61-71]

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 all hosted-git probes fail, the new fallback selects an HTTPS fetch spec but still returns hosted metadata, which causes `pick_resolution()` to emit a TarballResolution (archive URL). Archive URLs do not carry git credentials, so this can break private/credentialed installs when the archive endpoint requires auth or is blocked.

### Issue Context
Rust already documents why private repos must not resolve to host archives (archive URL lacks credentials), and has a dedicated private-HTTPS branch that returns `hosted: None` to force `type: git`. The new final fallback bypasses this guard.

### Fix Focus Areas
- pnpm/crates/resolving-git-resolver/src/parse_bare_specifier.rs[289-313]
- pnpm/crates/resolving-git-resolver/src/git_resolver.rs[258-279]
- pnpm11/resolving/git-resolver/src/parseBareSpecifier.ts[116-136]
- pnpm11/resolving/git-resolver/src/index.ts[61-79]

### Suggested fix
- When falling back due to *probe failure*, treat the repo as “archive unverified”: keep the HTTPS fetchSpec but return `hosted: None` (Rust) / `{ ...hosted, tarball: undefined }` (TS) so resolution becomes `type: git` over HTTPS instead of a tarball.
- (Optional, more robust) Add a second-chance behavior: if tarball fetch fails with auth/404, retry as `type: git` using the same HTTPS repo URL (requires plumbing an error-aware fallback in the resolver/fetch phase).

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


Grey Divider

Context used
✅ Compliance rules (platform): 18 rules

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

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 29063b7

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@zkochan zkochan changed the title Fix/git access ci GitHub deps fix(git-resolver): don't record SSH URLs for git deps that didn't ask for SSH Jul 30, 2026
@qodo-code-review

Copy link
Copy Markdown

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

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@zkochan
zkochan force-pushed the fix/git-access-ci-github-deps branch from 2633230 to d231976 Compare August 2, 2026 23:14
@qodo-code-review

Copy link
Copy Markdown

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

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

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

zkochan added a commit that referenced this pull request Aug 6, 2026
…not transport choices (#13684)

Hosted specs (github:/gitlab:/bitbucket: shortcuts and HTTPS/SSH URLs
of those hosts) now all resolve through the host's canonical HTTPS
URL. The lockfile records either the host archive tarball - only when
an anonymous HEAD of the exact archive URL succeeds, so a recorded
archive URL is fetchable by construction - or a git resolution over
the canonical HTTPS URL, which any machine with access to the repo can
fetch. SSH is never inferred: reaching a host over SSH is per-machine
git configuration (url.insteadOf), which pnpm honors by shelling out
to git.

This deletes the resolve-time transport probing (HTTP HEAD publicness
check plus https/ssh ls-remote reachability ladder) that could freeze
one machine's working transport into the lockfile and break every
environment configured differently - the #13276 bug class.
URLs of unknown hosts and URLs with embedded credentials keep their
exact URL and never resolve to a host archive.

parse_bare_specifier becomes fully synchronous and network-free; the
GitProbe seam shrinks to one method (anonymous_head_ok, with
transient-status retries) consumed by pick_resolution. Existing
lockfile entries are untouched - the new rules apply to fresh and
re-resolutions only, and both recorded shapes already exist in the
lockfile format.

Rust-only breaking change for the v12 lane; the TypeScript CLI stays
on the v11 probing behavior (fixed separately in #13290).

Related to #13276.
…t specs on CI

Two flaws let a transient probe failure record an SSH URL for a spec
that never asked for SSH: the visibility HEAD probe ran once with
retries disabled and treated any failure as private, and the SSH
ls-remote probe ran before the anonymous HTTPS one. On a machine with
SSH keys, a throttled HEAD request resolved a public repo to
git@host:..., breaking later installs on keyless CI runners with
Permission denied (publickey).

The resolver now retries transient HEAD failures, probes anonymous
HTTPS git access before SSH for every representation except explicit
SSH URLs, falls back to HTTPS when every probe fails, and records the
host-archive tarball only for repos proven public - otherwise the
resolution stays type: git so ambient credentials apply.

TypeScript CLI only: pacquet resolves this bug class structurally via
the v12 identity redesign (pnpm#13684), which supersedes the
Rust-side commits this PR previously carried.

Closes pnpm#13276.

Co-Authored-By: Claude Fable 5 <[email protected]>
@zkochan
zkochan force-pushed the fix/git-access-ci-github-deps branch from c8987f0 to 54835ae Compare August 6, 2026 20:44
@zkochan

zkochan commented Aug 6, 2026

Copy link
Copy Markdown
Member

Rebuilt this branch on top of the merged v12 identity redesign (pnpm/pnpm#13684): the pacquet commits this PR carried are superseded by that redesign, so the branch is now a single TypeScript-only commit (54835ae763) with the same TS diff as before, and the changeset no longer targets pacquet. TS test suite passes (77 passed, 12 pre-existing skips).


Written by an agent (Claude Code, claude-fable-5).

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 54835ae

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@zkochan
zkochan merged commit 8ae2e28 into pnpm:main Aug 6, 2026
3 checks passed
zkochan added a commit that referenced this pull request Aug 11, 2026
… how (#13794)

A specifier that does not ask for SSH resolves over HTTPS, because the URL
pnpm records is shared by every machine that installs the lockfile
(#13290). On a machine whose git cannot use that transport - a
container without the host's CA certificates, say - resolution then failed
with a raw execa dump: "Command failed with exit code 128: git ls-remote --
'https://github.com/...'" and a JS stack, naming neither the dependency nor
a way forward.

A failed ls-remote is now ERR_PNPM_GIT_RESOLVE_FAILED, naming the dependency
and redacting the credentials a URL git echoes back can carry. When the
resolution went over HTTPS, the error also says why, and points at git's own
url.<base>.insteadOf to substitute the transport on this machine only,
leaving the recorded URL alone. A missing git binary says so instead of
surfacing a bare spawn error.

The TypeScript resolver also stops probing anonymous HTTPS git access for a
repository the visibility probe already proved public: both outcomes of that
probe recorded the same resolution, so its only effect was an extra
ls-remote round-trip per git dependency. pacquet never probed.

Carrying the code and the remediation across pacquet's type-erased resolver
seam takes the mechanism resolver-base documents for exactly that: the
diagnostic is boxed outermost and recovered by downcast, in the tree walker
and in add.

Related to #13743.
@Ayush442842q
Ayush442842q deleted the fix/git-access-ci-github-deps branch August 22, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Git access issue on CI with github: dependencies

3 participants