fix: move URL install confirmation prompt before spinner (#2783)#2784
Merged
Conversation
The typer.confirm() prompt inside console.status() was overwritten by Rich's spinner animation, making extension add --from <url> appear hung. Move URL validation and the default-deny confirmation prompt before the spinner block so the user can see and respond to the [y/N] prompt.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a UX regression in specify extension add --from <url> where the confirmation prompt was rendered inside a Rich console.status() spinner and became invisible (making installs appear hung).
Changes:
- Move URL validation and the default-deny
typer.confirm()prompt to run before entering the spinner block. - Remove the duplicated URL validation/prompt logic from the URL install branch inside the spinner.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/__init__.py |
Reorders the URL warning/confirmation flow so the prompt is visible before the Rich status spinner starts. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Address PR review feedback: - Gate URL confirmation prompt on 'not dev' so --dev + --from does not show a confusing prompt for a URL path that will be ignored. - Escape from_url with rich.markup.escape() in both the warning panel and the download message to prevent markup injection via crafted URLs.
Address second round of PR review: - Remove unused urllib.request import from URL install path - Remove redundant re-import of rich.markup.escape; reuse safe_url computed before the spinner for download and error messages - Add test_add_from_url_prompts_before_spinner: asserts typer.confirm fires before console.status spinner to prevent github#2783 regression - Add test_add_from_url_cancel_exits_cleanly: asserts declining the prompt exits with code 0 and prints Cancelled
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2783 —
specify extension add --from <url>appears hung on 0.8.18 because thetyper.confirm()prompt is rendered inside theconsole.status()spinner block. Rich's spinner thread overwrites the prompt line, so the user only sees⠦ Installing extension: ...indefinitely.Changes
Move the URL validation and default-deny confirmation prompt before the
with console.status(...)block so the[y/N]prompt is visible and the user can respond.Testing
typer.confirm()output