Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Gracefully handle r? of invalid user #300

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

camelid
Copy link
Member

@camelid camelid commented Dec 6, 2020

Don't crash; instead post a comment saying that the user couldn't be
assigned.

Also handle r? @ghost properly: treat it as clearing all assignees but
still do the other things that highfive normally does (e.g. setting
S-waiting-on-review).

r? @pietroalbini

Don't crash; instead post a comment saying that the user couldn't be
assigned.

Also handle `r? @ghost` properly: treat it as clearing all assignees but
still do the other things that highfive normally does (e.g. setting
`S-waiting-on-review`).
@camelid
Copy link
Member Author

camelid commented Dec 6, 2020

Hmm, I'm not sure how to update the tests. There are some other spots that reference the 'assignee' API field; do I need to update them too?

rg "'assignee'"
highfive/newpr.py
426:                self.payload['issue', 'assignee'] \
427:                and commenter == self.payload['issue', 'assignee', 'login']

highfive/tests/test_newpr.py
911:                'assignee': None,
933:            payload._payload['issue']['assignee'] = {'login': assignee}

@pietroalbini
Copy link
Member

Before this PR if an unassignable person was mentioned in a r? command the processing of the webhook completly stopped, as the exception bubbled up. This PR changes that, and the handler is called even if an unassignable person was assigned. This also means one of the features of r? @ghost (not labelling the PR and not showing "foo changed bar" comments) is now broken, as those things will still be done when people r? @ghost a PR.

The easiest fix for this is to continue raising the exception if the person is unassignable, but show the error message before if the user is @ghost. Otherwise we'd need to change all of highfive to disable things on r? @ghost.

@camelid
Copy link
Member Author

camelid commented Dec 7, 2020

Skipping the S-waiting-on-review label is considered a feature of r? @ghost? I've felt that it's a bug because then wg-triage will lose PRs. I feel like people should just remove S-waiting-on-review and add S-experimental if they really want to.

not showing "foo changed bar" comments

But won't that also skip showing the submodule warning? I feel like we should treat r? @ghost PRs the same as all other PRs, the only difference being that we assign nobody.

@Mark-Simulacrum
Copy link
Member

r? @ghost PRs should be treated as "null don't look" IMO, not assigned, not pinged, etc. -- minimal footprint. e.g. if I'm just opening for a perf run, I don't want to ping if I've changed submodules etc. If you do want to ping or get wg-triage to ping, do r? @Mark-Simulacrum (for example for me), i.e., assign yourself.

Apparently people prefer the old `r? @ghost` behavior. Now the only
difference is that `r? @ghost` will unassign anyone already assigned
(e.g. if you use `r? @ghost` after highfive has already assigned
someone).
self.api_req(
"PATCH", issue_url % (owner, repo, issue),
{"assignee": assignee}
{"assignees": assignees}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR also updates highfive to no longer use assignee: it's deprecated, and I don't we would be able to clear assignees easily otherwise. I'm not sure what the old behavior was when there were multiple assignees though. When looking at the paylod, I just look at the first assignee.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually now I'm just checking if the assignee is a member of assignees.

@camelid
Copy link
Member Author

camelid commented Dec 7, 2020

Ugh, I miss you rustc!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants