-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Needinfo the author or reviewer for inactive revisions on Phabricator #2417
base: master
Are you sure you want to change the base?
Conversation
Still a WIP! |
…tches rather than inactive reviewers
@suhaibmujahid Since this PR introduces a new rule, would we have to update https://wiki.mozilla.org/BugBot? |
@benjaminmah could you dry-run it and share the results? |
Here are the results of the dry-run: dryrun.log |
) | ||
return response["data"] | ||
|
||
def handle_bug(self, bug, data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of querying bugs and then finding revisions attached to the bugs, we could search for revisions directly. WDYT @suhaibmujahid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to query the bugs anyway to ensure we did not comment on them. All the queried bugs have attached revisions. Doing it the other way could be more efficient (not sure), but it will be a bit more complex since BzCleaner
is designed to start from bugs.
@@ -0,0 +1,3 @@ | |||
:{{ nicknames }}, your patch is still waiting for action. Could you please address the feedback from the reviewer {%- if has_old_patch %} or consider abandoning the patch if it is no longer relevant {%- endif %}? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A problem I see with this is if the reviewer's last action is something like adding a comment saying "I'll get to this soon". I guess we have to accept this will never be entirely precise :)
I checked three random results from the dry-run and they looked OK. @benjaminmah could you double-check three random ones yourself too to make sure they look good? In case of any doubts, feel free to ask me or @suhaibmujahid for our input |
Here are the results of the dry-run: results.log Overall, the randomly selected results seem okay. However, as you mentioned in your other comment, there are a few cases where the reviewer/author leaves a comment without expecting a response (e.g. "Will work on this"). However, not sure if there is an easy way to identify these types of comments. |
To be extra cautious, let's add a limit of 1 action per day so we can see the impact. |
I've enforced a limit for Let me know if this looks okay! |
bugbot/rules/inactive_revision.py
Outdated
# You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
import re | ||
from typing import Dict, List |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us use dect
and list
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done here: 8172791
abandon the patch as an option. | ||
patch_activity_months: Number of months since the last activity on the patch. | ||
""" | ||
super(InactiveRevision, self).__init__() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super(InactiveRevision, self).__init__() | |
super().__init__() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All other rules in BugBot include the rule name and self
, so I was thinking we could keep it as it is for consistency. Please let me know if you think otherwise and I can go ahead with this change.
for _rev_ids in Connection.chunks(rev_ids, PHAB_CHUNK_SIZE): | ||
for revision in self._fetch_revisions(_rev_ids): | ||
if ( | ||
len(revision["attachments"]["reviewers"]["reviewers"]) == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no reviewer, we may still want to notify the author.
bugbot/rules/inactive_revision.py
Outdated
if ( | ||
last_transaction | ||
and last_transaction["dateCreated"] < self.patch_activity_limit | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be more explicit if you flip the condition and use continue
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Done here: 69385c6.
if comment["creator"] == History.BOT and comment["raw_text"].startswith( | ||
"The following patch" | ||
): | ||
rev_ids_with_ni.update( | ||
int(id) for id in PHAB_TABLE_PAT.findall(comment["raw_text"]) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches comments from the 'inactive_reviewer' rule, but not from this rule. Also, we do not list patch IDs in the needinfo comments, so this is not going to work.
) | ||
return response["data"] | ||
|
||
def handle_bug(self, bug, data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to query the bugs anyway to ensure we did not comment on them. All the queried bugs have attached revisions. Doing it the other way could be more efficient (not sure), but it will be a bit more complex since BzCleaner
is designed to start from bugs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vote for the third option (create some util functions) or the second (merge the two rules into one).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, I think creating util functions will reduce duplicate code while still keeping the rule separate. Similar to the no_severity
rule, the first step could be to needinfo the pending needinfo'er (which could be the reviewer or author) and the second step could be to unblock bugs and find an active reviewer. Of course, these would be separate rules to avoid having complex multi-step rules similar to no_severity
. WDYT?
Resolves #1533.
Intended to:
Checklist
to-be-announced
tag added if this is worth announcing