Repository navigation
fix: apply trustPolicy to the pnpm version a project pins - #17038
Conversation
pnpm v12 resolves the pinned pnpm under the project's `trustPolicy`, `trustPolicyExclude`, and `trustPolicyIgnoreAfter`, as it resolves any other dependency. pnpm v11 resolved it with no trust policy at all, both when switching to the pinned version and when recording a pin the running pnpm already satisfies. A version whose trust evidence was downgraded therefore failed under one CLI and ran under the other (#16319). The trust failure is the intended behavior, so v11 now matches v12. `resolveManifestDependencies` and `resolvePackageManagerIntegrities` take the three settings (`PackageTrustPolicy`) and pass them to `resolveDependencies`. `switchCliVersion` and `syncEnvLockfile` pass them from the config. The store controller for the switch is already created from the full config, so `trustPolicy: no-downgrade` already fetches the full metadata the check reads. The trustPolicy docs of both versions now say the check covers the pinned pnpm. Part of pnpm/tasks#144 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
@coderabbitai review |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
PR Summary by QodoApply trust policy when resolving a project-pinned pnpm version
AI Description
Diagram
High-Level Assessment
Files changed (11)
|
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
Summary
Step 5 of pnpm/tasks#144 settles the parity drift left over from #16319. Related to pnpm/tasks#144.
Before this PR, the two CLIs resolved the pinned pnpm differently:
packageManager/devEngines.packageManager) undertrustPolicy,trustPolicyExclude, andtrustPolicyIgnoreAfter, like any other dependency.So a pinned version whose trust evidence was downgraded failed on v12 and ran on v11. #16319 settled that the failure is intended (pnpm v10.34.6 was republished with provenance to fix that report). This PR makes v11 apply the policy too.
Change (v11 only)
resolveManifestDependenciesandresolvePackageManagerIntegritiestake the three trust settings (PackageTrustPolicy) and pass them toresolveDependencies.switchCliVersion(switching to the pinned version) andsyncEnvLockfile(recording a pin the running pnpm already satisfies) pass them from the config.trustPolicy: no-downgradealready turns on the full metadata the check reads.pnpm withandpnpm self-updateare unchanged. They are separate flows, and self-update already checks its target version against the policy.Tests
resolveManifestDependencies.test.tsresolves@pnpm/[email protected], a trust downgrade, against the mock registry. It fails withERR_PNPM_TRUST_DOWNGRADEunderno-downgrade, and resolves undertrustPolicyExcludeand with the policy off. The test fails if the settings aren't passed toresolveDependencies.switchCliVersion.test.tsandsyncEnvLockfile.test.tscheck that the config's trust settings reachresolvePackageManagerIntegrities.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.
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.Summary by CodeRabbit
packageManagerordevEngines.packageManager. If a pinned version has downgraded trust evidence, pnpm stops before switching to it or recording it in the lockfile.