fix(init): remove triple confirm prompt on Windows CP950 terminals (#602)#647
fix(init): remove triple confirm prompt on Windows CP950 terminals (#602)#647sergio-sisternes-epam wants to merge 2 commits intomicrosoft:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a Windows non-UTF-8 terminal (e.g., CP950) regression where apm init could show the overwrite confirmation prompt multiple times by removing the Rich Confirm.ask() + fallback pattern and always using click.confirm() for the overwrite prompt.
Changes:
- Replace Rich overwrite confirmation (and fallback) with a single
click.confirm()call inapm init. - Add regression tests ensuring the overwrite prompt appears once and that
click.confirmis the mechanism used. - Add a
Fixedentry toCHANGELOG.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/apm_cli/commands/init.py | Simplifies overwrite confirmation prompt to use click.confirm() directly to avoid Rich input-decoding retries on Windows code pages. |
| tests/unit/test_init_command.py | Adds regression coverage for single prompt emission and validates click.confirm usage. |
| CHANGELOG.md | Documents the fix under ## [Unreleased] / ### Fixed. |
…icrosoft#602) Replace Rich Confirm.ask() with click.confirm() for the overwrite prompt in 'apm init'. Rich's internal retry on encoding errors caused the prompt to appear up to three times on Windows CP950 terminals. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
5d24126 to
d212d03
Compare
APM Review Panel — PR #647[!] Verdict: REQUEST CHANGES — three must-fix items before merge Re-running the panel verdict with stricter gating: the items below are all same-PR required, not optional follow-ups. The fix itself is correct and well-tested — but the CHANGELOG drift and the residual CP950 bugs in two other call sites mean we'd be shipping a "fixes #602" PR that leaves #602's bug class half-fixed, plus a duplicate changelog line. Already approved earlier by @danielmeppiel — superseding with REQUEST CHANGES so the items below land before merge. What's excellent
Required changes (must land in this PR)
A Cleanup also wanted (low-effort, same PR)
Optional polish
Merge callLand items 1-4 in this PR, then re-request review. The bug fix itself is excellent — the test design alone is worth merging. But the scope is half of #602, and we should ship the full reproduction fix in one PR rather than chase the same bug across follow-ups. With the three call-site changes plus the CHANGELOG cleanup, this becomes a definitive close on the CP950 confirmation-prompt class. Growth angle
Thanks @sergio-sisternes-epam — happy to re-approve as soon as the four required items land. The fix you've already shipped here is the template; extending it to the two siblings is mechanical. Reviewed via the apm-review-panel skill: python-architect, cli-logging-expert, devx-ux-expert; convergent verdict, escalated to REQUEST CHANGES on follow-up scope. |
danielmeppiel
left a comment
There was a problem hiding this comment.
Escalating to REQUEST CHANGES per the updated panel verdict above (#647 (comment)). Three required same-PR items:
- Drop the duplicate
#622CHANGELOG line (already shipped in v0.8.12 at CHANGELOG.md:70). - Fix
Confirm.ask()atsrc/apm_cli/commands/init.py:212— same file, same command, same bug class. - Fix
Confirm.ask()atsrc/apm_cli/commands/deps/cli.py:455— same triple-prompt failure mode on CP950.
Plus a low-effort cleanup (delete dead _lazy_confirm() helper in _helpers.py:103, zero callers after this PR).
The fix you've already shipped here is correct and well-tested — the test design (output.count(...) == 1) is exemplary. Extending it to the two sibling call sites is mechanical and gives us a definitive close on the CP950 confirmation-prompt class in one PR rather than chasing it across follow-ups.
Happy to re-approve as soon as the four items land. This supersedes my earlier approval.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d212d03 to
5a1729d
Compare
Summary
Fixes #602 — On Windows systems with non-UTF-8 console encoding (CP950, CP936, CP932),
apm initin an existing project showed the overwrite confirmation prompt three times.Root Cause
Rich
Confirm.ask()would:exceptblock calledclick.confirm()again (prompt Will there be MCP coverage? #3)Fix
Simplified the overwrite confirmation to always use
click.confirm()directly. This is a simple y/n prompt where cross-platform reliability matters more than Rich styling. The interactive setup section retains its own Rich/click fallback pattern.Changes
src/apm_cli/commands/init.py— Replace Rich Confirm.ask fallback with directclick.confirm()(-9 lines, +1 line)tests/unit/test_init_command.py— Add 2 regression testsCHANGELOG.md— Add fix entryTesting
All 17 init tests pass. Two new regression tests verify:
click.confirmis the function called (not Rich)