Skip to content

fix(deploy): drop excluded optional edges from the deployed lockfile - #13641

Merged
zkochan merged 6 commits into
pnpm:mainfrom
harshmathurx:harsh/fix-deploy-no-optional-symlinks
Aug 11, 2026
Merged

zkochan merged 6 commits into
pnpm:mainfrom
harshmathurx:harsh/fix-deploy-no-optional-symlinks

Conversation

@harshmathurx

@harshmathurx harshmathurx commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

pnpm deploy --prod --no-optional prunes the excluded optional packages from the deploy graph, but leaves the optionalDependencies map on every snapshot it keeps. The deployed pnpm-lock.yaml then lists optional dependencies that the same lockfile never defines.

On the [email protected] repro from #13623 the deployed lockfile ends up with [email protected] declaring 25 @img/sharp-* optional dependencies while packages: and snapshots: contain only four entries. This PR clears those edges in both stacks, so the deployed lockfile is self-consistent.

Both implementations had the bug in the same place — prune_deploy_lockfile_graph in pacquet and filterDeployPackageSnapshots in the TypeScript CLI — and both are fixed here.

On the linked issue

This PR was opened as a fix for #13623, which reports dangling symlinks under the deployed virtual store. That symptom no longer reproduces on main, with or without this change: running the issue's [email protected] repro against a locally built binary, pnpm deploy --prod --no-optional yields zero dangling links in both builds. The issue was filed against 12.0.0-beta.4; the linking half appears to have been fixed elsewhere between then and 12.0.0-rc.3.

So this is deliberately linked as Related to rather than Fixes — it repairs the corrupt deployed lockfile, which is the part that is still reproducible. Someone should re-check #13623 against main and close it separately if it is already resolved.

Related to #13623

Squash Commit Body

Deploy prunes the optional packages that --no-optional excludes, but kept the
optionalDependencies map on each snapshot it retained. The deployed lockfile
then referenced packages it did not define: deploying a project that depends on
[email protected] produced a lockfile whose sharp snapshot listed 25 @img/sharp-*
optional dependencies against four defined entries.

Clear those edges after the reachability prune, in pacquet's
prune_deploy_lockfile_graph and in the TypeScript CLI's
filterDeployPackageSnapshots. The snapshots handed to the latter are built
fresh by convertPackageSnapshot / convertProjectSnapshotToPackageSnapshot and
shared with nothing, so they are edited in place rather than cloned.

Tests in both stacks assert that the default deploy keeps the optional edges
and that --no-optional drops them; without the first half, clearing the edges
in both modes would have passed.

Related to https://github.com/pnpm/pnpm/issues/13623 — that issue also reports
dangling symlinks in the deploy directory, which no longer reproduce on main
either way.

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

Tests

cargo nextest run -p pacquet-cli -E 'test(/^deploy::/)'
pnpm --filter @pnpm/releasing.commands test test/deploy
pnpm --filter pnpm run compile && pnpm --filter pnpm test test/deploy.ts

Each new assertion was checked against a deliberately broken implementation to confirm it fails without the fix.


Written by an agent (Jeeves / Hermes Agent, gpt-5.5); reviewed, extended to the TypeScript CLI, and corrected by an agent (Claude Code, claude-opus-5).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed production deployments with optional dependencies disabled to prevent dangling symlinks.
    • Ensured excluded optional packages and dependency links are fully removed from deployment lockfiles and virtual stores.
    • Preserved optional dependencies correctly when deployments include them.
  • Tests

    • Added coverage for deployments with and without optional dependencies.

@harshmathurx
harshmathurx requested a review from zkochan as a code owner August 4, 2026 12:48
@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 Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ce0f7701-bba7-4cdd-8bba-6cd852b34b64

📥 Commits

Reviewing files that changed from the base of the PR and between 4f9fe57 and 8819c01.

📒 Files selected for processing (4)
  • .changeset/deploy-no-optional-symlinks.md
  • pnpm/crates/cli/tests/suite/deploy.rs
  • pnpm11/pnpm/test/deploy.ts
  • pnpm11/releasing/commands/src/deploy/createDeployFiles.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • .changeset/deploy-no-optional-symlinks.md
  • pnpm11/releasing/commands/src/deploy/createDeployFiles.ts
  • pnpm/crates/cli/tests/suite/deploy.rs

📝 Walkthrough

Walkthrough

pnpm deploy --no-optional now removes optional dependency edges from retained lockfile snapshots in pnpm 12 and pnpm 11. Tests cover package, virtual-store, lockfile, and dependency-edge pruning. A changeset documents the fix.

Changes

Optional dependency deploy pruning

Layer / File(s) Summary
Prune optional snapshot metadata
pnpm/crates/cli/src/cli_args/deploy.rs, pnpm11/releasing/commands/src/deploy/createDeployFiles.ts
Both deploy paths clear optional dependency entries from retained snapshots when optional dependencies are disabled.
Validate deployment graphs
pnpm/crates/cli/tests/suite/deploy.rs, pnpm11/releasing/commands/test/deploy/createDeployFiles.test.ts, pnpm11/pnpm/test/deploy.ts
Tests verify optional package and edge retention by default, removal with --no-optional, and the absence of optional packages in the deployed virtual store and lockfile.
Document the release fix
.changeset/deploy-no-optional-symlinks.md
The changeset records patch releases for the affected packages.

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

Assessment against linked issues

Objective Addressed Explanation
Prevent dangling symlinks to optional packages during pnpm deploy --prod --no-optional [#13623] ✅

Possibly related PRs

  • pnpm/pnpm#13161: Related optional-dependency resolver and deployment graph handling.
  • pnpm/pnpm#13173: Related optional-edge filtering during deployment materialization.

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

Suggested reviewers: zkochan

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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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

❤️ Share

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

@greptile-apps

greptile-apps Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The PR appears safe to merge.

The previously reported coverage gap is resolved by asserting that node_modules/lib exists after the production deployment, while the same test separately verifies that optional packages and edges are removed; no blocking failure remains.

Reviews (4): Last reviewed commit: "test(deploy): pin the optional edges the..." | Re-trigger Greptile

Comment thread pnpm/crates/cli/tests/deploy.rs Resolved
@codecov-commenter

codecov-commenter commented Aug 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.24%. Comparing base (7bed697) to head (8819c01).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13641   +/-   ##
=======================================
  Coverage   88.23%   88.24%           
=======================================
  Files         624      624           
  Lines      101779   101812   +33     
=======================================
+ Hits        89809    89843   +34     
+ Misses      11970    11969    -1     

☔ 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 (2)
pnpm/crates/cli/src/cli_args/deploy.rs (1)

1011-1015: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider a short comment documenting the dangling-edge invariant.

This block has no inline comment explaining why optional_dependencies must be cleared before retain. The reason (a retained snapshot's own optional-edge map can reference a package already dropped from packages/snapshots when --no-optional is used) is not obvious from the code alone. A brief comment here documents the invariant without narrating the loop mechanics.

Proposed comment
     if let Some(snapshots) = lockfile.snapshots.as_mut() {
+        // Retained snapshots can still reference optional-only packages that were
+        // just dropped from `packages`/`snapshots`; clear the map so no dangling
+        // optional edge remains in the deployed lockfile.
         if !include_optional {
             for snapshot in snapshots.values_mut() {
                 snapshot.optional_dependencies = None;
             }
         }
🤖 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/cli/src/cli_args/deploy.rs` around lines 1011 - 1015, Add a brief
inline comment above the optional_dependencies clearing block in the deploy
argument-processing flow, documenting that --no-optional must remove optional
edges so retained snapshots cannot reference packages absent from packages or
snapshots. Keep the existing loop behavior unchanged.
pnpm/crates/cli/tests/deploy.rs (1)

179-193: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Prefer structured lockfile parsing over a raw string match for the pruned optional edge.

Line 189-193 checks for the pruned qar edge with a literal string match on YAML formatting ("optionalDependencies:\n '@pnpm.e2e/qar'"). This is fragile: any change to indentation, quoting style, or key ordering in the lockfile serializer breaks the check without necessarily indicating a real regression. deploy_graph_keys (Line 537-546) already shows the pattern for loading the lockfile through Lockfile::load_wanted_from_dir; use that to assert directly on the parsed snapshot's optional_dependencies field for lib instead of matching raw text.

Proposed refactor
-    let lockfile = fs::read_to_string(without_optional.join("pnpm-lock.yaml")).unwrap();
-    assert!(
-        !lockfile.contains("optionalDependencies:\n      '`@pnpm.e2e/qar`'"),
-        "retained production snapshots must not keep pruned optional edges:\n{lockfile}",
-    );
+    let deploy_lockfile = Lockfile::load_wanted_from_dir(&without_optional).unwrap().unwrap();
+    let retained_optional_edges: Vec<_> = deploy_lockfile
+        .snapshots
+        .iter()
+        .flatten()
+        .filter(|(_, snapshot)| snapshot.optional_dependencies.is_some())
+        .collect();
+    assert!(
+        retained_optional_edges.is_empty(),
+        "retained production snapshots must not keep pruned optional edges: {retained_optional_edges:?}",
+    );
🤖 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/cli/tests/deploy.rs` around lines 179 - 193, Replace the raw
pnpm-lock.yaml string check in the without_optional assertions with structured
parsing via Lockfile::load_wanted_from_dir, following the existing
deploy_graph_keys pattern. Locate the parsed lib snapshot and assert its
optional_dependencies field does not contain the pruned `@pnpm.e2e/qar` edge,
while preserving the existing graph and virtual-store assertions.
🤖 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/cli/src/cli_args/deploy.rs`:
- Around line 1011-1015: Add a brief inline comment above the
optional_dependencies clearing block in the deploy argument-processing flow,
documenting that --no-optional must remove optional edges so retained snapshots
cannot reference packages absent from packages or snapshots. Keep the existing
loop behavior unchanged.

In `@pnpm/crates/cli/tests/deploy.rs`:
- Around line 179-193: Replace the raw pnpm-lock.yaml string check in the
without_optional assertions with structured parsing via
Lockfile::load_wanted_from_dir, following the existing deploy_graph_keys
pattern. Locate the parsed lib snapshot and assert its optional_dependencies
field does not contain the pruned `@pnpm.e2e/qar` edge, while preserving the
existing graph and virtual-store assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 79d67c43-7a3a-48d5-9f61-6ba00189f693

📥 Commits

Reviewing files that changed from the base of the PR and between e719786 and 0ebbb96.

📒 Files selected for processing (3)
  • .changeset/deploy-no-optional-symlinks.md
  • pnpm/crates/cli/src/cli_args/deploy.rs
  • pnpm/crates/cli/tests/deploy.rs

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Commit: 8819c01fcb24

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.626 ± 0.154 2.388 2.798 1.68 ± 0.19
pacquet@main 2.511 ± 0.151 2.360 2.777 1.60 ± 0.19
pnpr@HEAD 1.593 ± 0.170 1.382 1.794 1.02 ± 0.15
pnpr@main 1.566 ± 0.155 1.378 1.803 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.62635602716,
      "stddev": 0.1537092650515119,
      "median": 2.64801952336,
      "user": 1.63454628,
      "system": 1.3554037199999998,
      "min": 2.38782759436,
      "max": 2.79811907836,
      "times": [
        2.58935208136,
        2.70668696536,
        2.3925842023599997,
        2.75374474936,
        2.74955257136,
        2.55054788536,
        2.77532021736,
        2.38782759436,
        2.79811907836,
        2.5598249263599997
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.51091394326,
      "stddev": 0.15099381248142543,
      "median": 2.46882950136,
      "user": 1.64442598,
      "system": 1.3145932200000001,
      "min": 2.36020991436,
      "max": 2.77700306836,
      "times": [
        2.4097721063599997,
        2.52339999436,
        2.56934339836,
        2.46794383736,
        2.77700306836,
        2.36560302336,
        2.40586813036,
        2.36020991436,
        2.76028079436,
        2.46971516536
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5928930287600003,
      "stddev": 0.1700371863244378,
      "median": 1.60506542736,
      "user": 1.13709068,
      "system": 1.18110812,
      "min": 1.3816036073600002,
      "max": 1.7939154193600002,
      "times": [
        1.5291760863600001,
        1.7939154193600002,
        1.3816036073600002,
        1.38351099136,
        1.7159209313600001,
        1.4890300893600001,
        1.78463147936,
        1.6809547683600001,
        1.41672429436,
        1.7534626203600001
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.5658127343600001,
      "stddev": 0.15458465181624145,
      "median": 1.5437471653600001,
      "user": 1.13417618,
      "system": 1.19870682,
      "min": 1.37796908936,
      "max": 1.8025434743600002,
      "times": [
        1.78504473836,
        1.52165144836,
        1.4032912543600002,
        1.52130999636,
        1.5737787333600002,
        1.8025434743600002,
        1.5658428823600001,
        1.7032815703600002,
        1.40341415636,
        1.37796908936
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 271.4 ± 12.4 256.9 293.9 1.04 ± 0.06
pacquet@main 261.8 ± 10.8 247.4 280.0 1.00
pnpr@HEAD 277.8 ± 9.2 264.5 290.9 1.06 ± 0.06
pnpr@main 283.3 ± 5.6 275.1 295.7 1.08 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.27139730034,
      "stddev": 0.012354330238771633,
      "median": 0.26929211224,
      "user": 0.23170805999999997,
      "system": 0.54715936,
      "min": 0.25689358924,
      "max": 0.29385489324,
      "times": [
        0.28229211824,
        0.28181311524,
        0.27831052824,
        0.26497122624,
        0.29385489324,
        0.25705791824,
        0.25689358924,
        0.26812453824,
        0.26019539024,
        0.27045968624
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.26180751164,
      "stddev": 0.010807370084379616,
      "median": 0.26285516574,
      "user": 0.22436266,
      "system": 0.5134236600000001,
      "min": 0.24737565824,
      "max": 0.28001819524,
      "times": [
        0.27353557124,
        0.26908107924,
        0.26538399424000003,
        0.25245830224,
        0.26035655324,
        0.25568311924,
        0.24737565824,
        0.24882886524,
        0.26535377824,
        0.28001819524
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.27778350774000005,
      "stddev": 0.00915797407543773,
      "median": 0.27723274274,
      "user": 0.23589756,
      "system": 0.53189496,
      "min": 0.26448315724,
      "max": 0.29088815324,
      "times": [
        0.27470799024000003,
        0.27055952424,
        0.29088815324,
        0.26448315724,
        0.27665955824,
        0.26725806524,
        0.27845660224,
        0.27780592724000003,
        0.28750624224,
        0.28950985724
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.28328869924,
      "stddev": 0.005580902759642259,
      "median": 0.28186526274,
      "user": 0.23947896000000002,
      "system": 0.55025766,
      "min": 0.27510084824000003,
      "max": 0.29571654824,
      "times": [
        0.27510084824000003,
        0.28180748424,
        0.27981387724,
        0.29571654824,
        0.28385671524,
        0.28022507224,
        0.28837324324,
        0.28192304124,
        0.28116387124000003,
        0.28490629124
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.662 ± 0.106 2.589 2.944 1.68 ± 0.16
pacquet@main 2.627 ± 0.020 2.596 2.663 1.65 ± 0.15
pnpr@HEAD 1.701 ± 0.164 1.445 1.963 1.07 ± 0.14
pnpr@main 1.588 ± 0.143 1.447 1.837 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.6623770350199996,
      "stddev": 0.10575974162125837,
      "median": 2.61942460852,
      "user": 1.72438344,
      "system": 1.4465321599999998,
      "min": 2.58948184502,
      "max": 2.9442581680199997,
      "times": [
        2.60628460202,
        2.58948184502,
        2.61437722902,
        2.6555751550199997,
        2.61430503302,
        2.62112166602,
        2.6177275510199998,
        2.63702723202,
        2.72361186902,
        2.9442581680199997
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.6265300735199997,
      "stddev": 0.02028670333447167,
      "median": 2.62684522302,
      "user": 1.56872444,
      "system": 1.3505653599999998,
      "min": 2.5961221160199996,
      "max": 2.66334271002,
      "times": [
        2.64255970402,
        2.66334271002,
        2.6169971040199997,
        2.63689337902,
        2.63606135202,
        2.63168249202,
        2.59814614802,
        2.62200795402,
        2.5961221160199996,
        2.62148777602
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.7007257235200002,
      "stddev": 0.16439146385514894,
      "median": 1.74916206402,
      "user": 1.1378190399999997,
      "system": 1.1962658599999998,
      "min": 1.4449055210200001,
      "max": 1.96326113902,
      "times": [
        1.8267946350200002,
        1.7481951820200001,
        1.5275716050200001,
        1.4449055210200001,
        1.75012894602,
        1.96326113902,
        1.7381733300200002,
        1.48025611302,
        1.7755972690200001,
        1.75237349502
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.58779127162,
      "stddev": 0.14268249265481273,
      "median": 1.5551298405200003,
      "user": 1.0705776400000002,
      "system": 1.1909982599999998,
      "min": 1.44685592102,
      "max": 1.8365675240200001,
      "times": [
        1.5089778950200001,
        1.47691733902,
        1.6266548680200001,
        1.7915317080200002,
        1.4618142760200001,
        1.67026216202,
        1.6012817860200002,
        1.8365675240200001,
        1.44685592102,
        1.45704923702
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 417.1 ± 15.5 396.1 448.6 1.35 ± 0.06
pacquet@main 415.2 ± 12.3 396.6 433.3 1.35 ± 0.05
pnpr@HEAD 308.6 ± 7.3 292.2 320.1 1.00
pnpr@main 311.3 ± 10.9 290.4 329.6 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.41707824518000003,
      "stddev": 0.01548632328081901,
      "median": 0.41575582778,
      "user": 0.53535546,
      "system": 0.70658358,
      "min": 0.39612561228,
      "max": 0.44859419828,
      "times": [
        0.39612561228,
        0.40232492228,
        0.42501960128,
        0.40856034928,
        0.42886118928,
        0.44859419828,
        0.41112261928,
        0.42432812928,
        0.40545679428,
        0.42038903628
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.41516596488,
      "stddev": 0.012335343622726149,
      "median": 0.41775720228,
      "user": 0.53907276,
      "system": 0.68879048,
      "min": 0.39663991128,
      "max": 0.43331238528,
      "times": [
        0.43052056528,
        0.41174209528,
        0.42063789528,
        0.42016773028,
        0.41543641528,
        0.42007798928,
        0.43331238528,
        0.40126744028,
        0.40185722128,
        0.39663991128
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.30862294438,
      "stddev": 0.00733216879963361,
      "median": 0.30976518127999997,
      "user": 0.21565646000000002,
      "system": 0.5322266800000001,
      "min": 0.29218419828,
      "max": 0.32011443028,
      "times": [
        0.30992158628,
        0.32011443028,
        0.31539310428,
        0.31004726328,
        0.30960877628,
        0.30480956428,
        0.30587541228,
        0.31118903428,
        0.30708607428,
        0.29218419828
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.31131026858,
      "stddev": 0.010901329337795827,
      "median": 0.30994599778,
      "user": 0.21681706000000003,
      "system": 0.5357696800000001,
      "min": 0.29036800528,
      "max": 0.32962063028,
      "times": [
        0.32088752628,
        0.31676958828,
        0.31265423628,
        0.30723775928,
        0.30680721828,
        0.29036800528,
        0.30459336727999997,
        0.30540394528,
        0.31876040928,
        0.32962063028
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.774 ± 0.081 1.723 1.985 5.83 ± 0.35
pacquet@main 1.729 ± 0.012 1.711 1.752 5.69 ± 0.22
pnpr@HEAD 0.308 ± 0.012 0.283 0.321 1.01 ± 0.06
pnpr@main 0.304 ± 0.012 0.284 0.321 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.77385096514,
      "stddev": 0.08107966306280023,
      "median": 1.7435925498399998,
      "user": 0.8518333199999999,
      "system": 0.83915042,
      "min": 1.7225051753399998,
      "max": 1.98494894234,
      "times": [
        1.7411996263399998,
        1.7283293683399998,
        1.7466320633399999,
        1.79678937334,
        1.98494894234,
        1.82046056234,
        1.72569014534,
        1.7225051753399998,
        1.7259689213399998,
        1.74598547334
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.72865046324,
      "stddev": 0.012115768869205805,
      "median": 1.72776945334,
      "user": 0.75804982,
      "system": 0.78931642,
      "min": 1.7111396613399998,
      "max": 1.7519395013399999,
      "times": [
        1.72593753234,
        1.7111396613399998,
        1.72582318634,
        1.71228009934,
        1.7519395013399999,
        1.72960137434,
        1.72284735034,
        1.73756979834,
        1.7337193543399998,
        1.73564677434
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3080195795400001,
      "stddev": 0.012114513022072932,
      "median": 0.31336720634000004,
      "user": 0.21112842,
      "system": 0.5265228200000001,
      "min": 0.28276932334000004,
      "max": 0.32120256434000005,
      "times": [
        0.30551709234,
        0.31478488234,
        0.28276932334000004,
        0.29529565334,
        0.29970158434000005,
        0.31533019034000004,
        0.32120256434000005,
        0.31793946634000003,
        0.31570550834000005,
        0.31194953034000006
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.30404893844,
      "stddev": 0.011768937270545617,
      "median": 0.30742197534000004,
      "user": 0.21318072,
      "system": 0.51618922,
      "min": 0.28373247834000004,
      "max": 0.32077468834000006,
      "times": [
        0.31074915934,
        0.30755719534000003,
        0.29173982334000004,
        0.29174005434000005,
        0.28373247834000004,
        0.31471328734000004,
        0.31163101134000004,
        0.32077468834000006,
        0.30728675534000005,
        0.30056493134
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 236.9 ± 29.8 201.9 305.0 2.61 ± 0.34
pacquet@main 247.0 ± 38.3 180.4 316.8 2.72 ± 0.43
pnpr@HEAD 91.7 ± 3.7 86.5 99.3 1.01 ± 0.05
pnpr@main 90.8 ± 2.4 85.4 96.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.23688165270333336,
      "stddev": 0.02979569493453565,
      "median": 0.23554457862,
      "user": 0.2129131533333333,
      "system": 0.06084942333333334,
      "min": 0.20187138912000002,
      "max": 0.30504891312000004,
      "times": [
        0.22985987912,
        0.21374168312,
        0.21047525912,
        0.22085762912,
        0.24709625112,
        0.26896884912,
        0.20187138912000002,
        0.20724711712000002,
        0.30504891312000004,
        0.24122927812,
        0.25408867512000005,
        0.24209490912
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.24704335419142862,
      "stddev": 0.0382695881032311,
      "median": 0.24751050712,
      "user": 0.20535353428571426,
      "system": 0.07129291142857143,
      "min": 0.18039860512,
      "max": 0.31684610812,
      "times": [
        0.20578713612000002,
        0.30934655012000006,
        0.25500422012,
        0.26363350712000005,
        0.31684610812,
        0.24855196512000002,
        0.26463907312000007,
        0.27142331312000006,
        0.23551241912,
        0.21383584912,
        0.20685261312,
        0.18039860512,
        0.24030655012000002,
        0.24646904912
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09169147549500001,
      "stddev": 0.0037286311262118774,
      "median": 0.09170143612000001,
      "user": 0.023185038749999994,
      "system": 0.010067568750000004,
      "min": 0.08650152512,
      "max": 0.09929381612,
      "times": [
        0.08743487312,
        0.09327297212,
        0.09251398212,
        0.09263854712,
        0.09003647412,
        0.09270598412,
        0.09696896512,
        0.09782470712,
        0.09027331112,
        0.08910560012,
        0.09863839212,
        0.09076447612,
        0.08650152512,
        0.08736983112,
        0.09101586012,
        0.08884222412000001,
        0.08696173212,
        0.08777526512,
        0.09738189312000001,
        0.08660388812,
        0.08724715012,
        0.08787421112,
        0.09418451912,
        0.09318660912,
        0.09296987212,
        0.09238701212,
        0.09424953112000001,
        0.09929381612,
        0.08941893112,
        0.09474980412,
        0.09392673412000001,
        0.09000852212
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.09084072555333332,
      "stddev": 0.002442069609098436,
      "median": 0.09100677762,
      "user": 0.023858719999999996,
      "system": 0.009322722666666668,
      "min": 0.08544271012,
      "max": 0.09618137112,
      "times": [
        0.09544044612000001,
        0.09107768612,
        0.08923752912,
        0.08982741012,
        0.08858153312,
        0.09215669912,
        0.09235770812,
        0.09241386412000001,
        0.09077064812,
        0.09204314512,
        0.09174832912,
        0.09059857412,
        0.08854581612,
        0.09272540112000001,
        0.09109316512,
        0.09093586912,
        0.09216610612000001,
        0.08544271012,
        0.08679687212000001,
        0.08696962712,
        0.08859904712,
        0.09261781812,
        0.09050751212000001,
        0.08936972812,
        0.08917719612,
        0.09470243512,
        0.09618137112,
        0.08915324112,
        0.09266571812,
        0.09131856012
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 787.7 ± 128.4 578.7 997.4 1.02 ± 0.30
pacquet@main 772.3 ± 188.2 637.6 1162.1 1.00
pnpm@HEAD 3162.8 ± 198.2 2926.4 3442.7 4.10 ± 1.03
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.7876936289066667,
      "stddev": 0.12837092217789262,
      "median": 0.8004537152400001,
      "user": 0.7508217444444445,
      "system": 0.12911178666666664,
      "min": 0.57865319824,
      "max": 0.9974027432400001,
      "times": [
        0.8895038432400001,
        0.57865319824,
        0.6361618132400001,
        0.9974027432400001,
        0.72162693724,
        0.8004537152400001,
        0.8373580822400001,
        0.8490208252400001,
        0.77906150224
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.7722648092400001,
      "stddev": 0.188211557595222,
      "median": 0.6731049642400001,
      "user": 0.7424164111111112,
      "system": 0.12001711999999998,
      "min": 0.63764731224,
      "max": 1.1620724862399998,
      "times": [
        0.6731049642400001,
        0.63764731224,
        1.1620724862399998,
        0.6615117622400001,
        0.65059663824,
        1.02008726924,
        0.7080145122400001,
        0.6680442082400001,
        0.7693041302400001
      ]
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.162841925128889,
      "stddev": 0.19815452968721603,
      "median": 3.18452420924,
      "user": 4.87026341111111,
      "system": 0.2832355644444444,
      "min": 2.92640260424,
      "max": 3.44265354824,
      "times": [
        2.9486367922400003,
        3.18452420924,
        2.92640260424,
        2.9372752972400002,
        3.44265354824,
        3.3992249392400002,
        3.3039927542400003,
        3.1027610782400004,
        3.22010610324
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.580 ± 0.168 4.432 4.897 1.29 ± 0.06
pacquet@main 4.563 ± 0.108 4.469 4.770 1.29 ± 0.04
pnpr@HEAD 3.545 ± 0.092 3.474 3.776 1.00 ± 0.03
pnpr@main 3.539 ± 0.081 3.455 3.685 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.57976693242,
      "stddev": 0.16792188541852457,
      "median": 4.5126471631200005,
      "user": 1.9639671799999998,
      "system": 1.46308076,
      "min": 4.431564871120001,
      "max": 4.89725285912,
      "times": [
        4.46810632612,
        4.89725285912,
        4.4739819261200005,
        4.530858059120001,
        4.87255276612,
        4.47739054412,
        4.431564871120001,
        4.49443626712,
        4.602690332120001,
        4.54883537312
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.56314823702,
      "stddev": 0.10797256287470336,
      "median": 4.51876771612,
      "user": 2.04587008,
      "system": 1.5509633600000001,
      "min": 4.469115475120001,
      "max": 4.7698418271200005,
      "times": [
        4.54714349512,
        4.7698418271200005,
        4.50519661912,
        4.59138168712,
        4.50535953612,
        4.471715883120001,
        4.49755792812,
        4.53217589612,
        4.469115475120001,
        4.74199402312
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.54531616762,
      "stddev": 0.09202951187330244,
      "median": 3.5061746451199998,
      "user": 1.3564079799999997,
      "system": 1.2868953600000002,
      "min": 3.47416486012,
      "max": 3.77601825412,
      "times": [
        3.50327578412,
        3.55896455812,
        3.77601825412,
        3.48337105412,
        3.47416486012,
        3.50907350612,
        3.6015332351200002,
        3.48557662012,
        3.48774486012,
        3.57343894412
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 3.5393804639199997,
      "stddev": 0.08080280495364371,
      "median": 3.50807862862,
      "user": 1.31842238,
      "system": 1.35724976,
      "min": 3.45452943512,
      "max": 3.68505295912,
      "times": [
        3.51737692612,
        3.45452943512,
        3.47133587712,
        3.47902755812,
        3.46738344112,
        3.58152724212,
        3.49878033112,
        3.62866603012,
        3.61012483912,
        3.68505295912
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13641
Testbedpacquet
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,589.48 ms
(-2.68%)Baseline: 2,660.73 ms
3,192.88 ms
(81.10%)
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
🚷 view threshold
1,722.51 ms
(-3.86%)Baseline: 1,791.74 ms
2,150.09 ms
(80.11%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
396.13 ms
(-11.30%)Baseline: 446.57 ms
535.88 ms
(73.92%)
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
🚷 view threshold
201.87 ms
(-10.98%)Baseline: 226.77 ms
272.12 ms
(74.18%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,387.83 ms
(-1.15%)Baseline: 2,415.68 ms
2,898.81 ms
(82.37%)
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
🚷 view threshold
4,431.56 ms
(-1.74%)Baseline: 4,509.84 ms
5,411.81 ms
(81.89%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
256.89 ms
(-10.41%)Baseline: 286.74 ms
344.09 ms
(74.66%)
isolated-linker.peer-heavy-resolve.hot-cache.offline📈 view plot
🚷 view threshold
578.65 ms
(-16.81%)Baseline: 695.57 ms
834.68 ms
(69.33%)
🐰 View full continuous benchmarking report in Bencher

harshmathurx and others added 4 commits August 11, 2026 01:33
Clear the optional edges after `retain`, so only snapshots the deploy
graph actually keeps are touched.

In the test, report which package leaked instead of collapsing three
patterns into one boolean, reusing the `for excluded in [...]` idiom the
rest of the file already uses, and parse the deploy lockfile once per
assertion group.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`filterDeployPackageSnapshots` already skips optional edges when walking
the graph for `--no-optional`, but returned the retained snapshots with
their `optionalDependencies` maps intact — pointing at packages it had
just dropped. Clear them, so the deployed lockfile cannot ask the linker
to create dangling links.

This is the TypeScript half of the same bug pacquet fixes in this PR;
the two stacks had it in the same place. Fixes
pnpm#13623 on both sides.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@zkochan
zkochan force-pushed the harsh/fix-deploy-no-optional-symlinks branch from 1dc626f to 4f9fe57 Compare August 10, 2026 23:48
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

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

Inline comments:
In `@pnpm/crates/cli/tests/suite/deploy.rs`:
- Around line 159-165: Extend the default deploy assertions after
deploy_graph_keys(&with_optional) to load the default deploy lockfile and
inspect the lib snapshot’s optionalDependencies, asserting it retains the
`@pnpm.e2e/qar` edge. Keep the existing graph reachability checks and mirror the
regression assertion in the corresponding TypeScript CLI coverage.

In `@pnpm11/releasing/commands/test/deploy/createDeployFiles.test.ts`:
- Around line 78-134: Extend the regression coverage around createDeployFiles to
execute the pnpm11 deploy scenario with optional dependencies excluded, rather
than only inspecting the generated lockfile. Assert that the optional package
and all of its transitive dependencies are absent from deployed node_modules and
the virtual store, while retaining the lockfile assertions and keeping
TypeScript behavior aligned with the user-visible deploy result.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d8203d12-c26f-435e-9d1a-9d61c72aa364

📥 Commits

Reviewing files that changed from the base of the PR and between 7bed697 and 4f9fe57.

📒 Files selected for processing (5)
  • .changeset/deploy-no-optional-symlinks.md
  • pnpm/crates/cli/src/cli_args/deploy.rs
  • pnpm/crates/cli/tests/suite/deploy.rs
  • pnpm11/releasing/commands/src/deploy/createDeployFiles.ts
  • pnpm11/releasing/commands/test/deploy/createDeployFiles.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • .changeset/deploy-no-optional-symlinks.md
  • pnpm/crates/cli/src/cli_args/deploy.rs

Comment thread pnpm/crates/cli/tests/suite/deploy.rs Resolved
@qodo-code-review

qodo-code-review Bot commented Aug 10, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Remediation recommended

1. Extra snapshot clones on deploy ✓ Resolved 🐞 Bug ➹ Performance
Description
In pnpm11 createDeployFiles, the --no-optional path now shallow-clones every retained package
snapshot via { ...snapshot } solely to clear optionalDependencies, adding avoidable per-package
allocations/GC pressure on large deploy graphs. This is unnecessary because createDeployFiles()
already builds a detached targetPackageSnapshots map containing newly-created snapshot objects.
Code

pnpm11/releasing/commands/src/deploy/createDeployFiles.ts[R218-221]

+      const snapshot = packages[depPath]
+      // A retained snapshot's optional edges point at packages this filter just dropped.
+      if (include.optionalDependencies) return [depPath, snapshot]
+      return [depPath, { ...snapshot, optionalDependencies: undefined }]
Relevance

●● Moderate

Low-risk micro-optimization, but perf/GC tweaks are sometimes debated without clear precedent in
this file.

PR-#13207
PR-#12777

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
createDeployFiles() constructs a fresh targetPackageSnapshots object and passes that into
filterDeployPackageSnapshots(), so the filter operates on derived snapshots rather than mutating
lockfile.packages. Additionally, convertPackageSnapshot() returns a new snapshot object via
object spread, so clearing the optionalDependencies field in-place avoids an extra per-snapshot
allocation without affecting the source lockfile.

pnpm11/releasing/commands/src/deploy/createDeployFiles.ts[73-134]
pnpm11/releasing/commands/src/deploy/createDeployFiles.ts[216-223]
pnpm11/releasing/commands/src/deploy/createDeployFiles.ts[264-269]

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

### Issue description
`filterDeployPackageSnapshots()` allocates a new object for every retained package snapshot when `include.optionalDependencies` is false:
```ts
return [depPath, { ...snapshot, optionalDependencies: undefined }]
```
This adds one extra shallow allocation per reachable package in deploy graphs.

### Issue Context
In this code path, `packages` is the local `targetPackageSnapshots` map created inside `createDeployFiles()`, and each snapshot entry is already a new object produced by `convertPackageSnapshot()`. Clearing the `optionalDependencies` field in-place on these derived snapshots won’t mutate the input lockfile.

### Fix Focus Areas
- pnpm11/releasing/commands/src/deploy/createDeployFiles.ts[73-134]
- pnpm11/releasing/commands/src/deploy/createDeployFiles.ts[216-223]
- pnpm11/releasing/commands/src/deploy/createDeployFiles.ts[264-269]

### Suggested change
When `include.optionalDependencies` is false, set `snapshot.optionalDependencies = undefined` on the already-detached snapshot object and return it, avoiding `{ ...snapshot }`. Optionally, only do this assignment when `snapshot.optionalDependencies != null` to avoid needless writes.

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


Grey Divider

Context
✅ Compliance rules (platform): 26 rules

Grey Divider

Tip of the day
💡 Did you know, you can group findings by type and pick your Finding display, from Minimal to Full

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

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.

zkochan and others added 2 commits August 11, 2026 02:35
…apshot

Every value in the map handed to `filterDeployPackageSnapshots` is built
fresh by `convertPackageSnapshot` / `convertProjectSnapshotToPackageSnapshot`
and shared with nothing, so the retained snapshots can be edited in place
instead of shallow-cloning one object per reachable package.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The no-optional assertions only proved the edges were gone; nothing proved
they were ever there, so clearing them in both modes would have passed.
Assert the default deploy keeps them, and give both stacks a dependency
shaped like the one from the report — a registry package whose optional
dependencies are platform-specific — plus a pnpm11 deploy integration test
matching pacquet's.

Correct the changeset: on current main the deploy install already skips the
optional edges at link time, in both stacks. Verified against the
`[email protected]` repro from
pnpm#13623 — the deploy directory has no
dangling links either way. What the retained edges do corrupt is the
deployed lockfile, which lists optional dependencies it does not define.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@greptile-apps
greptile-apps Bot dismissed their stale review August 11, 2026 00:37

Dismissed because a newer commit was pushed; Greptile will re-review the current head.

@qodo-code-review

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit 8819c01

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

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Projectpnpm's project
Branchpr/13641
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,444.91 ms
isolated-linker.fresh-install.cold-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
282.77 ms
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
292.18 ms
isolated-linker.fresh-resolve.hot-cache.offline📈 view plot
⚠️ NO THRESHOLD
86.50 ms
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
⚠️ NO THRESHOLD
1,381.60 ms
isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr📈 view plot
⚠️ NO THRESHOLD
3,474.16 ms
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
⚠️ NO THRESHOLD
264.48 ms
🐰 View full continuous benchmarking report in Bencher

@zkochan zkochan changed the title fix(pacquet): prune optional deploy snapshot edges fix(deploy): drop excluded optional edges from the deployed lockfile Aug 11, 2026
@zkochan
zkochan merged commit d25c634 into pnpm:main Aug 11, 2026
43 checks passed
@welcome

welcome Bot commented Aug 11, 2026

Copy link
Copy Markdown

Congrats on merging your first pull request! 🎉🎉🎉

zkochan added a commit that referenced this pull request Aug 22, 2026
#14069)

A shared-lockfile deploy prunes the package graph to the included dependency
groups but kept every direct dependency in the deployed package.json and in the
deployed lockfile's importer. The deployed lockfile therefore referenced
packages it did not define, and the next install in the deploy directory tripped
over that: pacquet linked the missing packages and left dangling symlinks, while
the TypeScript CLI refused the install with ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY.
A --prod deploy of a project whose dev workspace dependency no longer exists
pointed the importer at a missing directory the same way.

Fill only the included groups into the deploy importer, in pacquet's
create_deploy_files and in the TypeScript CLI's createDeployFiles, so the
manifest, the importer, and the package graph agree. The graph walk no longer
needs its own include gating for the importer maps; the snapshot-level optional
handling from #13641 stays as it is.

Also drop an emptied group from pacquet's deploy importer instead of writing it
as `{}` — the TypeScript lockfile writer omits an empty dependency map, so the
two stacks were producing different deploy lockfiles for the same input.

Resolve pacquet's --prod/--dev/--no-optional flags the way the TypeScript CLI
does: --prod wins over --dev, and a dev-only install drops optional dependencies
along with the production ones. Without it `pnpm install --dev` installed an
optional dependency pnpm skips, and the deploy change above would have carried
that divergence into `pnpm deploy --dev`'s manifest and lockfile.

Closes #13623
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