fix: update poly review --delete to interactive select-and-delete flow#47
Merged
oeisenberg merged 13 commits intomainfrom Mar 30, 2026
Merged
fix: update poly review --delete to interactive select-and-delete flow#47oeisenberg merged 13 commits intomainfrom
oeisenberg merged 13 commits intomainfrom
Conversation
Replace bulk-delete behaviour with a questionary.checkbox prompt so users can select individual review gists to delete rather than removing all at once. Adds list_diff_gists() and delete_gist() helpers to GitHubAPIHandler. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
- Format gist choices as: date short-hash description - Use 7-char gist ID (git commit style) instead of first3...last3 - Include account/project name in branch-comparison gist descriptions - Add --list flag to interactively select and open a gist in the browser - Extract _format_gist_choice as module-level helper Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…rs (#49) ## Summary - Converts `poly review list` and `poly review delete` from a positional `action` argument to proper argparse subparsers, so each subcommand owns only its relevant flags (`--id` now only appears under `poly review delete --help`) - Applies the same refactor to `poly branch` (`list`, `create`, `switch`, `current`), so `--force`, `--format`, `--from-projection` etc. only appear under `poly branch switch --help` for standardisation ## Test plan - [x] `poly review --help` no longer shows `--id` - [x] `poly review delete --help` shows `--id` - [x] `poly branch switch --help` shows `--force`, `--format`; `poly branch list --help` does not - [x] All existing commands still work end-to-end - [x] 391 tests pass <img width="742" height="205" alt="image" src="https://github.com/user-attachments/assets/c6f4e123-b779-443f-9842-53e53671ae59" /> <img width="942" height="512" alt="image" src="https://github.com/user-attachments/assets/5a9c07e0-7448-4153-9619-eae293071fa8" /> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Ruari Phipps <ruari@poly-ai.com>
This comment has been minimized.
This comment has been minimized.
The second match clause `gist_id.startswith(g["id"][:7])` was backwards: it matched any user-supplied ID that *starts with* a stored gist's 7-char prefix, meaning a non-existent ID like "abc1234xyz" would silently delete gist "abc1234yyy". The first clause `g["id"].startswith(gist_id)` already handles both full IDs and short 7-char prefixes correctly on its own. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When output_json=True, HTTP and OS errors were being printed via error()
instead of json_print(), breaking the machine-readable contract. Now
consistent with delete_gists and review which both emit
{"success": false, "message": "..."} on error.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The subparser refactor moved --json off the top-level branches_parser, breaking the previously valid `poly branch --json list` form. Restoring json_parent to branches_parser and removing it from each subparser fixes the regression: --json is now parsed at the top level so both `poly branch --json list` and `poly branch list` work correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The CLI now calls list_diff_gists() and delete_gist() directly, leaving delete_diff_gists() with no callers. Removing the dead code. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Comment on lines
+58
to
+65
| def _format_gist_choice(g: dict) -> str: | ||
| """Format a gist dict as a human-readable choice label.""" | ||
| id_hint = g["id"][:7] | ||
| date = g.get("created_at", "")[:10] # YYYY-MM-DD | ||
| parts = [p for p in [date, id_hint, g["description"]] if p] | ||
| return " ".join(parts) | ||
|
|
||
|
|
Collaborator
There was a problem hiding this comment.
Could maybe put in output/console
Ruari-Phipps
approved these changes
Mar 27, 2026
Co-authored-by: Ruari Phipps <ruari@poly-ai.com>
Contributor
Coverage Report
Changed file coverage
|
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
Diff for account/projecttoPoly ADK: local → remote/project: before → afterpoly review --deletebulk-delete with aquestionary.checkboxprompt so users can select individual gists to deletepoly review --listto interactively select and open a gist in the browserlist_diff_gists()anddelete_gist()helpers toGitHubAPIHandler; refactorsdelete_diff_gists()to use them--jsonflag for outputting results using JSONtests/review_test.pypoly review listandpoly review deletefrom a positionalactionargument to proper argparse subparsers, so each subcommand owns only its relevant flags (--idnow only appears underpoly review delete --help)poly branch(list,create,switch,current), so--force,--format,--from-projectionetc. only appear underpoly branch switch --helpfor standardisationTest plan
poly reviewto create one or more review gistspoly review --deleteand verify the checkbox menu appears listing gists by descriptionpoly review --listand confirm a select menu appears; selecting a gist opens it in the browser🤖 Generated with Claude Code