Repository navigation
fix(pkg): keep projects that share a name in pkg get -r output - #16494
Conversation
`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]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (2)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pnpm/pnpm/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughRecursive ChangesRecursive pkg get
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Suggested labels: Merge Risk: ⚪ Minimal · up to 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 ReviewSecurity architecture risk: 🔵 Low · up to 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 Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ESLint
pnpm11/pkg-manifest/commands/src/reportKeys.tsESLint 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. Comment |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Micro-Benchmark ResultsLinux |
Same-run regression checkHEAD 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.
Integrated-Benchmark Report (Linux)Commit: 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
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
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
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
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
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
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
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
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
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
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
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 storeSame 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.
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
}
]
} |
PR Summary by QodoPreserve duplicate-name projects in recursive pkg get output
AI Description
Diagram
High-Level Assessment
Files changed (12)
|
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
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]>
|
Replies to the Qodo review of e53552b:
Written by an agent (Claude Code, claude-opus-5-5). |
|
Code review by qodo was updated up to the latest commit a90887f |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
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). |
Summary
pnpm -r pkg getbuilds 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 v12pkgdocs updated.Found while closing #15871 in favor of
pnpm -r pkg get version.Squash Commit Body
Checklist
are implemented in every affected version.
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-opus-5-5).
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
Bug Fixes
pkg getnow 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
pkg getchooses result keys, including when names are missing, duplicated, or conflict with directory keys.