Repository navigation
Fix removal of team review request - #9360
Conversation
The review assignment script attempted to remove the binaryen-reviewers team review request after selecting a particular team member to assign the review to. But the API call to remove the request was missing the required `reviewers` field. Fix it.
There was a problem hiding this comment.
Code Review
This pull request updates the GitHub API call in scripts/assign_reviewer.py to include the reviewers[] parameter when removing requested reviewers. However, it also removes the try...except block that handled API call failures. The reviewer correctly notes that removing this error handling makes the script fragile to transient API issues and recommends restoring the try-except block to allow the script to fail gracefully.
| gh_api([ | ||
| '--method', | ||
| 'DELETE', | ||
| f'repos/{owner}/{name}/pulls/{pr_number}/requested_reviewers', | ||
| '-f', | ||
| 'reviewers[]', | ||
| '-f', | ||
| f'team_reviewers[]={TEAM_SLUG}', | ||
| ]) |
There was a problem hiding this comment.
Removing the try...except block makes the script fragile. If the DELETE request to remove the team review request fails (for example, due to transient GitHub API issues or permission limitations), the entire script will crash with an unhandled subprocess.CalledProcessError. Since the primary action of assigning the individual reviewer has already succeeded, this cleanup step should fail gracefully rather than crashing the script.
| gh_api([ | |
| '--method', | |
| 'DELETE', | |
| f'repos/{owner}/{name}/pulls/{pr_number}/requested_reviewers', | |
| '-f', | |
| 'reviewers[]', | |
| '-f', | |
| f'team_reviewers[]={TEAM_SLUG}', | |
| ]) | |
| try: | |
| gh_api([ | |
| '--method', | |
| 'DELETE', | |
| f'repos/{owner}/{name}/pulls/{pr_number}/requested_reviewers', | |
| '-f', | |
| 'reviewers[]', | |
| '-f', | |
| f'team_reviewers[]={TEAM_SLUG}', | |
| ]) | |
| except subprocess.CalledProcessError as e: | |
| detail = e.stderr.strip() if e.stderr else str(e) | |
| print( | |
| f'Note: could not remove team review request: {detail}', | |
| file=sys.stderr, | |
| ) |
There was a problem hiding this comment.
I'd rather hear loudly about failures, even after the main action has been completed successfully.
The review assignment script attempted to remove the binaryen-reviewers team review request after selecting a particular team member to assign the review to. But the API call to remove the request was missing the required
reviewersfield. Fix it.