Skip to content

fix(deploy): write deployed dependencies and allowBuilds sorted by name - #16692

Merged
zkochan merged 2 commits into
mainfrom
fix-16687
Oct 7, 2026
Merged

zkochan merged 2 commits into
mainfrom
fix-16687

Conversation

@zkochan

@zkochan zkochan commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Summary

pnpm deploy (shared-lockfile path) wrote the dependency groups of the deployed package.json in a random order on every run, because it iterated the lockfile importer's HashMap. The allowBuilds map in the deployed pnpm-workspace.yaml had the same problem. Both are now sorted by name, which matches what pnpm v11 writes (the lockfile importer order).

v11 is not affected (the issue reports 11.28.2 as stable), so this fixes v12 only.

Closes #16687

Squash Commit Body

The shared-lockfile deploy built the deployed package.json dependency
groups by iterating the lockfile importer's HashMap, and serialized
allowBuilds into the deployed pnpm-workspace.yaml from a HashMap, so
both came out in a different order on every run. Sort both by name,
which matches the lockfile importer order that v11 writes.

Closes pnpm/pnpm#16687

Checklist

  • I checked the referenced issue and verified that none of the PRs
    already linked to it solves it.
  • New features are implemented only in the Rust pnpm v12 CLI. Bug fixes
    are implemented in every affected version.
  • 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.

The new test deploy::deploy_writes_dependencies_and_allow_builds_sorted_by_name fails without each half of the fix (verified separately for package.json and allowBuilds).

🤖 Generated with Claude Code


Written by an agent (Claude Code, claude-opus-5-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
    • Production deployments now list package dependencies in alphabetical order in the deployed manifest.
    • Workspace allowBuilds entries are also sorted alphabetically in the deployed workspace configuration.
    • These consistent ordering rules ensure repeated deployments from the same lockfile produce identical files, making deployment output more predictable and easier to compare.

The shared-lockfile deploy built the deployed package.json dependency
groups by iterating the lockfile importer's HashMap, and serialized
allowBuilds into the deployed pnpm-workspace.yaml from a HashMap, so
both came out in a different order on every run. Sort both by name,
which matches the lockfile importer order that v11 writes.

Closes #16687

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: pnpm/pnpm/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b939ec23-df91-4e8d-9778-63f62fa4164e
📥 Commits

Reviewing files that changed from the base of the PR and between d7c171f and e5666f7.

📒 Files selected for processing (1)
  • .changeset/deploy-sorted-dependencies.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/deploy-sorted-dependencies.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Deploy now sorts dependency entries and workspace allowBuilds entries by name. A new test checks both outputs after a production deploy.

Changes

Deploy manifest ordering

Layer / File(s) Summary
Sort deployed manifest entries
pnpm/crates/cli/src/cli_args/deploy/lockfile.rs, pnpm/crates/cli/src/cli_args/deploy/workspace_manifest.rs, pnpm/crates/cli/tests/suite/deploy.rs, .changeset/deploy-sorted-dependencies.md
Dependency name/specifier pairs are sorted before building the deployed manifest map. The workspace manifest serializes allowBuilds through a BTreeMap. The deploy test checks that both outputs use alphabetical order. The changeset records the patch.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Assessment against linked issues

Objective Addressed Explanation
Produce stable dependency ordering across repeated deploys [#16687] ✅
Keep deployed dependencies in the same order as the source package.json [#16687] ❌ The implementation sorts entries alphabetically instead of preserving source order.

Out-of-scope changes

Code Change Explanation
Sort deployed workspace allowBuilds entries through a BTreeMap (pnpm/crates/cli/src/cli_args/deploy/workspace_manifest.rs:80-81) Issue #16687 concerns dependency ordering in the deployed package.json and does not specify workspace allowBuilds ordering.

Suggested labels: product: pacquet

Merge Risk: ⚪ Minimal · up to e5666

No actionable issue is established for the reviewed change; it is mergeable after normal checks.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@codecov-commenter

codecov-commenter commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.37%. Comparing base (ed6e822) to head (e5666f7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16692   +/-   ##
=======================================
  Coverage   92.36%   92.37%           
=======================================
  Files        1594     1594           
  Lines      210433   210436    +3     
=======================================
+ Hits       194368   194382   +14     
+ Misses      16065    16054   -11     

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

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

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.02     12.1±0.94ms    30.9 MB/sec    1.00     11.9±0.65ms    31.3 MB/sec
packument/parse                                  1.00     38.6±0.35µs  1716.9 MB/sec    1.07     41.3±0.61µs  1607.5 MB/sec
tarball/download_dependency                      1.00      3.2±0.06ms  1360.6 KB/sec    1.12      3.6±0.21ms  1213.0 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.07   212.6±40.55ms 75.3 KElem/sec    1.00    198.9±7.18ms 80.4 KElem/sec
version_pick/repeated_ranges_file                1.00      4.3±0.04ms  7.2 KElem/sec    1.00      4.3±0.05ms  7.2 KElem/sec
version_pick/repeated_ranges_raw                 1.00      4.2±0.04ms  7.5 KElem/sec    1.00      4.2±0.08ms  7.5 KElem/sec
workspace_resolution/hoist_heavy                 1.00   223.2±12.44ms        ? ?/sec    1.08   240.9±24.00ms        ? ?/sec
workspace_sort/chained_projects                  1.04     12.7±1.09ms        ? ?/sec    1.00     12.3±0.82ms        ? ?/sec

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Same-run regression check

HEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval.

Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.

Scenario Engine main median HEAD median Change Tolerance Result
isolated-fresh-restore-cold-cache-cold-store pacquet 2407.70 ms 2440.64 ms 1.4% 120.38 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1384.43 ms 1433.60 ms 3.6% 69.22 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 302.66 ms 303.27 ms 0.2% 15.13 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 324.53 ms 312.84 ms -3.6% 16.23 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 10.17 ms 10.71 ms 5.4% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 11.47 ms 11.20 ms -2.3% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 9.77 ms 12.24 ms 25.3% 2.00 ms Inconclusive (overlapping samples)
isolated-repeat-install-cold-cache-hot-store pnpr 9.55 ms 9.45 ms -1.0% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 2596.46 ms 2603.62 ms 0.3% 129.82 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1634.47 ms 1483.60 ms -9.2% 81.72 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 539.61 ms 513.37 ms -4.9% 26.98 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 305.58 ms 311.52 ms 1.9% 15.28 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1720.82 ms 1867.08 ms 8.5% 86.04 ms Inconclusive (overlapping samples)
isolated-fresh-install-cold-cache-hot-store pnpr 371.06 ms 329.34 ms -11.2% 18.55 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 228.96 ms 232.39 ms 1.5% 11.45 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pnpr 96.27 ms 95.45 ms -0.9% 4.81 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 265.31 ms 296.67 ms 11.8% 13.27 ms Inconclusive (overlapping samples)
isolated-linked-workspace-resolve-hot-cache-offline pacquet 242.55 ms 243.62 ms 0.4% 12.13 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4547.79 ms 4480.10 ms -1.5% 227.39 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3596.36 ms 3579.16 ms -0.5% 179.82 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 150.65 ms 148.24 ms -1.6% 7.53 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 166.59 ms 175.94 ms 5.6% 8.33 ms Inconclusive (overlapping samples)

Integrated-Benchmark Report (Linux)

Commit: e5666f786ac4

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

The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs.

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.451 ± 0.139 2.293 2.628 1.68 ± 0.19
pacquet@main 2.454 ± 0.132 2.320 2.641 1.68 ± 0.19
pnpr@HEAD 1.481 ± 0.156 1.313 1.706 1.02 ± 0.15
pnpr@main 1.457 ± 0.145 1.327 1.714 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.4509392075000003,
      "stddev": 0.13885254991635024,
      "median": 2.4406442082,
      "user": 1.48618754,
      "system": 1.4509018,
      "min": 2.2929202032,
      "max": 2.6276834482
    },
    {
      "command": "pacquet@main",
      "mean": 2.4539916295999995,
      "stddev": 0.1320283949130851,
      "median": 2.4076979002000005,
      "user": 1.4772597399999996,
      "system": 1.5024283,
      "min": 2.3200168602,
      "max": 2.6409630782000004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.4811015872,
      "stddev": 0.1561430983827592,
      "median": 1.4336016462,
      "user": 1.42531064,
      "system": 1.405562,
      "min": 1.3134612371999999,
      "max": 1.7061547341999999
    },
    {
      "command": "pnpr@main",
      "mean": 1.4573602797,
      "stddev": 0.1445113053514988,
      "median": 1.3844311277,
      "user": 1.48826464,
      "system": 1.4618677999999998,
      "min": 1.3272401822,
      "max": 1.7135763762
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 306.6 ± 11.1 289.6 324.9 1.00 ± 0.06
pacquet@main 306.1 ± 15.9 289.6 345.2 1.00
pnpr@HEAD 316.1 ± 7.9 308.4 328.4 1.03 ± 0.06
pnpr@main 324.8 ± 10.9 308.3 346.4 1.06 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.30662228682000003,
      "stddev": 0.01105908677192346,
      "median": 0.30327462162,
      "user": 0.35327812000000003,
      "system": 0.79204962,
      "min": 0.28956823462000003,
      "max": 0.32490524962
    },
    {
      "command": "pacquet@main",
      "mean": 0.30608511892,
      "stddev": 0.01586772790308013,
      "median": 0.30265545062,
      "user": 0.35240452,
      "system": 0.7947544200000001,
      "min": 0.28963267462000003,
      "max": 0.34520649462
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.31613919352,
      "stddev": 0.007875964802522813,
      "median": 0.31284475812,
      "user": 0.35693902000000005,
      "system": 0.78473422,
      "min": 0.30835388662,
      "max": 0.32835738062000003
    },
    {
      "command": "pnpr@main",
      "mean": 0.32478897872000007,
      "stddev": 0.010909035501269574,
      "median": 0.32453232112,
      "user": 0.3585785200000001,
      "system": 0.7813808200000001,
      "min": 0.30832195762000003,
      "max": 0.34640277562
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 10.8 ± 1.1 8.1 14.5 1.04 ± 0.14
pacquet@main 10.4 ± 0.9 8.4 14.0 1.00
pnpr@HEAD 11.3 ± 1.0 9.1 15.1 1.09 ± 0.14
pnpr@main 11.4 ± 1.6 7.8 15.6 1.10 ± 0.18
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.010808642983107573,
      "stddev": 0.0011120871343067963,
      "median": 0.01071446576,
      "user": 0.006540505816733065,
      "system": 0.005362589482071714,
      "min": 0.00814265276,
      "max": 0.01448463076
    },
    {
      "command": "pacquet@main",
      "mean": 0.010360958349211618,
      "stddev": 0.0009381563988061645,
      "median": 0.010168925760000001,
      "user": 0.00603179817427386,
      "system": 0.005185733112033195,
      "min": 0.00837107276,
      "max": 0.014022150760000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.011316745710704222,
      "stddev": 0.0010245284031888202,
      "median": 0.01119966126,
      "user": 0.00634296704225352,
      "system": 0.00610875464788732,
      "min": 0.00906492276,
      "max": 0.015129312760000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.01141429664582677,
      "stddev": 0.0015808917034881528,
      "median": 0.011468686260000001,
      "user": 0.006293743464566928,
      "system": 0.006148864566929134,
      "min": 0.007825181760000001,
      "max": 0.015571613760000002
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 14.2 ± 4.4 8.8 26.3 1.50 ± 0.46
pacquet@main 10.1 ± 1.2 8.7 15.0 1.07 ± 0.14
pnpr@HEAD 9.5 ± 0.5 8.5 12.5 1.00
pnpr@main 9.6 ± 0.6 8.4 13.1 1.01 ± 0.09
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.014214822434803142,
      "stddev": 0.0043509397716332,
      "median": 0.012239982860000002,
      "user": 0.007871166456692915,
      "system": 0.007956056692913386,
      "min": 0.008812773860000001,
      "max": 0.02632826886
    },
    {
      "command": "pacquet@main",
      "mean": 0.010129444789515418,
      "stddev": 0.0011820684851180526,
      "median": 0.00976937486,
      "user": 0.005244797973568289,
      "system": 0.006168634361233479,
      "min": 0.00874996486,
      "max": 0.015030302860000002
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.009502116826666669,
      "stddev": 0.0004938745863494023,
      "median": 0.009447410360000002,
      "user": 0.005157810476190475,
      "system": 0.005610937142857141,
      "min": 0.008491044860000001,
      "max": 0.012450842860000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.00962231550285714,
      "stddev": 0.0006440537224585147,
      "median": 0.009546184860000001,
      "user": 0.005246975462184873,
      "system": 0.005595352100840337,
      "min": 0.008425884860000002,
      "max": 0.013059992860000001
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.613 ± 0.049 2.568 2.703 1.71 ± 0.15
pacquet@main 2.601 ± 0.027 2.568 2.659 1.70 ± 0.15
pnpr@HEAD 1.530 ± 0.132 1.422 1.792 1.00
pnpr@main 1.643 ± 0.132 1.447 1.834 1.07 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.61316660368,
      "stddev": 0.048656615500917884,
      "median": 2.60362406268,
      "user": 2.2978602599999993,
      "system": 1.7802782799999999,
      "min": 2.56788825568,
      "max": 2.70266909268
    },
    {
      "command": "pacquet@main",
      "mean": 2.6013375553799998,
      "stddev": 0.027211725831609992,
      "median": 2.59645882418,
      "user": 2.1878319600000005,
      "system": 1.7750618799999998,
      "min": 2.56769613468,
      "max": 2.65869039168
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.5298904154800002,
      "stddev": 0.1324642961262148,
      "median": 1.48360382068,
      "user": 1.32702776,
      "system": 1.3924787799999998,
      "min": 1.42184876168,
      "max": 1.79215878968
    },
    {
      "command": "pnpr@main",
      "mean": 1.6427369531800005,
      "stddev": 0.1322244793656166,
      "median": 1.6344661296800003,
      "user": 1.3600428599999996,
      "system": 1.4592050799999998,
      "min": 1.44660683368,
      "max": 1.8340634146800001
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 509.9 ± 32.8 459.4 576.9 1.64 ± 0.13
pacquet@main 608.3 ± 126.6 476.7 792.6 1.96 ± 0.42
pnpr@HEAD 315.1 ± 11.0 301.7 335.5 1.01 ± 0.06
pnpr@main 311.1 ± 13.4 289.1 329.4 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.5098526639800001,
      "stddev": 0.03275455624457949,
      "median": 0.51337242498,
      "user": 0.69532802,
      "system": 0.78138626,
      "min": 0.45944941698,
      "max": 0.57687108398
    },
    {
      "command": "pacquet@main",
      "mean": 0.60831162008,
      "stddev": 0.12663190273604372,
      "median": 0.53960817398,
      "user": 0.8529653199999998,
      "system": 0.9614474600000001,
      "min": 0.47668163298000005,
      "max": 0.79261459298
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.31509570918,
      "stddev": 0.01095671124621926,
      "median": 0.31151697248000004,
      "user": 0.28519552000000004,
      "system": 0.59962946,
      "min": 0.30169550898,
      "max": 0.33550089198000005
    },
    {
      "command": "pnpr@main",
      "mean": 0.3111041072800001,
      "stddev": 0.013382756581399424,
      "median": 0.30558127648000005,
      "user": 0.27291032000000004,
      "system": 0.60757646,
      "min": 0.28908121598000003,
      "max": 0.32941973798
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.857 ± 0.094 1.733 2.004 5.50 ± 0.66
pacquet@main 1.735 ± 0.066 1.683 1.912 5.13 ± 0.59
pnpr@HEAD 0.338 ± 0.037 0.292 0.393 1.00
pnpr@main 0.374 ± 0.032 0.317 0.433 1.11 ± 0.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.8570642892600002,
      "stddev": 0.09380159652282476,
      "median": 1.86707769186,
      "user": 1.38660828,
      "system": 1.1126680800000002,
      "min": 1.73285846086,
      "max": 2.00437093886
    },
    {
      "command": "pacquet@main",
      "mean": 1.73454196936,
      "stddev": 0.06570215834305071,
      "median": 1.72082247636,
      "user": 1.10760758,
      "system": 0.93384078,
      "min": 1.68275720286,
      "max": 1.91228597086
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3377961984600001,
      "stddev": 0.0369628429044589,
      "median": 0.32933857636,
      "user": 0.30232858,
      "system": 0.63514598,
      "min": 0.29174416286000004,
      "max": 0.39317577986
    },
    {
      "command": "pnpr@main",
      "mean": 0.37364753856,
      "stddev": 0.03170003233883271,
      "median": 0.37106447136000004,
      "user": 0.33111697999999995,
      "system": 0.6939165800000001,
      "min": 0.31684317386000005,
      "max": 0.43298381986000006
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 235.1 ± 13.8 214.3 260.1 2.47 ± 0.16
pacquet@main 230.4 ± 15.9 202.5 258.9 2.42 ± 0.18
pnpr@HEAD 95.2 ± 2.3 91.2 100.3 1.00
pnpr@main 95.7 ± 2.9 91.3 102.9 1.01 ± 0.04
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.23505411022333336,
      "stddev": 0.01378733131442717,
      "median": 0.23239134964000002,
      "user": 0.20884748333333333,
      "system": 0.09177243333333333,
      "min": 0.21426786314000001,
      "max": 0.26008962014000003
    },
    {
      "command": "pacquet@main",
      "mean": 0.23036717167846146,
      "stddev": 0.01585513288255523,
      "median": 0.22896319414000002,
      "user": 0.22436016923076924,
      "system": 0.06679713846153845,
      "min": 0.20251014514000001,
      "max": 0.25892310714
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.09519376634689655,
      "stddev": 0.0023388666529607326,
      "median": 0.09545265614,
      "user": 0.03565643448275862,
      "system": 0.015797110344827586,
      "min": 0.09121827514,
      "max": 0.10028610514
    },
    {
      "command": "pnpr@main",
      "mean": 0.0956740723124138,
      "stddev": 0.0028555182405453133,
      "median": 0.09627135514,
      "user": 0.035862055172413795,
      "system": 0.0158453724137931,
      "min": 0.09129677214,
      "max": 0.10294796814
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 306.3 ± 33.3 270.2 367.6 1.15 ± 0.16
pacquet@main 265.9 ± 22.5 236.8 297.7 1.00
pnpm@HEAD 3651.3 ± 150.0 3444.6 3904.2 13.73 ± 1.29
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.30626020605111115,
      "stddev": 0.0333200586671965,
      "median": 0.29666815194,
      "user": 0.31389798222222215,
      "system": 0.08437405555555556,
      "min": 0.27016960194,
      "max": 0.36761946894
    },
    {
      "command": "pacquet@main",
      "mean": 0.2659148452733333,
      "stddev": 0.022528886601171562,
      "median": 0.26531196994,
      "user": 0.2697683155555555,
      "system": 0.08191794444444445,
      "min": 0.23679952094,
      "max": 0.29774827494
    },
    {
      "command": "pnpm@HEAD",
      "mean": 3.651324543717778,
      "stddev": 0.14996629363721817,
      "median": 3.65546182294,
      "user": 5.2378163155555555,
      "system": 0.45340005555555546,
      "min": 3.44463260294,
      "max": 3.9041719189400004
    }
  ]
}

Scenario: Isolated linker: linked-workspace resolve, hot cache, offline

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 245.3 ± 20.1 225.5 302.3 1.01 ± 0.09
pacquet@main 241.9 ± 9.2 228.7 258.6 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.24530189820000003,
      "stddev": 0.02012167046517878,
      "median": 0.2436151112,
      "user": 0.19719235384615383,
      "system": 0.1012332476923077,
      "min": 0.2255145262,
      "max": 0.3023415802
    },
    {
      "command": "pacquet@main",
      "mean": 0.24187131753333335,
      "stddev": 0.009209934781580205,
      "median": 0.2425459292,
      "user": 0.19946328333333332,
      "system": 0.09782910666666667,
      "min": 0.22870620020000001,
      "max": 0.2585700122
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.517 ± 0.116 4.418 4.768 1.26 ± 0.05
pacquet@main 4.544 ± 0.115 4.410 4.674 1.27 ± 0.05
pnpr@HEAD 3.582 ± 0.100 3.477 3.831 1.00
pnpr@main 3.622 ± 0.129 3.475 3.833 1.01 ± 0.05
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.517063501120001,
      "stddev": 0.11636852526371315,
      "median": 4.4800991021200005,
      "user": 1.71971006,
      "system": 1.6789012199999997,
      "min": 4.41817041162,
      "max": 4.76814051262
    },
    {
      "command": "pacquet@main",
      "mean": 4.54440614862,
      "stddev": 0.11518238729604485,
      "median": 4.54779080412,
      "user": 1.7036270599999999,
      "system": 1.6287059199999998,
      "min": 4.41004384762,
      "max": 4.67378901862
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.58187241802,
      "stddev": 0.10001959778928154,
      "median": 3.57915889062,
      "user": 1.62646736,
      "system": 1.6262521199999997,
      "min": 3.4767319156200003,
      "max": 3.83083454362
    },
    {
      "command": "pnpr@main",
      "mean": 3.62225651132,
      "stddev": 0.1290752592205304,
      "median": 3.59635920262,
      "user": 1.59436836,
      "system": 1.5837108199999999,
      "min": 3.47543475962,
      "max": 3.83339182862
    }
  ]
}

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

Same install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 150.6 ± 6.5 143.6 167.9 1.00
pacquet@main 154.4 ± 11.0 140.3 177.8 1.03 ± 0.09
pnpr@HEAD 176.2 ± 17.5 142.3 209.1 1.17 ± 0.13
pnpr@main 168.1 ± 22.5 133.7 218.0 1.12 ± 0.16
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.15055747322235294,
      "stddev": 0.006541216964083143,
      "median": 0.14824394934,
      "user": 0.1859524670588235,
      "system": 0.14175005999999998,
      "min": 0.14362923234,
      "max": 0.16786477234
    },
    {
      "command": "pacquet@main",
      "mean": 0.15442323216352943,
      "stddev": 0.011034036536759561,
      "median": 0.15064545534,
      "user": 0.18657993764705885,
      "system": 0.15236076588235295,
      "min": 0.14034002834,
      "max": 0.17781204634
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.17623997312571427,
      "stddev": 0.017502465177800384,
      "median": 0.17593673034,
      "user": 0.21364596285714282,
      "system": 0.1472788457142857,
      "min": 0.14232495134,
      "max": 0.20914101234000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.1681153782685714,
      "stddev": 0.022487000541292428,
      "median": 0.16659347784,
      "user": 0.2002308914285714,
      "system": 0.14924977428571426,
      "min": 0.13371500134,
      "max": 0.21801881634
    }
  ]
}

@zkochan
zkochan marked this pull request as ready for review October 7, 2026 10:25
Copilot AI balanced review requested due to automatic review settings October 7, 2026 10:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Fix nondeterministic ordering in deployed manifests

🐞 Bug fix 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Sort deployed dependency groups and allowBuilds by name so repeated shared-lockfile deploys
 produce consistent files.
• Add regression coverage for both outputs and a pacquet patch changeset.
Diagram

graph TD
  A["Lockfile importer"] --> B["Sort dependency names"] --> C["Deployed package.json"]
  D["Build permissions"] --> E["Order allowBuilds"] --> F["Deployed workspace YAML"]
Loading
High-Level Assessment

Sorting at the deploy serialization boundaries addresses both unstable outputs without changing the shared lockfile or configuration map types. Changing those types globally would broaden the impact of a deploy-specific fix.

Files changed (4) +81 / -3

Bug fix (2) +7 / -3
lockfile.rsSort deployed dependency groups by name +4/-2

Sort deployed dependency groups by name

• Sorts entries from each resolved dependency map before adding them to the deployed package.json. This prevents importer HashMap iteration order from affecting dependency group order.

pnpm/crates/cli/src/cli_args/deploy/lockfile.rs

workspace_manifest.rsOrder deployed allowBuilds entries +3/-1

Order deployed allowBuilds entries

• Serializes allowBuilds through a BTreeMap so its entries appear in name order in the deployed pnpm-workspace.yaml. The deploy install configuration retains the existing map.

pnpm/crates/cli/src/cli_args/deploy/workspace_manifest.rs

Tests (1) +69 / -0
deploy.rsCover ordering in both deployed manifests +69/-0

Cover ordering in both deployed manifests

• Adds a shared-lockfile production deploy test with multiple workspace dependencies and allowBuilds entries. It checks that both deployed files expose names in sorted order.

pnpm/crates/cli/tests/suite/deploy.rs

Documentation (1) +5 / -0
deploy-sorted-dependencies.mdDocument deterministic deploy output +5/-0

Document deterministic deploy output

• Adds a pacquet patch changeset announcing name-ordered dependencies and allowBuilds in deployed files.

.changeset/deploy-sorted-dependencies.md

@qodo-code-review

qodo-code-review Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. Deploys reorder dependencies ✗ Dismissed
Description
set_manifest_dependencies sorts every dependency group by name before rebuilding the JSON object,
rather than retaining the source manifest's insertion order. When a package lists dependencies in a
non-alphabetical order, shared-lockfile deploy rewrites that order in the deployed package.json,
while the regression test reverses the input order and expects alphabetical output.
Code

pnpm/crates/cli/src/cli_args/deploy/lockfile.rs[R329-331]

+        .collect::<Vec<_>>();
+    deps.sort_unstable_by(|(left, _), (right, _)| left.cmp(right));
+    let deps = deps.into_iter().collect::<Map<_, _>>();
Relevance

●● Moderate

Sorting is explicitly the PR's intended behavior, but no close rejection precedent confirms how this
conflict is handled.

PR-#13461

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance ID 3800840 requires deterministic deploy output while preserving dependency order from
the source package.json. The changed production code explicitly sorts dependency entries by name,
and the added test constructs dependencies in reverse order but asserts the alphabetical lib_names
order, demonstrating that the implementation intentionally changes source order.

Deterministic dependency order in deployed package.json
pnpm/crates/cli/src/cli_args/deploy/lockfile.rs[329-331]
pnpm/crates/cli/tests/suite/deploy.rs[234-239]
pnpm/crates/cli/tests/suite/deploy.rs[269-275]

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 deployment code sorts dependency groups alphabetically, which violates the required contract that deployed `package.json` files preserve dependency order from the source package.json.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/deploy/lockfile.rs[325-331]
- pnpm/crates/cli/tests/suite/deploy.rs[234-275]

## Recommended Fix
Carry the source manifest dependency order through resolution and serialize the deployed dependency groups in that order instead of sorting by name. Update the regression test so its input uses a deliberately non-alphabetical order and asserts that the deployed package.json preserves that exact order while still producing identical output across repeated deploys.

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



Remediation recommended

2. Release notes combine two fixes ✓ Resolved
Description
The changeset describes dependency ordering and allowBuilds ordering in one sentence. Because the
entry joins two independently observable changes with and, readers and generated release notes
cannot distinguish the two fixes clearly.
Code

.changeset/deploy-sorted-dependencies.md[5]

+`pnpm deploy` now writes the dependencies in the deployed `package.json` and the `allowBuilds` entries in the deployed `pnpm-workspace.yaml` sorted by name, so repeated deploys of the same lockfile produce identical files [#16687](https://github.com/pnpm/pnpm/issues/16687).
Relevance

●●● Strong

Recent changeset reviews accepted splitting compound sentences describing independent observable
changes.

PR-#15121
PR-#15289

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changeset's only release-note sentence describes two separate output changes: dependency
ordering in the deployed package manifest and allowBuilds ordering in the deployed workspace
manifest. The compliance rule requires each changeset sentence to describe only a single logical
change.

Rule 3058304: Avoid compound sentences in individual changeset entries
.changeset/deploy-sorted-dependencies.md[5-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 changeset combines the dependency-ordering fix and the `allowBuilds`-ordering fix in one compound sentence, contrary to the release-note convention requiring each sentence to describe one logical change.

## Fix Focus Areas
- .changeset/deploy-sorted-dependencies.md[5-5]

## Recommended Fix
Rewrite the entry as two sentences, with one sentence describing sorted dependencies in the deployed `package.json` and a separate sentence describing sorted `allowBuilds` entries in the deployed `pnpm-workspace.yaml`. Keep the shared deterministic-output effect as a concise clarification rather than introducing another distinct change in the same sentence.

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


Grey Divider

Context sources
✅ Compliance rules (platform): 66 rules
Review mode: Auto: ⏭️ Skipped: Patch only refines a Markdown changeset release note.

Grey Divider

Tip of the day
💡 Did you know, you can route each severity your way: inline, summary, both, or drop

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit e5666f7

Results up to commit d7c171f 🚀 Fast


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


Action required
1. Deploys reorder dependencies ✗ Dismissed
Description
set_manifest_dependencies sorts every dependency group by name before rebuilding the JSON object,
rather than retaining the source manifest's insertion order. When a package lists dependencies in a
non-alphabetical order, shared-lockfile deploy rewrites that order in the deployed package.json,
while the regression test reverses the input order and expects alphabetical output.
Code

pnpm/crates/cli/src/cli_args/deploy/lockfile.rs[R329-331]

+        .collect::<Vec<_>>();
+    deps.sort_unstable_by(|(left, _), (right, _)| left.cmp(right));
+    let deps = deps.into_iter().collect::<Map<_, _>>();
Relevance

●● Moderate

Sorting is explicitly the PR's intended behavior, but no close rejection precedent confirms how this
conflict is handled.

PR-#13461

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance ID 3800840 requires deterministic deploy output while preserving dependency order from
the source package.json. The changed production code explicitly sorts dependency entries by name,
and the added test constructs dependencies in reverse order but asserts the alphabetical lib_names
order, demonstrating that the implementation intentionally changes source order.

Deterministic dependency order in deployed package.json
pnpm/crates/cli/src/cli_args/deploy/lockfile.rs[329-331]
pnpm/crates/cli/tests/suite/deploy.rs[234-239]
pnpm/crates/cli/tests/suite/deploy.rs[269-275]

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 deployment code sorts dependency groups alphabetically, which violates the required contract that deployed `package.json` files preserve dependency order from the source package.json.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/deploy/lockfile.rs[325-331]
- pnpm/crates/cli/tests/suite/deploy.rs[234-275]

## Recommended Fix
Carry the source manifest dependency order through resolution and serialize the deployed dependency groups in that order instead of sorting by name. Update the regression test so its input uses a deliberately non-alphabetical order and asserts that the deployed package.json preserves that exact order while still producing identical output across repeated deploys.

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



Remediation recommended
2. Release notes combine two fixes ✓ Resolved
Description
The changeset describes dependency ordering and allowBuilds ordering in one sentence. Because the
entry joins two independently observable changes with and, readers and generated release notes
cannot distinguish the two fixes clearly.
Code

.changeset/deploy-sorted-dependencies.md[5]

+`pnpm deploy` now writes the dependencies in the deployed `package.json` and the `allowBuilds` entries in the deployed `pnpm-workspace.yaml` sorted by name, so repeated deploys of the same lockfile produce identical files [#16687](https://github.com/pnpm/pnpm/issues/16687).
Relevance

●●● Strong

Recent changeset reviews accepted splitting compound sentences describing independent observable
changes.

PR-#15121
PR-#15289

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The changeset's only release-note sentence describes two separate output changes: dependency
ordering in the deployed package manifest and allowBuilds ordering in the deployed workspace
manifest. The compliance rule requires each changeset sentence to describe only a single logical
change.

Rule 3058304: Avoid compound sentences in individual changeset entries
.changeset/deploy-sorted-dependencies.md[5-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 changeset combines the dependency-ordering fix and the `allowBuilds`-ordering fix in one compound sentence, contrary to the release-note convention requiring each sentence to describe one logical change.

## Fix Focus Areas
- .changeset/deploy-sorted-dependencies.md[5-5]

## Recommended Fix
Rewrite the entry as two sentences, with one sentence describing sorted dependencies in the deployed `package.json` and a separate sentence describing sorted `allowBuilds` entries in the deployed `pnpm-workspace.yaml`. Keep the shared deterministic-output effect as a concise clarification rather than introducing another distinct change in the same sentence.

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


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.

@github-actions github-actions Bot added the reviewed: coderabbit CodeRabbit submitted an approving review label Oct 7, 2026
Copilot AI balanced review requested due to automatic review settings October 7, 2026 10:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@zkochan

zkochan commented Oct 7, 2026

Copy link
Copy Markdown
Member Author

Qodo summary findings:

  1. Keep the source order instead of sorting: declined, see the inline reply. pnpm 11.28.2 also writes the deployed dependencies sorted by name.
  2. Split the compound sentence in the changeset: fixed in e5666f7.

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

@qodo-code-review

Copy link
Copy Markdown

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

@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

Qodo summary findings:

  1. Keep the source order instead of sorting: declined, see the inline reply. pnpm 11.28.2 also writes the deployed dependencies sorted by name.
  2. Split the compound sentence in the changeset: fixed in e5666f7.

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

Confirmed:

  • finding 1 — declined and marked dismissed; the decision to sort dependencies is intentional and consistent with pnpm 11.28.2.
  • finding 2 — fixed in commit e5666f786ac430c9e4f943566c8b138a60e9a1eb.

There are currently no active Qodo findings.

@zkochan
zkochan merged commit e048892 into main Oct 7, 2026
57 checks passed
@zkochan
zkochan deleted the fix-16687 branch October 7, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product: pacquet reviewed: coderabbit CodeRabbit submitted an approving review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pnpm deploy writes dependencies in random order in the deployed package.json

3 participants