fix(cli): use click.Choice in cf proof capture (#723)#795
Conversation
…exist) (#723) The interactive capture path prompted severity/source with type=typer.Choice(), but typer has no Choice attribute — any 'cf proof capture' run without --severity/--source raised AttributeError with an uncaught traceback, breaking the command's own documented interactive usage. typer.prompt delegates to click.prompt, so use click.Choice. Closes #723
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 9 seconds Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Code ReviewSummary: Targeted P0 bug fix — replaces the nonexistent What's right
Minor nitThe test asserts assert req.source.value == "qa" # or however source is typed on the modelNot a blocker — the crash-path is already proven fixed — but it would close the loop on both repaired sites. VerdictApprove. The fix is correct, the change is minimal, and the test exercises the exact failure mode. The nit above is optional hardening, not a requirement for merge. |
|
Thanks — added |
|
The One remaining nit I missed in the first pass: the rest of the CLI passes type=click.Choice(["critical", "high", "medium", "low"], case_sensitive=False),
# and
type=click.Choice(["production", "qa", "dogfooding", "monitoring", "user_report"], case_sensitive=False),Otherwise this is ready to go. |
What & why
The interactive
cf proof capturepath prompted for severity and source withtype=typer.Choice([...])— but typer has noChoice(onlyclick.Choice). So anycf proof capturerun without--severity/--sourceraisedAttributeErrorwith an uncaught traceback, breaking the command's own documented interactive usage.Fixes #723 [P0.12].
Change
import clickand useclick.Choiceat both prompt sites.typer.promptdelegates toclick.prompt, which accepts aclick.Choicetype, so the interactive input is now constrained correctly.Tests
test_capture_interactive_prompts_do_not_crashdrives the interactive branch (title/description/where via flags, severity+source via stdin) and asserts a clean capture (exit 0, REQ-0001, severity persisted). This is the branch existing tests skipped (they always pass--severity/--source).18 passed.ruff+mypyclean.Demo
Acceptance criteria
cf proof captureprompts for severity/source without crashing (click.Choice)