Repository navigation
fix(change): exit cleanly when an interactive prompt is canceled - #13817
Conversation
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? |
📝 WalkthroughWalkthroughThe ChangesChange prompt cancellation
Estimated code review effort: 2 (Simple) | ~10 minutes Assessment against linked issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ 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 |
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (2): Last reviewed commit: "test(change): cover every prompt that ca..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pnpm11/releasing/commands/test/change/cancel.test.ts`:
- Around line 41-65: Expand the cancellation tests around the change handler to
cover both bump-selection checkbox prompts and the summary input, asserting
globalInfo receives exactly “Change canceled” and process.exit is called with 0.
Add a separate case verifying non-ExitPromptError failures are rethrown
unchanged, while preserving the existing package-selection coverage, and run the
focused Jest test for this file.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2d37546c-9f84-473e-875a-3b414431bfaa
📒 Files selected for processing (3)
.changeset/change-prompt-cancel.mdpnpm11/releasing/commands/src/change/index.tspnpm11/releasing/commands/test/change/cancel.test.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pnpm11/releasing/commands/test/change/cancel.test.ts`:
- Around line 49-53: Update exitPromptError and the cancellation tests to
construct ExitPromptError from a separate node:vm context, ensuring cross-realm
native errors are covered rather than relying on instanceof Error. Extend the
expectExit() assertions to verify the cancellation output contains “Change
canceled” in addition to process.exit(0).
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 4344dbc4-f57f-4520-99c9-6c1e28f3d4c4
📒 Files selected for processing (2)
pnpm11/releasing/commands/src/change/index.tspnpm11/releasing/commands/test/change/cancel.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- pnpm11/releasing/commands/src/change/index.ts
Summary
Closes #13814.
Ctrl-c out of a
pnpm changeprompt and theExitPromptErrorthat@inquirer/promptsthrows travels all the way to the top-level handler, so backing out of the command ends in an error line plus a stack trace through pnpm's own internals. Every other interactive command already catches that error name at its prompt:update,audit --fix,approve-builds,patch remove,login,publish.changenow does the same, following whatupdatedoes with it: printChange canceledand exit 0. The catch sits aroundrecordChange, which covers all four prompts it can stop at (the package picker, the two bump pickers, the summary input).pnpm change statusnever prompts, so it stays outside the catch.The Rust port needs nothing here. dialoguer reads keys through console's
read_key, which re-raisesSIGINTon Ctrl-c, so pacquet'spnpm changealready ends quietly.Squash Commit Body
Checklist
already linked to it solves it.
pnpm/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
Bug Fixes
Tests