Repository navigation
fix(git-fetcher): detect a lockfile-less pnpm workspace as pnpm - #15660
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Warning Review limit reachedNext included review available in 5 minutes. View limit detailsLimit details: You’ve used all 10 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository: pnpm/pnpm/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
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 (3)
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe preferred package manager detector now selects pnpm from ChangesPreferred Package Manager Detection
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Suggested labels: Merge Risk: ⚪ Minimal · up to This change selects pnpm for lockfile-less Git checkouts with a pnpm workspace manifest while preserving explicit pins and supported lockfile precedence. No actionable merge-blocking risk remains. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change is limited to lockfile-less git-hosted workspaces, and existing build-permission checks remain in place. Previously cached packages may still retain the results of preparation with npm, so the fix may not take effect for every existing installation. Retained concerns
Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Hardening Proposals
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15660 +/- ##
=======================================
Coverage 91.92% 91.92%
=======================================
Files 1456 1456
Lines 196657 196660 +3
=======================================
+ Hits 180776 180784 +8
+ Misses 15881 15876 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.43174491976,
"stddev": 0.1358512231870849,
"median": 2.3703335911599996,
"user": 1.80372138,
"system": 1.67156236,
"min": 2.29899963666,
"max": 2.6811506126599998
},
{
"command": "pacquet@main",
"mean": 2.3109412977600003,
"stddev": 0.08939517543325176,
"median": 2.27994225366,
"user": 1.4241445800000003,
"system": 1.33507716,
"min": 2.23567489066,
"max": 2.48631753366
},
{
"command": "pnpr@HEAD",
"mean": 1.4153693124600002,
"stddev": 0.13603812803181312,
"median": 1.3645591881599999,
"user": 1.22864608,
"system": 1.1255473599999999,
"min": 1.2887981236600001,
"max": 1.6461552646600002
},
{
"command": "pnpr@main",
"mean": 1.3822563329600002,
"stddev": 0.08801584490981117,
"median": 1.34548863316,
"user": 1.26524978,
"system": 1.1471492599999997,
"min": 1.2954640696600002,
"max": 1.51531052966
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.32229342528,
"stddev": 0.022248214503231573,
"median": 0.31908220598000003,
"user": 0.33769368,
"system": 0.71176788,
"min": 0.29585581398000005,
"max": 0.36694565798
},
{
"command": "pacquet@main",
"mean": 0.26683580838000004,
"stddev": 0.03297547112922863,
"median": 0.2552804469800001,
"user": 0.28087018,
"system": 0.6386628799999999,
"min": 0.23307569698000002,
"max": 0.34513819698000003
},
{
"command": "pnpr@HEAD",
"mean": 0.35714648338000005,
"stddev": 0.0705009275365673,
"median": 0.35430796548000004,
"user": 0.3640047799999999,
"system": 0.70967238,
"min": 0.27496532098000004,
"max": 0.5015190469799999
},
{
"command": "pnpr@main",
"mean": 0.33271058628000005,
"stddev": 0.036963251221007604,
"median": 0.32577608498,
"user": 0.35395238000000007,
"system": 0.6805905800000001,
"min": 0.27807664498,
"max": 0.38956626198000005
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.010702595958181809,
"stddev": 0.001052821857643883,
"median": 0.01052842634,
"user": 0.00574001636363636,
"system": 0.005628683636363637,
"min": 0.00799607484,
"max": 0.01485792084
},
{
"command": "pacquet@main",
"mean": 0.009762958981843971,
"stddev": 0.0010483520175515817,
"median": 0.00959491484,
"user": 0.005365449574468085,
"system": 0.004993598581560284,
"min": 0.00802100184,
"max": 0.01358680584
},
{
"command": "pnpr@HEAD",
"mean": 0.00941620839244756,
"stddev": 0.0008785680358189978,
"median": 0.009341489840000002,
"user": 0.005414215664335668,
"system": 0.0045556524475524425,
"min": 0.00767240684,
"max": 0.012104604840000002
},
{
"command": "pnpr@main",
"mean": 0.009016747843508765,
"stddev": 0.0009140396867013888,
"median": 0.00893173084,
"user": 0.005438062877192978,
"system": 0.00412466561403509,
"min": 0.00733500384,
"max": 0.01271663284
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.011735518393388426,
"stddev": 0.003707036452557739,
"median": 0.010290171600000002,
"user": 0.006125376363636362,
"system": 0.00630142520661157,
"min": 0.0077197796,
"max": 0.0268917956
},
{
"command": "pacquet@main",
"mean": 0.013834099415950927,
"stddev": 0.0027863285552854667,
"median": 0.013528745600000001,
"user": 0.00710000539877301,
"system": 0.007579640122699385,
"min": 0.0100672876,
"max": 0.0245277756
},
{
"command": "pnpr@HEAD",
"mean": 0.012265718523857872,
"stddev": 0.002060058217066006,
"median": 0.011817476600000001,
"user": 0.006472646091370557,
"system": 0.0065279092385786795,
"min": 0.009350179600000001,
"max": 0.0221550386
},
{
"command": "pnpr@main",
"mean": 0.012942640698522166,
"stddev": 0.0029667282433717855,
"median": 0.012423724600000002,
"user": 0.006600555270935959,
"system": 0.0069927919211822676,
"min": 0.0083161736,
"max": 0.0252276346
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.57582375094,
"stddev": 0.11230019746960337,
"median": 2.51238310764,
"user": 2.03610546,
"system": 1.59170172,
"min": 2.48483387864,
"max": 2.80607337164
},
{
"command": "pacquet@main",
"mean": 2.54648167334,
"stddev": 0.09388440773482237,
"median": 2.50330645014,
"user": 2.0203571599999997,
"system": 1.51757642,
"min": 2.46722344164,
"max": 2.70223116864
},
{
"command": "pnpr@HEAD",
"mean": 1.5342655183400002,
"stddev": 0.187687525779429,
"median": 1.43504912464,
"user": 1.14191376,
"system": 1.1911183199999997,
"min": 1.3701534366399999,
"max": 1.92305966464
},
{
"command": "pnpr@main",
"mean": 1.51763497044,
"stddev": 0.12090578429439534,
"median": 1.5083722866399998,
"user": 1.0222907599999997,
"system": 1.1392210200000004,
"min": 1.37771637564,
"max": 1.73820895964
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.4171440948000001,
"stddev": 0.02241921166506251,
"median": 0.4206866624000001,
"user": 0.5992866199999998,
"system": 0.6783826399999999,
"min": 0.37962010490000003,
"max": 0.45273539590000006
},
{
"command": "pacquet@main",
"mean": 0.41929208529999995,
"stddev": 0.009759821053876464,
"median": 0.41848433240000005,
"user": 0.6078438199999999,
"system": 0.68538004,
"min": 0.40648900590000003,
"max": 0.43620366390000004
},
{
"command": "pnpr@HEAD",
"mean": 0.2770082072,
"stddev": 0.008642954199255237,
"median": 0.27897358240000003,
"user": 0.21977792,
"system": 0.55932464,
"min": 0.25545515490000004,
"max": 0.2867114069
},
{
"command": "pnpr@main",
"mean": 0.33884827280000007,
"stddev": 0.06497349812535003,
"median": 0.32013964040000004,
"user": 0.27512861999999993,
"system": 0.66845064,
"min": 0.2758127919,
"max": 0.4495511729
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.71528281322,
"stddev": 0.038824654671993024,
"median": 1.72284478812,
"user": 1.06027118,
"system": 0.9910024399999999,
"min": 1.6600648231200001,
"max": 1.7638568411200002
},
{
"command": "pacquet@main",
"mean": 1.7222444124199998,
"stddev": 0.03861743127312483,
"median": 1.71000419212,
"user": 1.08289698,
"system": 0.9591218399999999,
"min": 1.66946148212,
"max": 1.7832986241200002
},
{
"command": "pnpr@HEAD",
"mean": 0.30320493772,
"stddev": 0.00815120151369941,
"median": 0.30136362062,
"user": 0.24196368000000001,
"system": 0.5901179400000001,
"min": 0.29157125612,
"max": 0.32198751812
},
{
"command": "pnpr@main",
"mean": 0.31900556412000003,
"stddev": 0.05006050314463307,
"median": 0.30687250162,
"user": 0.27144828,
"system": 0.61368484,
"min": 0.26285422312,
"max": 0.39963586512
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.32549274444000004,
"stddev": 0.04446927787974893,
"median": 0.31841130734,
"user": 0.34750413999999996,
"system": 0.11620705999999999,
"min": 0.26778187584,
"max": 0.38899084184000005
},
{
"command": "pacquet@main",
"mean": 0.29339152594000006,
"stddev": 0.029786677851971324,
"median": 0.29563307684,
"user": 0.33538423999999994,
"system": 0.09938416,
"min": 0.23944115284,
"max": 0.32524772684000003
},
{
"command": "pnpr@HEAD",
"mean": 0.10130086469714285,
"stddev": 0.0034834947370915685,
"median": 0.10051089934,
"user": 0.04429736142857142,
"system": 0.017824767142857145,
"min": 0.09593010784,
"max": 0.11000640784
},
{
"command": "pnpr@main",
"mean": 0.10471149728444445,
"stddev": 0.004693713336849344,
"median": 0.10347136784000001,
"user": 0.04593602148148147,
"system": 0.02199132666666667,
"min": 0.09589180884000001,
"max": 0.11336477984
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.3428852491222223,
"stddev": 0.2353541435933266,
"median": 1.3852829999,
"user": 1.3463408555555556,
"system": 0.32265817333333335,
"min": 0.9159168319,
"max": 1.6479329619
},
{
"command": "pacquet@main",
"mean": 1.4234896511222221,
"stddev": 0.2874740313271399,
"median": 1.4328899729000002,
"user": 1.4465012999999998,
"system": 0.3413286177777778,
"min": 0.8682819579,
"max": 1.7719786029000002
},
{
"command": "pnpm@HEAD",
"mean": 5.356213517011111,
"stddev": 0.9935158179217768,
"median": 5.6820640749,
"user": 8.134637744444444,
"system": 0.4117939511111111,
"min": 3.8822497839,
"max": 6.7493999879
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.20806988363714285,
"stddev": 0.006064253782290965,
"median": 0.20624090578,
"user": 0.16668110571428568,
"system": 0.08486744571428571,
"min": 0.19880417178,
"max": 0.21810559978000002
},
{
"command": "pacquet@main",
"mean": 0.20439531036333333,
"stddev": 0.009677609139413361,
"median": 0.20157103828,
"user": 0.16439357,
"system": 0.07590816,
"min": 0.19777003978000002,
"max": 0.23290983978000002
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.56841077544,
"stddev": 0.1396332632920831,
"median": 4.54072882164,
"user": 1.75708488,
"system": 2.0205833599999994,
"min": 4.41895801414,
"max": 4.84087295814
},
{
"command": "pacquet@main",
"mean": 4.4254635350400005,
"stddev": 0.05613603197071271,
"median": 4.4239004066400005,
"user": 1.6204458800000001,
"system": 1.9819260599999997,
"min": 4.36670650814,
"max": 4.55253117814
},
{
"command": "pnpr@HEAD",
"mean": 3.4994527900399994,
"stddev": 0.061593993098058616,
"median": 3.48557750864,
"user": 1.56043668,
"system": 1.77978776,
"min": 3.4322347951400003,
"max": 3.61873649314
},
{
"command": "pnpr@main",
"mean": 3.5725080027400002,
"stddev": 0.11739487442128113,
"median": 3.5265361376400004,
"user": 1.6335183800000004,
"system": 1.8226194599999999,
"min": 3.42702166314,
"max": 3.7528178701400003
}
]
}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.17511255927333336,
"stddev": 0.030416400900314788,
"median": 0.17197553954,
"user": 0.2172797133333333,
"system": 0.17043719999999998,
"min": 0.13511663154,
"max": 0.25559173154000003
},
{
"command": "pacquet@main",
"mean": 0.20156185838615387,
"stddev": 0.02744375768441385,
"median": 0.19330739154,
"user": 0.23369902615384613,
"system": 0.2101948153846154,
"min": 0.16067244854,
"max": 0.27060297654
},
{
"command": "pnpr@HEAD",
"mean": 0.22524190620666665,
"stddev": 0.03302074400094648,
"median": 0.22007121904,
"user": 0.25810759666666666,
"system": 0.18905161666666667,
"min": 0.16503084754,
"max": 0.28373113554
},
{
"command": "pnpr@main",
"mean": 0.25003834973999994,
"stddev": 0.023511946329887252,
"median": 0.25211067854,
"user": 0.27429497999999997,
"system": 0.19957019999999998,
"min": 0.22027175154,
"max": 0.28243544454
}
]
} |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
A pnpm workspace is defined by pnpm-workspace.yaml, and committing a lockfile is optional (lockfile: false). detect_preferred_pm only sniffed pnpm-lock.yaml, so a git-hosted dependency that is a pnpm workspace with no committed lockfile fell through to npm. prepare_package then ran the install stage with npm, which honours the dependency's own .npmrc ignore-scripts and skips the build, leaving no dist/. Consult the manifest once every lockfile has had its say, so it breaks only the no-lockfile tie: a dependency that ships a lockfile has named what installs it, and that is stronger evidence than a config file. This is the precedence preferred-pm uses, consulting the manifest in its fallback stage (zkochan/packages#238), which keeps the two stacks aligned. Refs pnpm#14011
5ce6144 to
fd20977
Compare
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
Code review by qodo was updated up to the latest commit ab8da43 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
zkochan
left a comment
There was a problem hiding this comment.
LGTM! Rebased onto main, added changeset for pacquet patch release, cleaned doc comments adhering to AGENTS.md conventions, and all CI checks are passing.
#16301) preferred-pm recognized pnpm only by a pnpm-lock.yaml, so a git-hosted dependency that is a pnpm workspace without a committed lockfile fell back to npm. npm then honoured the dependency's own .npmrc settings, such as ignore-scripts, and could skip the build. preferred-pm 5.0.1 also looks for pnpm-workspace.yaml once no lockfile in the package directory names a package manager. That matches the order the v12 git fetcher uses since #15660, where a lockfile still wins over the workspace file. The test asserts which lockfile the prepare step leaves behind. It only fails without the fix when no ancestor of the test directory holds a pnpm-lock.yaml, because preferred-pm searches parent directories for one. Closes #14011
Summary
Related to #14011 — this is the detection half. Not
Closes: the issue also tracks the v11 side and a suggested CLI override, neither of which this PR delivers (see "Out of scope" below).detect_preferred_pmsniffed only lockfiles, so a git-hosted dependency that is a pnpm workspace with no committed lockfile fell through to thePreferredPm::Npmdefault. Committing a lockfile is optional in a pnpm workspace (lockfile: false), andpnpm-workspace.yamlis what declares the workspace, so that project is a pnpm project with nothing naming it as one.prepare_packagethen ran the install stage with npm, which honours the dependency's own.npmrcignore-scriptsand skips the build — the dependency lands in the consumer'snode_moduleswith nodist/.The fix consults
pnpm-workspace.yamlafter every lockfile check, so it breaks only the no-lockfile tie. A dependency that ships a lockfile has named what installs it, and that is stronger evidence than a config file. This is the precedencepreferred-pmuses — it consults the manifest in its fallback stage, after the same-directory lockfile checks (zkochan/packages#238) — which keeps v11 and v12 aligned rather than introducing a third ordering.Out of scope, both flagged in the issue and neither a detection problem:
preferred-pmpackage, so it is fixed by zkochan/packages#238 landing and a dependency bump, not by a change in this repo. Calling it out perAGENTS.md, since a shared bug fix cannot be completed in both stacks in one PR here.Squash Commit Body
Checklist
already linked to it solves it.
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.
Checklist notes: the v11 half of the "every affected version" item is the external
preferred-pmbump described above, not a change in this tree.How this was tested
Red-green on the three new cases in
pnpm/crates/git-fetcher/src/preferred_pm/tests.rs. Withpreferred_pm.rsreverted tomainand only the tests applied:The third is a precedence guard, so it passes on both sides by design — it is there to fail if the manifest is ever promoted above a shipped lockfile. With the fix applied:
preferred_pm26/26, wholepnpm-git-fetchercrate 130/130, the git-dependency end-to-end suites (git_hosted_install::,cargo_git_install::,git_branch_lockfile::) 51/51, andpnpm test:rust-affected23/23.cargo clippy --locked -p pnpm-git-fetcher --all-targets -- --deny warningsclean.One thing worth recording, because it looks like an obvious e2e assertion and is not: I first wrote an end-to-end case asserting that the dependency's
preparescript sees apnpm/npm_config_user_agent, then checked it against the reverted fix and it still passed.run_install_and_prepublishruns the detected package manager's install through pnpm's own lifecycle executor, so that environment variable names pnpm whichever way detection resolved, and the install-stage lockfile does not survive into the installed package either. The test could not distinguish the two outcomes, so I dropped it rather than leave a case that passes either way; the contract is pinned atdetect_wanted_pm, which is the functionprepare_package.rs:115actually calls.Written by an agent (Antigravity).
Summary by CodeRabbit