Skip to content

fix(pkg): keep projects that share a name in pkg get -r output - #16494

Merged
zkochan merged 4 commits into
mainfrom
fix/pkg-get-recursive-duplicate-names
Oct 1, 2026
Merged

zkochan merged 4 commits into
mainfrom
fix/pkg-get-recursive-duplicate-names

Conversation

@zkochan

@zkochan zkochan commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Summary

pnpm -r pkg get builds a JSON object keyed by package name. When two selected workspace projects share a name, the later one silently replaces the earlier one. Workspaces allow duplicate names, so this fixes the report instead of rejecting the workspace.

Unique names stay the keys, so output for typical workspaces is unchanged. Every project that shares a name is keyed by its workspace-relative directory, the fallback both CLIs already use for nameless projects. A name that equals a directory key in use also moves to its own directory, repeated until nothing collides.

Both CLIs have the bug, so the fix lands in both (pnpm11/pkg-manifest/commands, pnpm/crates/cli), with the v11 and v12 pkg docs updated.

Found while closing #15871 in favor of pnpm -r pkg get version.

Squash Commit Body

`pnpm -r pkg get` keyed its JSON report by package name, so when two
selected workspace projects had the same name the later one silently
replaced the earlier one. Workspaces allow duplicate names, so failing
is not an option.

Keep name keys when a name is unique. Key every project that shares a
name by its workspace-relative directory, the same fallback already
used for nameless projects. Re-keying all of them rather than only the
later one keeps the result independent of selection order. A project
whose name equals a directory key that another project falls back to
also moves to its directory, and this repeats until no key collides.
Directories are distinct, so every key is. Workspaces with unique names
keep the same output.

Implemented in both the TypeScript and Rust CLIs, with the docs updated
for both.

Checklist

  • 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.
  • Updated the documentation if needed.

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

🤖 Generated with Claude Code


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

    • Recursive pkg get now reports every selected project, including projects with duplicate or missing package names. Results use package names where unambiguous and workspace-relative directory keys when needed to avoid collisions, including conflicts between a package name and another project’s directory key.
  • Documentation

    • Clarified how recursive pkg get chooses result keys, including when names are missing, duplicated, or conflict with directory keys.

zkochan and others added 2 commits October 1, 2026 18:45
`pnpm -r pkg get` keyed its JSON report by package name, so when two
selected workspace projects had the same name the later one silently
replaced the earlier one. Workspaces allow duplicate names, so failing
is not an option.

Keep name keys when a name is unique. Key every project that shares a
name by its workspace-relative directory, the same fallback already
used for nameless projects. A project whose name equals a directory
key that another project falls back to also moves to its directory, and
this repeats until no key collides. Directories are distinct, so every
key is. Workspaces with unique names keep the same output.

Implemented in both the TypeScript and Rust CLIs, with the docs updated
for both.

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

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (2)
AGENTS.md — auto-discovered
pnpm/AGENTS.md — auto-discovered

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: 00d1d486-0e84-43d7-87bd-35ceca083c5c

📥 Commits

Reviewing files that changed from the base of the PR and between e53552b and a90887f.

📒 Files selected for processing (2)
  • pnpm/crates/cli/src/cli_args/pkg/report_keys.rs
  • pnpm11/pkg-manifest/commands/src/reportKeys.ts

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


📝 Walkthrough

Walkthrough

Recursive pkg get assigns workspace-relative directory keys when project names are missing, duplicated, or conflict with another project’s directory key. The Rust CLI and pnpm 11 implementation include key-assignment tests, integration tests, and updated documentation.

Changes

Recursive pkg get

Layer / File(s) Summary
Report-key assignment
pnpm/crates/cli/src/cli_args/pkg/report_keys.rs, pnpm/crates/cli/src/cli_args/pkg/report_keys/tests.rs, pnpm11/pkg-manifest/commands/src/reportKeys.ts, pnpm11/pkg-manifest/commands/test/reportKeys.test.ts
Both implementations use directory keys for unnamed and duplicate-name projects. They also move name-keyed projects to directory keys when a name conflicts with a directory key in use. Unit tests cover unique names, duplicate names, and key collisions.
Recursive get integration and documentation
pnpm/crates/cli/src/cli_args/pkg.rs, pnpm/crates/cli/tests/suite/*, pnpm/docs/cli/pkg.md, pnpm11/pkg-manifest/commands/src/pkg.ts, pnpm11/pkg-manifest/commands/test/pkg.test.ts, pnpm11/docs/cli/pkg.md, .changeset/pkg-get-recursive-duplicate-names.md
Recursive get uses the assigned keys in its output. Integration tests check results for duplicate package names. Both documentation files describe when directory keys are used, and the changeset declares patch updates.

Priority: ⬇️ Low

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

Change: Bug fix

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

Merge Risk: ⚪ Minimal · up to a9088

The change preserves uniquely named results while reporting duplicate-name projects under directory keys. No concrete merge-blocking risk is identified; merge after normal checks pass.

Security Architecture Review

Security architecture risk: 🔵 Low · up to a9088

The change remains confined to reporting selected workspace manifests and does not demonstrate broader access or privileges. Its collision-resolution logic is bounded and stateless, but the guarantee that every selected project produces a distinct directory key was not fully established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected exposure remains selected workspace manifest values and their report identities in CLI output. Comparison with the prior implementations found no additional manifest-read scope or privilege transition introduced by key assignment.

Trust Boundaries and Controls

  • observed — Existing workspace-root validation and selected-project traversal remain upstream of key assignment. The helpers perform reporting transformations rather than authorization decisions; the inspected callers retain their existing manifest-read boundaries.

Resilience and Maintainability Implications

  • inferred — The transition changes only invocation-local bookkeeping and creates no persistent ownership or cleanup state. Manifest-selection and serialization errors occur before the complete result is returned or printed, and repetition recomputes keys from current inputs. This does not establish a transactional snapshot across concurrent manifest edits.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.

Warning

Some tools did not complete. Review the errors below.

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

pnpm11/pkg-manifest/commands/src/reportKeys.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.


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

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.21%. Comparing base (7afe7b9) to head (a90887f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16494      +/-   ##
==========================================
+ Coverage   92.19%   92.21%   +0.01%     
==========================================
  Files        1527     1528       +1     
  Lines      205671   205722      +51     
==========================================
+ Hits       189623   189705      +82     
+ Misses      16048    16017      -31     

☔ 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 1, 2026 •

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                                            main                                   pr
-----                                            ----                                   --
lockfile/parse_pnpm_lock                         1.00     12.0±0.53ms    31.3 MB/sec    1.42     17.0±1.26ms    22.0 MB/sec
packument/parse                                  1.00     40.3±0.28µs  1646.0 MB/sec    1.11     44.7±2.66µs  1483.6 MB/sec
tarball/download_dependency                      1.00      4.0±0.36ms  1097.3 KB/sec    2.23      8.8±1.39ms   492.4 KB/sec
tarball_batch/cold_store_many_medium_tarballs    1.00   229.4±23.90ms 69.7 KElem/sec    1.37   313.9±33.05ms 51.0 KElem/sec
version_pick/repeated_ranges_file                1.00      4.1±0.10ms  7.6 KElem/sec    1.03      4.2±0.04ms  7.4 KElem/sec
version_pick/repeated_ranges_raw                 1.00      4.3±0.10ms  7.3 KElem/sec    1.01      4.3±0.17ms  7.2 KElem/sec
workspace_resolution/hoist_heavy                 1.00   235.5±24.26ms        ? ?/sec    1.14   269.2±10.64ms        ? ?/sec
workspace_sort/chained_projects                  1.11     15.4±5.49ms        ? ?/sec    1.00     13.9±1.80ms        ? ?/sec

@github-actions

github-actions Bot commented Oct 1, 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 2636.54 ms 2479.21 ms -6.0% 131.83 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store pnpr 1617.20 ms 1522.13 ms -5.9% 80.86 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pacquet 289.80 ms 259.44 ms -10.5% 14.49 ms Within tolerance
isolated-fresh-restore-hot-cache-hot-store pnpr 262.02 ms 247.82 ms -5.4% 13.10 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pacquet 11.03 ms 11.55 ms 4.7% 2.00 ms Within tolerance
isolated-repeat-install-hot-cache-hot-store pnpr 10.66 ms 10.42 ms -2.2% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pacquet 17.24 ms 16.99 ms -1.5% 2.00 ms Within tolerance
isolated-repeat-install-cold-cache-hot-store pnpr 16.49 ms 16.89 ms 2.4% 2.00 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pacquet 3022.33 ms 2934.19 ms -2.9% 151.12 ms Within tolerance
isolated-fresh-install-cold-cache-cold-store pnpr 1958.75 ms 1782.22 ms -9.0% 97.94 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pacquet 695.00 ms 639.92 ms -7.9% 34.75 ms Within tolerance
isolated-fresh-install-hot-cache-hot-store pnpr 393.40 ms 395.65 ms 0.6% 19.67 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pacquet 1752.51 ms 1720.96 ms -1.8% 87.63 ms Within tolerance
isolated-fresh-install-cold-cache-hot-store pnpr 434.52 ms 372.59 ms -14.3% 21.73 ms Within tolerance
isolated-fresh-resolve-hot-cache-offline pacquet 389.76 ms 414.47 ms 6.3% 19.49 ms Inconclusive (overlapping samples)
isolated-fresh-resolve-hot-cache-offline pnpr 126.78 ms 132.81 ms 4.8% 6.34 ms Within tolerance
isolated-peer-heavy-resolve-hot-cache-offline pacquet 257.01 ms 279.73 ms 8.8% 12.85 ms Inconclusive (overlapping samples)
isolated-linked-workspace-resolve-hot-cache-offline pacquet 257.58 ms 250.16 ms -2.9% 12.88 ms Within tolerance
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pacquet 4600.54 ms 5447.70 ms 18.4% 230.03 ms Inconclusive (overlapping samples)
isolated-fresh-restore-cold-cache-cold-store-cold-pnpr pnpr 3827.68 ms 3554.43 ms -7.1% 191.38 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pacquet 178.60 ms 147.23 ms -17.6% 8.93 ms Within tolerance
gvs-fresh-restore-hot-cache-hot-store pnpr 128.24 ms 132.37 ms 3.2% 6.41 ms Within tolerance

Integrated-Benchmark Report (Linux)

Commit: a90887f4af31

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.516 ± 0.121 2.368 2.741 1.61 ± 0.17
pacquet@main 2.610 ± 0.128 2.390 2.746 1.67 ± 0.17
pnpr@HEAD 1.566 ± 0.144 1.426 1.837 1.00
pnpr@main 1.610 ± 0.132 1.433 1.765 1.03 ± 0.13
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.5160075437200002,
      "stddev": 0.12149321423963134,
      "median": 2.47920861462,
      "user": 2.2760916,
      "system": 2.0994060799999996,
      "min": 2.36752745362,
      "max": 2.7408584856200005
    },
    {
      "command": "pacquet@main",
      "mean": 2.6102203183200006,
      "stddev": 0.12803640674692843,
      "median": 2.6365437826200004,
      "user": 2.1991395999999996,
      "system": 2.0958010799999998,
      "min": 2.38979027262,
      "max": 2.7461698086200004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.56619321982,
      "stddev": 0.1439923870131339,
      "median": 1.52212808712,
      "user": 2.1086307,
      "system": 1.95573978,
      "min": 1.42632314562,
      "max": 1.8371216586199999
    },
    {
      "command": "pnpr@main",
      "mean": 1.61027783822,
      "stddev": 0.1324522208965461,
      "median": 1.61719646412,
      "user": 2.2501007,
      "system": 1.99572668,
      "min": 1.4327854846199999,
      "max": 1.76494231862
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 271.0 ± 36.8 245.2 372.9 1.08 ± 0.16
pacquet@main 277.0 ± 29.8 238.6 310.8 1.11 ± 0.14
pnpr@HEAD 250.1 ± 15.2 225.2 278.6 1.00
pnpr@main 261.8 ± 10.5 238.9 278.0 1.05 ± 0.08
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.27102548144,
      "stddev": 0.03681467449812947,
      "median": 0.25944490424,
      "user": 0.32204679999999997,
      "system": 0.63603264,
      "min": 0.24518096124,
      "max": 0.37286060224
    },
    {
      "command": "pacquet@main",
      "mean": 0.27696442364,
      "stddev": 0.029793844913517817,
      "median": 0.28979944424000004,
      "user": 0.3117253,
      "system": 0.68528064,
      "min": 0.23855124324000002,
      "max": 0.31081268524
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.25014866484000003,
      "stddev": 0.01517838414905506,
      "median": 0.24781575774,
      "user": 0.2794208,
      "system": 0.55635334,
      "min": 0.22515173624,
      "max": 0.27855638124
    },
    {
      "command": "pnpr@main",
      "mean": 0.26183879334000004,
      "stddev": 0.010499667353385223,
      "median": 0.26202254524,
      "user": 0.2807548,
      "system": 0.5986400399999999,
      "min": 0.23886159824,
      "max": 0.27802777524
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 12.0 ± 1.9 9.2 22.3 1.14 ± 0.21
pacquet@main 11.2 ± 1.0 9.0 14.1 1.07 ± 0.13
pnpr@HEAD 10.5 ± 1.0 8.5 14.4 1.00
pnpr@main 10.9 ± 1.2 8.6 15.5 1.03 ± 0.15
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.01198767645860262,
      "stddev": 0.0018595012453370902,
      "median": 0.01155017438,
      "user": 0.007174101834061139,
      "system": 0.005919868995633187,
      "min": 0.00917808338,
      "max": 0.02233243638
    },
    {
      "command": "pacquet@main",
      "mean": 0.01119160412703557,
      "stddev": 0.0009683561181424406,
      "median": 0.011027112379999999,
      "user": 0.0066611313833992115,
      "system": 0.005523694940711463,
      "min": 0.008958289380000001,
      "max": 0.014084669380000001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.010493785089523812,
      "stddev": 0.0009634429909776489,
      "median": 0.010417102880000001,
      "user": 0.006268156190476195,
      "system": 0.005215241714285712,
      "min": 0.008478347380000001,
      "max": 0.014403438380000001
    },
    {
      "command": "pnpr@main",
      "mean": 0.010860110520151515,
      "stddev": 0.0012349749876231556,
      "median": 0.010656457880000001,
      "user": 0.0063566898484848505,
      "system": 0.005534137878787881,
      "min": 0.00862033438,
      "max": 0.015517199380000003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 17.1 ± 2.0 12.6 24.0 1.03 ± 0.16
pacquet@main 17.5 ± 2.0 12.3 28.3 1.05 ± 0.17
pnpr@HEAD 16.9 ± 1.9 12.9 23.7 1.02 ± 0.16
pnpr@main 16.6 ± 1.8 12.6 23.6 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.017112247587536246,
      "stddev": 0.0020212531890789376,
      "median": 0.01698621566,
      "user": 0.009500701739130429,
      "system": 0.008897750724637679,
      "min": 0.01260389966,
      "max": 0.02400421666
    },
    {
      "command": "pacquet@main",
      "mean": 0.017452256252592595,
      "stddev": 0.002032463582381674,
      "median": 0.017241830660000002,
      "user": 0.009458987407407402,
      "system": 0.009144432296296297,
      "min": 0.012300888660000002,
      "max": 0.02830154966
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.016935805972056735,
      "stddev": 0.001860132651529329,
      "median": 0.01688633066,
      "user": 0.009371782836879432,
      "system": 0.008911958014184394,
      "min": 0.01285548866,
      "max": 0.023715337660000002
    },
    {
      "command": "pnpr@main",
      "mean": 0.016578800543211678,
      "stddev": 0.0017578454966055961,
      "median": 0.01649172066,
      "user": 0.008946990218978107,
      "system": 0.009056700437956202,
      "min": 0.012596297660000002,
      "max": 0.023602088660000003
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 3.040 ± 0.291 2.839 3.714 1.74 ± 0.20
pacquet@main 3.068 ± 0.235 2.788 3.445 1.75 ± 0.17
pnpr@HEAD 1.749 ± 0.110 1.558 1.918 1.00
pnpr@main 1.960 ± 0.163 1.751 2.175 1.12 ± 0.12
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 3.0402825203400003,
      "stddev": 0.29083194285975417,
      "median": 2.93418969424,
      "user": 3.3956786,
      "system": 2.5438337800000004,
      "min": 2.83926584524,
      "max": 3.71406910024
    },
    {
      "command": "pacquet@main",
      "mean": 3.06770264234,
      "stddev": 0.23509407393836945,
      "median": 3.0223322482399997,
      "user": 3.5064724,
      "system": 2.58802758,
      "min": 2.78778534824,
      "max": 3.4454243722399998
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.7492470986400002,
      "stddev": 0.10965736532075801,
      "median": 1.7822189427400001,
      "user": 2.0691571,
      "system": 2.1009050799999995,
      "min": 1.5576505542399999,
      "max": 1.9177170932399998
    },
    {
      "command": "pnpr@main",
      "mean": 1.9604325455400002,
      "stddev": 0.16334249900577727,
      "median": 1.95874529524,
      "user": 2.423778,
      "system": 2.38105388,
      "min": 1.75114733724,
      "max": 2.17489128124
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 642.1 ± 69.5 552.7 764.1 1.62 ± 0.23
pacquet@main 702.7 ± 73.6 619.8 850.4 1.77 ± 0.25
pnpr@HEAD 403.8 ± 31.2 361.2 474.2 1.02 ± 0.12
pnpr@main 396.0 ± 36.8 333.1 447.2 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6420655522600002,
      "stddev": 0.06950995914116537,
      "median": 0.63991589086,
      "user": 0.89913968,
      "system": 0.95244256,
      "min": 0.5526962953600001,
      "max": 0.7641209273600001
    },
    {
      "command": "pacquet@main",
      "mean": 0.7027035186600001,
      "stddev": 0.07356680068903541,
      "median": 0.6949970348600001,
      "user": 1.0114732800000001,
      "system": 1.02363086,
      "min": 0.61977432336,
      "max": 0.8504107463600001
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.40381804076000005,
      "stddev": 0.03118982511038192,
      "median": 0.39564530936,
      "user": 0.3829562799999999,
      "system": 0.72487406,
      "min": 0.36123963136000004,
      "max": 0.47417024736
    },
    {
      "command": "pnpr@main",
      "mean": 0.39602388325999993,
      "stddev": 0.036759667030145556,
      "median": 0.39340056436000004,
      "user": 0.38019207999999993,
      "system": 0.72963426,
      "min": 0.33309422336,
      "max": 0.44721419536
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.727 ± 0.063 1.659 1.883 4.73 ± 0.42
pacquet@main 1.752 ± 0.052 1.686 1.870 4.80 ± 0.42
pnpr@HEAD 0.365 ± 0.030 0.328 0.401 1.00
pnpr@main 0.439 ± 0.020 0.411 0.466 1.20 ± 0.11
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.7273893025000002,
      "stddev": 0.06339518112235482,
      "median": 1.7209628551000002,
      "user": 1.2205040600000001,
      "system": 1.1586021999999998,
      "min": 1.6586373376,
      "max": 1.8828746116000001
    },
    {
      "command": "pacquet@main",
      "mean": 1.7515079231000006,
      "stddev": 0.05236258326730229,
      "median": 1.7525062236000002,
      "user": 1.1897847600000002,
      "system": 1.1536961,
      "min": 1.6856840786,
      "max": 1.8698634806000003
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.3651008681,
      "stddev": 0.029751049251049662,
      "median": 0.3725910001,
      "user": 0.33479835999999996,
      "system": 0.7016322999999998,
      "min": 0.32799777360000004,
      "max": 0.40065999860000007
    },
    {
      "command": "pnpr@main",
      "mean": 0.4388209902000001,
      "stddev": 0.020227435545879205,
      "median": 0.43452274660000006,
      "user": 0.43583846,
      "system": 0.8130898,
      "min": 0.4107096646,
      "max": 0.46633994360000003
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 413.6 ± 34.2 356.9 463.1 3.24 ± 0.33
pacquet@main 393.0 ± 30.6 354.6 447.3 3.08 ± 0.30
pnpr@HEAD 132.5 ± 12.4 111.9 149.7 1.04 ± 0.11
pnpr@main 127.8 ± 7.5 117.7 142.1 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.41362806994,
      "stddev": 0.03421453957623415,
      "median": 0.41446538744000005,
      "user": 0.42000778,
      "system": 0.20854240000000002,
      "min": 0.35690146394,
      "max": 0.46314637494000005
    },
    {
      "command": "pacquet@main",
      "mean": 0.39299665794000005,
      "stddev": 0.030585332979783237,
      "median": 0.38975710344000003,
      "user": 0.39184258,
      "system": 0.19220490000000004,
      "min": 0.35456197394,
      "max": 0.44729490394000004
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.13253939584000002,
      "stddev": 0.012382076095563936,
      "median": 0.13281137094,
      "user": 0.06268473,
      "system": 0.030679999999999995,
      "min": 0.11190307394000001,
      "max": 0.14971850194
    },
    {
      "command": "pnpr@main",
      "mean": 0.1277735782257143,
      "stddev": 0.007503632042341651,
      "median": 0.12677793794,
      "user": 0.05633307047619047,
      "system": 0.03074601904761905,
      "min": 0.11769884994,
      "max": 0.14207040094
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 273.8 ± 23.4 220.6 302.6 1.09 ± 0.14
pacquet@main 251.4 ± 23.9 207.3 278.2 1.00
pnpm@HEAD 4370.4 ± 254.9 4129.5 4776.8 17.39 ± 1.94
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.2737811696955556,
      "stddev": 0.023376589473370905,
      "median": 0.27973313114000004,
      "user": 0.29406004444444445,
      "system": 0.050466604444444445,
      "min": 0.22055080014,
      "max": 0.30259295914000006
    },
    {
      "command": "pacquet@main",
      "mean": 0.25135853347333337,
      "stddev": 0.02387541049491629,
      "median": 0.25700683614000003,
      "user": 0.2584380444444444,
      "system": 0.050332159999999994,
      "min": 0.20727474714000002,
      "max": 0.27824546014000007
    },
    {
      "command": "pnpm@HEAD",
      "mean": 4.370435610917777,
      "stddev": 0.25485328031930043,
      "median": 4.28060302014,
      "user": 6.694861933333333,
      "system": 0.4464893822222222,
      "min": 4.12951951114,
      "max": 4.77677853414
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 252.9 ± 16.9 224.4 281.5 1.01 ± 0.09
pacquet@main 250.8 ± 16.2 222.5 275.0 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.25290200398727275,
      "stddev": 0.01689299827941322,
      "median": 0.25015972126,
      "user": 0.21590296363636366,
      "system": 0.08772006545454543,
      "min": 0.22437623526000003,
      "max": 0.28146637826000004
    },
    {
      "command": "pacquet@main",
      "mean": 0.2507736778963637,
      "stddev": 0.016209239467339875,
      "median": 0.25757732026,
      "user": 0.19696641818181815,
      "system": 0.10226188363636363,
      "min": 0.22245353426000003,
      "max": 0.27497053526000004
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 5.487 ± 0.508 4.729 6.112 1.50 ± 0.17
pacquet@main 4.852 ± 0.425 4.496 5.603 1.33 ± 0.14
pnpr@HEAD 3.649 ± 0.222 3.478 4.195 1.00
pnpr@main 3.835 ± 0.125 3.649 4.056 1.05 ± 0.07
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 5.486507152740001,
      "stddev": 0.5077284580746106,
      "median": 5.44769651264,
      "user": 2.76851596,
      "system": 2.6347594199999995,
      "min": 4.7285226301400005,
      "max": 6.112029880140001
    },
    {
      "command": "pacquet@main",
      "mean": 4.85224490434,
      "stddev": 0.4248250217247618,
      "median": 4.600540709140001,
      "user": 2.20403326,
      "system": 1.9881073199999992,
      "min": 4.49589811814,
      "max": 5.60339453114
    },
    {
      "command": "pnpr@HEAD",
      "mean": 3.64866110274,
      "stddev": 0.22157477729673944,
      "median": 3.55443019164,
      "user": 1.87316826,
      "system": 1.79703552,
      "min": 3.47806847814,
      "max": 4.19504707714
    },
    {
      "command": "pnpr@main",
      "mean": 3.83533263184,
      "stddev": 0.12479812224505121,
      "median": 3.82767877114,
      "user": 2.1941554599999997,
      "system": 2.03434192,
      "min": 3.64927242514,
      "max": 4.05646778914
    }
  ]
}

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 148.0 ± 6.3 138.6 161.7 1.15 ± 0.07
pacquet@main 173.9 ± 32.8 117.8 211.4 1.35 ± 0.26
pnpr@HEAD 133.6 ± 4.0 127.2 141.7 1.04 ± 0.05
pnpr@main 128.7 ± 4.9 122.2 145.0 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.14799029144444445,
      "stddev": 0.006335118004996124,
      "median": 0.14722887899999998,
      "user": 0.18415737333333335,
      "system": 0.15731838666666664,
      "min": 0.13855597949999998,
      "max": 0.1616621975
    },
    {
      "command": "pacquet@main",
      "mean": 0.17385056693749998,
      "stddev": 0.03284810117660996,
      "median": 0.1786025785,
      "user": 0.21806566499999996,
      "system": 0.18533540749999997,
      "min": 0.11777000250000001,
      "max": 0.2113859345
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.13356283675000002,
      "stddev": 0.003998898810520504,
      "median": 0.13236565,
      "user": 0.15898783999999996,
      "system": 0.14366336999999998,
      "min": 0.1271759615,
      "max": 0.1417224815
    },
    {
      "command": "pnpr@main",
      "mean": 0.12865833385,
      "stddev": 0.004860471440215704,
      "median": 0.128235592,
      "user": 0.15449004000000002,
      "system": 0.12996087,
      "min": 0.1221800905,
      "max": 0.1449889005
    }
  ]
}

@zkochan
zkochan marked this pull request as ready for review October 1, 2026 17:06
Copilot AI balanced review requested due to automatic review settings October 1, 2026 17:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Preserve duplicate-name projects in recursive pkg get output

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Preserve every selected project when package names collide in recursive pkg get reports.
• Use workspace-relative directory keys only where needed, preserving unique-name output.
• Apply the fix to both CLIs, with regression tests and updated documentation.
Diagram

graph TD
  A["Both CLIs"] --> B["Selected projects"] --> C["Manifest identities"] --> D{"Duplicate name?"}
  D -->|Yes| E["Directory keys"] --> F["Resolve shadows"] --> G["JSON report"]
  D -->|No| F
Loading
High-Level Assessment

Keep the PR's selective directory-key fallback. Using directories for every project would avoid collisions but unnecessarily change existing reports; rejecting duplicate-name workspaces would conflict with supported workspaces. Resolving shadows in both CLIs preserves compatibility while ensuring distinct keys.

Files changed (12) +337 / -27

Bug fix (4) +164 / -25
pkg.rsApply distinct report keys in the Rust CLI +28/-21

Apply distinct report keys in the Rust CLI

• Collects selected projects and their manifest-name and directory identities before building recursive get output. Uses the new key resolver instead of inserting results directly under package names.

pnpm/crates/cli/src/cli_args/pkg.rs

report_keys.rsResolve Rust report-key collisions +72/-0

Resolve Rust report-key collisions

• Assigns directory keys to nameless and duplicate-name projects, then repeatedly moves names shadowed by directory keys until no collision remains.

pnpm/crates/cli/src/cli_args/pkg/report_keys.rs

pkg.tsApply distinct report keys in the TypeScript CLI +12/-4

Apply distinct report keys in the TypeScript CLI

• Reads each selected project's manifest and directory identity, assigns collision-free keys, and builds recursive get output without overwriting duplicate-name projects.

pnpm11/pkg-manifest/commands/src/pkg.ts

reportKeys.tsResolve TypeScript report-key collisions +52/-0

Resolve TypeScript report-key collisions

• Selects directory keys for nameless and duplicate-name projects and iteratively resolves names shadowed by directory keys.

pnpm11/pkg-manifest/commands/src/reportKeys.ts

Tests (5) +164 / -0
tests.rsTest Rust report-key selection +50/-0

Test Rust report-key selection

• Covers unique and missing names, shared names, direct and chained key collisions, and a name equal to its own directory.

pnpm/crates/cli/src/cli_args/pkg/report_keys/tests.rs

main.rsRegister recursive pkg CLI tests +1/-0

Register recursive pkg CLI tests

• Includes the new recursive pkg integration test module in the Rust CLI suite.

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

pkg_recursive.rsVerify duplicate-name output through the Rust CLI +43/-0

Verify duplicate-name output through the Rust CLI

• Creates a workspace with two projects sharing a name and checks that recursive pkg get reports both by directory while retaining unique-name keys.

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

pkg.test.tsTest recursive get with duplicate package names +21/-0

Test recursive get with duplicate package names

• Checks that the TypeScript command returns both shared-name projects under their directories alongside a uniquely named project.

pnpm11/pkg-manifest/commands/test/pkg.test.ts

reportKeys.test.tsTest TypeScript report-key selection +49/-0

Test TypeScript report-key selection

• Covers unique, missing, and duplicate names, direct and chained directory-key collisions, and self-matching directory keys.

pnpm11/pkg-manifest/commands/test/reportKeys.test.ts

Documentation (3) +9 / -2
pkg-get-recursive-duplicate-names.mdRecord patch releases for the recursive report fix +7/-0

Record patch releases for the recursive report fix

• Adds user-facing release notes and patch changesets for the affected pnpm, pacquet, and pkg-manifest commands packages.

.changeset/pkg-get-recursive-duplicate-names.md

pkg.mdDocument recursive report keys for the current CLI +1/-1

Document recursive report keys for the current CLI

• Explains when recursive pkg get uses workspace-relative directories instead of package names.

pnpm/docs/cli/pkg.md

pkg.mdDocument recursive report keys for pnpm v11 +1/-1

Document recursive report keys for pnpm v11

• Describes the duplicate-name, nameless-project, and directory-key collision fallbacks for v11 users.

pnpm11/docs/cli/pkg.md

@qodo-code-review

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

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (1) 🔗 Cross-repo conflicts (0) 📜 Skill insights (1)

Grey Divider


Remediation recommended

1. Collision chains slow recursive reports ✓ Resolved
Description
report_keys rebuilds and scans the directory-key set until no names move, and the TypeScript
assignReportKeys implementation repeats the same full-pass algorithm. When each moved project's
directory matches the next project's name, only one project moves per pass, making recursive reports
quadratic in the number of selected projects.
Code

pnpm/crates/cli/src/cli_args/pkg/report_keys.rs[R20-21]

+    let mut keyed_by_dir = initially_keyed_by_dir(identities);
+    while key_names_shadowed_by_dirs(identities, &mut keyed_by_dir) {}
Relevance

●● Moderate

Quadratic-performance findings are sometimes accepted, but this optimization is unbounded and lacks
close precedent.

PR-#14794
PR-#15581
PR-#13689

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Recursive get passes the full selected-project list into each selector. The existing tests
demonstrate a collision chain (first → second → third); extending that pattern by one project
makes the selectors perform another full pass. Rust also clones directory strings while rebuilding
its set on each pass.

pnpm/crates/cli/src/cli_args/pkg.rs[211-221]
pnpm/crates/cli/src/cli_args/pkg/report_keys.rs[50-69]
pnpm/crates/cli/src/cli_args/pkg/report_keys/tests.rs[36-43]
pnpm11/pkg-manifest/commands/src/pkg.ts[89-100]
pnpm11/pkg-manifest/commands/src/reportKeys.ts[18-23]
pnpm11/pkg-manifest/commands/src/reportKeys.ts[42-52]

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

## Issue description
Both recursive report-key implementations rescan every selected project for each link in a name–directory collision chain, producing quadratic work.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/pkg/report_keys.rs[19-69]
- pnpm11/pkg-manifest/commands/src/reportKeys.ts[18-52]

## Recommended Fix
Build a mapping from names to projects once, seed a queue with projects initially keyed by directory, and propagate each newly occupied directory key through that queue. Move each project at most once while retaining the current order-independent key choices.

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


2. One changeset mixes both release lines 📘 Rule violation § Compliance
Description
The changeset lists the v11 packages and pacquet in a single frontmatter block rather than
separating the TypeScript and Rust fixes. Because this PR changes both CLIs, later release-note or
bump adjustments for one release line would also affect the other entry.
Code

.changeset/pkg-get-recursive-duplicate-names.md[R2-4]

+"@pnpm/pkg-manifest.commands": patch
+"pnpm": patch
+"pacquet": patch
Relevance

●● Moderate

Recent precedents both accept and reject identical split-changeset findings, so team behavior is
mixed.

PR-#16479
PR-#15895
PR-#15880

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new changeset places the v11 package targets and the v12 pacquet target together, while
checklist item 713436 requires separate changeset files when a PR changes both stacks.

Rule 713436: Changesets for pnpm v11 vs v12 (pacquet) must target the correct package and bump type
.changeset/pkg-get-recursive-duplicate-names.md[1-7]
pnpm11/pkg-manifest/commands/src/pkg.ts[88-100]
pnpm/crates/cli/src/cli_args/pkg.rs[211-221]

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 combined changeset targets both the v11 TypeScript packages and the v12 Rust CLI, contrary to the separate-changeset requirement for cross-version changes.

## Fix Focus Areas
- .changeset/pkg-get-recursive-duplicate-names.md[1-7]

## Recommended Fix
Keep the `@pnpm/pkg-manifest.commands` and `pnpm` patch entries in a v11 changeset. Add a separate changeset targeting only `pacquet`, with release-note text describing its fix.

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

Dismiss ↗ | View ↗



Informational

3. Recursive report speedup is unverified 📜 Skill insight ➹ Performance ⭐ New
Description
move_names_shadowed_by_dirs replaces repeated collision scans with a worklist, but the performance
claim has no numeric before-and-after measurement. For workspaces with chains of colliding names and
directory keys, the tests establish the resulting keys but do not measure the claimed improvement in
either CLI.
Code

pnpm/crates/cli/src/cli_args/pkg/report_keys.rs[R58-62]

+    let mut pending: Vec<usize> = (0..identities.len())
+        .filter(|&index| keyed_by_dir[index])
+        .collect();
+    while let Some(index) = pending.pop() {
+        if let Some(&shadowed) = name_keyed.get(identities[index].dir_key.as_str())
Relevance

● Weak

Closely matching benchmark-demand findings were rejected; this bugfix’s correctness tests
sufficiently cover the stated intent.

PR-#15888
PR-#16412

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Rule 3365159 requires numeric before-and-after evidence for a claimed performance improvement. The
new worklist is the performance change identified in the perf commit, while the supplied PR
description and tests contain no such measurement.

pnpm/crates/cli/src/cli_args/pkg/report_keys.rs[58-67]
pnpm11/pkg-manifest/commands/src/reportKeys.ts[44-50]
Skill: review-code

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 worklist change is presented as a performance improvement without numeric before-and-after results.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/pkg/report_keys.rs[58-67]
- pnpm11/pkg-manifest/commands/src/reportKeys.ts[44-50]

## Recommended Fix
Benchmark a representative workspace with chained collisions against the previous and current implementations in both CLIs. Include the measured results and run counts in the PR.

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

Dismiss ↗ | View ↗


Grey Divider

Context sources
✅ Compliance rules (platform): 63 rules
✅ Skills: review-code
✅ Cross-repo context — repo relationships
  Explored: repo: pnpm/pnpm.io (sha: 9b9db3f7) — View relationship
Review mode: ⚖️ Balanced: This is a behavioral fix implemented independently in Rust and TypeScript with subtle key-collision logic, warranting a careful single-pass review but not redundant extended passes.

Grey Divider

Tip of the day
💡 Did you know, you can keep summaries lean with Findings visible per group, which tucks the rest behind a View link

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit a90887f

Results up to commit e53552b ⚖️ Balanced


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


Remediation recommended
1. One changeset mixes both release lines 📘 Rule violation § Compliance
Description
The changeset lists the v11 packages and pacquet in a single frontmatter block rather than
separating the TypeScript and Rust fixes. Because this PR changes both CLIs, later release-note or
bump adjustments for one release line would also affect the other entry.
Code

.changeset/pkg-get-recursive-duplicate-names.md[R2-4]

+"@pnpm/pkg-manifest.commands": patch
+"pnpm": patch
+"pacquet": patch
Relevance

●● Moderate

Recent precedents both accept and reject identical split-changeset findings, so team behavior is
mixed.

PR-#16479
PR-#15895
PR-#15880

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new changeset places the v11 package targets and the v12 pacquet target together, while
checklist item 713436 requires separate changeset files when a PR changes both stacks.

Rule 713436: Changesets for pnpm v11 vs v12 (pacquet) must target the correct package and bump type
.changeset/pkg-get-recursive-duplicate-names.md[1-7]
pnpm11/pkg-manifest/commands/src/pkg.ts[88-100]
pnpm/crates/cli/src/cli_args/pkg.rs[211-221]

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 combined changeset targets both the v11 TypeScript packages and the v12 Rust CLI, contrary to the separate-changeset requirement for cross-version changes.

## Fix Focus Areas
- .changeset/pkg-get-recursive-duplicate-names.md[1-7]

## Recommended Fix
Keep the `@pnpm/pkg-manifest.commands` and `pnpm` patch entries in a v11 changeset. Add a separate changeset targeting only `pacquet`, with release-note text describing its fix.

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

Dismiss ↗ | View ↗


2. Collision chains slow recursive reports ✓ Resolved
Description
report_keys rebuilds and scans the directory-key set until no names move, and the TypeScript
assignReportKeys implementation repeats the same full-pass algorithm. When each moved project's
directory matches the next project's name, only one project moves per pass, making recursive reports
quadratic in the number of selected projects.
Code

pnpm/crates/cli/src/cli_args/pkg/report_keys.rs[R20-21]

+    let mut keyed_by_dir = initially_keyed_by_dir(identities);
+    while key_names_shadowed_by_dirs(identities, &mut keyed_by_dir) {}
Relevance

●● Moderate

Quadratic-performance findings are sometimes accepted, but this optimization is unbounded and lacks
close precedent.

PR-#14794
PR-#15581
PR-#13689

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Recursive get passes the full selected-project list into each selector. The existing tests
demonstrate a collision chain (first → second → third); extending that pattern by one project
makes the selectors perform another full pass. Rust also clones directory strings while rebuilding
its set on each pass.

pnpm/crates/cli/src/cli_args/pkg.rs[211-221]
pnpm/crates/cli/src/cli_args/pkg/report_keys.rs[50-69]
pnpm/crates/cli/src/cli_args/pkg/report_keys/tests.rs[36-43]
pnpm11/pkg-manifest/commands/src/pkg.ts[89-100]
pnpm11/pkg-manifest/commands/src/reportKeys.ts[18-23]
pnpm11/pkg-manifest/commands/src/reportKeys.ts[42-52]

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

## Issue description
Both recursive report-key implementations rescan every selected project for each link in a name–directory collision chain, producing quadratic work.

## Fix Focus Areas
- pnpm/crates/cli/src/cli_args/pkg/report_keys.rs[19-69]
- pnpm11/pkg-manifest/commands/src/reportKeys.ts[18-52]

## Recommended Fix
Build a mapping from names to projects once, seed a queue with projects initially keyed by directory, and propagate each newly occupied directory key through that queue. Move each project at most once while retaining the current order-independent key choices.

ⓘ 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 1, 2026
Repeating full passes until no name moved was quadratic for a chain
where each moved project's directory key equals the next project's
name. Follow each move through a name-to-project index instead, so
key assignment is linear in the number of selected projects.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 17:16
@zkochan

zkochan commented Oct 1, 2026

Copy link
Copy Markdown
Member Author

Replies to the Qodo review of e53552b:

  1. One changeset mixes both release lines: not changing this. AGENTS.md allows one changeset naming the TypeScript packages, "pnpm", and pacquet when the same release-note text applies to both. It does here: both CLIs lost the earlier duplicate-name project in the same way, and both now key it by directory.
  2. Collision chains slow recursive reports: fixed in a90887f. Shadowed names are now followed through a name-to-project index with a worklist, in both report_keys.rs and reportKeys.ts, so key assignment is linear in the number of selected projects.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@qodo-code-review

Copy link
Copy Markdown

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

@qodo-code-review

Copy link
Copy Markdown

PR Code Suggestions ✨

Warning

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

No code suggestions found for the PR.

@zkochan

zkochan commented Oct 1, 2026

Copy link
Copy Markdown
Member Author

On the Qodo "Recursive report speedup is unverified" insight for a90887f: not adding a benchmark. The change fixes the complexity of a loop that only goes past one pass for a contrived chain of names that match other projects' directories. Typical workspaces finish in a single pass either way, and neither the changeset nor the PR claims a measured speedup. The unit tests in both CLIs cover the chained case for correctness.


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

@zkochan
zkochan merged commit c82802b into main Oct 1, 2026
68 checks passed
@zkochan
zkochan deleted the fix/pkg-get-recursive-duplicate-names branch October 1, 2026 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants