fix: respect pmOnFail ignore in self-update#12231
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
📝 WalkthroughWalkthroughThis PR centralizes shouldPersistLockfile in ChangesLock file persistence conditional on package manager policy
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. 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 |
Review Summary by QodoRespect pmOnFail ignore in self-update lockfile persistence
WalkthroughsDescription• Move shouldPersistLockfile logic to @pnpm/config.reader for consistency • Respect pmOnFail: ignore policy in self-update lockfile persistence • Prevent writing packageManagerDependencies when policy is ignore • Add test coverage for ignore policy behavior Diagramflowchart LR
A["shouldPersistLockfile moved<br/>to config.reader"] --> B["Self-updater uses<br/>shared gate"]
B --> C["Respects onFail: ignore<br/>policy"]
C --> D["No packageManagerDependencies<br/>written to lockfile"]
File Changes1. config/reader/src/index.ts
|
| } | ||
| return lockfilePinned ?? specMin | ||
| } | ||
|
|
acefdb4 to
0750a86
Compare
|
Updated in
Checks run locally: The local pre-push hook itself could not run verbatim because this environment has no global |
0750a86 to
76c5d24
Compare
Fixes #12228.
syncEnvLockfilealready avoids writingpackageManagerDependencieswhen package manager checks are disabled, butpnpm self-updatecalledresolvePackageManagerIntegrities()directly fordevEngines.packageManagerprojects and could add the lockfile section despitepmOnFail: ignore.This moves the lockfile persistence policy into
@pnpm/config.readerso both CLI startup/switching and the self-updater use the same gate, includingonFail: ignore.Tests:
jest test/self-updater/selfUpdate.test.ts --runInBand --testNamePattern "package manager onFail is ignore"fromengine/pm/commands: 1 passedjest src/shouldPersistLockfile.test.ts --runInBand --globalSetup= --globalTeardown= --coverage=falsefrompnpm: 4 passedeslint config/reader/src/index.ts pnpm/src/shouldPersistLockfile.ts pnpm/src/shouldPersistLockfile.test.ts engine/pm/commands/src/self-updater/selfUpdate.ts engine/pm/commands/test/self-updater/selfUpdate.test.tstsgo --build config/reader/tsconfig.jsontsgo --build engine/pm/commands/tsconfig.jsontsgo --build pnpm/tsconfig.jsongit diff --checkNote: the repository pre-push hook was not used for the final push because the local Windows environment does not expose the project
pnpm/pn/pnxshims globally; I ran the targeted checks above directly.Summary by CodeRabbit
Bug Fixes
onFail: ignore/pmOnFail: ignore).Tests
Chores
Written by an agent (OpenAI Codex, GPT-5).