Skip to content

New rule to detect inactive patch authors#2426

Draft
benjaminmah wants to merge 20 commits intomozilla:masterfrom
benjaminmah:inactive-patch-authors
Draft

New rule to detect inactive patch authors#2426
benjaminmah wants to merge 20 commits intomozilla:masterfrom
benjaminmah:inactive-patch-authors

Conversation

@benjaminmah
Copy link
Copy Markdown
Contributor

@benjaminmah benjaminmah commented Jun 21, 2024

Resolves #1532.

Introduces a new rule to detect and unassign inactive patch authors on Phabricator.

If the patch is not already closed, it will be abandoned.

Checklist

  • Type annotations added to new functions
  • Docs added to functions touched in main classes
  • Dry-run produced the expected results
  • The to-be-announced tag added if this is worth announcing

Comment thread bugbot/rules/inactive_patch_author.py Outdated
rev_ids = {rev_id for bug in bugs.values() for rev_id in bug["rev_ids"]}
try:
inactive_authors = self._get_inactive_patch_authors(list(rev_ids))
except Exception as e:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would avoid using Exception as the error-catching type where possible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Makes sense! I removed the try-except block here: 243515d. I made sure to do a dry-run and noticed that I did not encounter any errors, so I don't think the exception handler is necessary.

Comment thread bugbot/rules/inactive_patch_author.py Outdated
Comment on lines +99 to +100
except Exception as e:
logging.error(f"Failed to abandon patch {rev_id} for bug {bugid}: {e}")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same as #2426 (comment)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed here: 3a88716

Comment thread bugbot/rules/inactive_patch_author.py Outdated
Comment on lines +122 to +124
except Exception as e:
logging.error(f"Error fetching revisions: {e}")
continue
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same as #2426 (comment)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed here: 9eabe77

Comment thread bugbot/user_activity.py Outdated
user["unavailable_until"] = phab_user["attachments"][
"availability"
]["until"]
except Exception as e:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same as #2426 (comment)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed here: d1b0350

@benjaminmah benjaminmah requested a review from suhaibmujahid July 3, 2024 15:53
@suhaibmujahid suhaibmujahid added the to-be-announced Improvements to be announced: send to dev-platform, firefox-dev and add to EE newsletter label Jul 8, 2024
@benjaminmah benjaminmah requested a review from marco-c July 29, 2024 13:18
@marco-c marco-c removed their request for review August 5, 2024 16:36
@marco-c
Copy link
Copy Markdown
Contributor

marco-c commented Aug 5, 2024

@suhaibmujahid I'm leaving this one for you since you started the review already.

Comment thread bugbot/rules/inactive_patch_author.py Outdated
Comment thread bugbot/rules/inactive_patch_author.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

to-be-announced Improvements to be announced: send to dev-platform, firefox-dev and add to EE newsletter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Detect inactive patch authors on Phabricator

3 participants