Skip to content
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

673: PR author should be able to use /reviewers command #820

Closed
wants to merge 3 commits into from

Conversation

@edvbld
Copy link
Member

@edvbld edvbld commented Sep 14, 2020

Hi all,

please review this patch that allows pull request author's to issue the /reviewers command (sometimes the PR author knows ahead of time that it is a complicated to PR to review).

Testing:

  • make test passes on Linux x64
  • Added one additional unit test

Thanks,
Erik


Progress

  • Change must not contain extraneous whitespace
  • Change must be properly reviewed

Issue

  • SKARA-673: PR author should be able to use /reviewers command

Reviewers

Download

$ git fetch https://git.openjdk.java.net/skara pull/820/head:pull/820
$ git checkout pull/820

673
@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Sep 14, 2020

👋 Welcome back ehelin! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot changed the title 673 673: PR author should be able to use /reviewers command Sep 14, 2020
@openjdk openjdk bot added the rfr label Sep 14, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Sep 14, 2020

@edvbld The following label will be automatically applied to this pull request: bots.

When this pull request is ready to be reviewed, an RFR email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label (add|remove) "label" command.

@openjdk openjdk bot added the bots label Sep 14, 2020
@mlbridge
Copy link

@mlbridge mlbridge bot commented Sep 14, 2020

Webrevs

@kevinrushforth
Copy link
Member

@kevinrushforth kevinrushforth commented Sep 14, 2020

I presume that the author cannot reduce the number of reviewers once it has been increased, unless they are also a "R"eviewer?

@@ -49,8 +49,8 @@ private void showHelp(PrintWriter reply) {

@Override
public void handle(PullRequestBot bot, PullRequest pr, CensusInstance censusInstance, Path scratchPath, CommandInvocation command, List<Comment> allComments, PrintWriter reply) {
if (!censusInstance.isReviewer(command.user())) {
reply.println("Only [Reviewers](https://openjdk.java.net/bylaws#reviewer) are allowed to change the number of required reviewers.");
if (!pr.author().equals(command.user()) && !censusInstance.isReviewer(command.user())) {

This comment has been minimized.

@kevinrushforth

kevinrushforth Sep 14, 2020
Member

This would suggest that my assumption is wrong, and that an author can reduce the number of reviewers required even if they are not a Reviewer. I think this might not be what we want.

This comment has been minimized.

@prrace

prrace Sep 14, 2020

I think it is fine to let them increase it.

This comment has been minimized.

@kevinrushforth

kevinrushforth Sep 14, 2020
Member

Agreed. It's the case of an author reducing it after a Reviewer has increased it that I think should be disallowed.

This comment has been minimized.

@edvbld

edvbld Sep 15, 2020
Author Member

@kevinrushforth and @prrace - I agree, see changes in commit 347594f

Copy link
Member

@rwestberg rwestberg left a comment

Looks good, but you can probably simplify it a bit since the "exclude" parameter isn't really used. :)

return additionalRequiredReviewers(botUser, comments, null);
}

static Optional<AdditionalRequiredReviewers> additionalRequiredReviewers(HostUser botUser, List<Comment> comments, Comment exclude) {

This comment has been minimized.

@rwestberg

rwestberg Sep 15, 2020
Member

The exclude comment parameter probably isn't the one you are looking for, as the reply marker isn't in the command comment but the reply.

This comment has been minimized.

@edvbld

edvbld Sep 15, 2020
Author Member

Thanks, fixed in 7b17768


CommandInvocation(String id, HostUser user, CommandHandler handler, String name, String args) {
CommandInvocation(String id, HostUser user, CommandHandler handler, String name, String args, Comment comment) {

This comment has been minimized.

@rwestberg

rwestberg Sep 15, 2020
Member

Think you can drop this parameter if you drop the exclude param!

This comment has been minimized.

@edvbld

edvbld Sep 15, 2020
Author Member

Yep, fixed in 7b17768

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Looks good with one minor suggestion (feel free to ignore it).

@@ -83,6 +108,21 @@ public void handle(PullRequestBot bot, PullRequest pr, CensusInstance censusInst
role = roleMappings.get(splitArgs[1].toLowerCase());
}

if (pr.author().equals(command.user()) && !censusInstance.isReviewer(command.user())) {

This comment has been minimized.

@kevinrushforth

kevinrushforth Sep 15, 2020
Member

Maybe simplify this to just ! isReviewer? Including the test for is author doesn't really add value (removing it seems to better reflect the intent and might be safer / more future proof).

This comment has been minimized.

@edvbld

edvbld Sep 15, 2020
Author Member

No, we don't want people who are not the PR author and who are not Reviewers to be able to increase the required number of reviewers. Allowing that makes it possible to harass pull request by e.g. registering a spam account and just drop a bunch /reviewers 9 in a number of PRs.

This comment has been minimized.

@kevinrushforth

kevinrushforth Sep 15, 2020
Member

I agree, but that isn't related to this block (your concern is a good one and is handled by the previous block). By adding the author && to !reviewer it makes this less restrictive not more. In any case, it doesn't matter...at least not given the prior test.

Copy link
Member

@rwestberg rwestberg left a comment

Looks good!

@openjdk
Copy link

@openjdk openjdk bot commented Sep 15, 2020

@edvbld This change now passes all automated pre-integration checks. In addition to the automated checks, the change must also fulfill all project specific requirements

After integration, the commit message will be:

673: PR author should be able to use /reviewers command

Reviewed-by: rwestberg, kcr
  • If you would like to add a summary, use the /summary command.
  • To credit additional contributors, use the /contributor command.
  • To add additional solved issues, use the /issue command.

Since the source branch of this PR was last updated there have been 2 commits pushed to the master branch:

  • 9dd7150: Set or update the resolved in build field when new tags arrive
  • b86ed56: 672: Support pulling tags in checkout bot

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid automatic rebasing, please merge master into your branch, and then specify the current head hash when integrating, like this: /integrate 9dd71506093142c7364bcb604ab4acafd6d22ec7.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Sep 15, 2020
@edvbld
Copy link
Member Author

@edvbld edvbld commented Sep 15, 2020

/integrate

@openjdk openjdk bot closed this Sep 15, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Sep 15, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Sep 15, 2020

@edvbld Since your change was applied there have been 2 commits pushed to the master branch:

  • 9dd7150: Set or update the resolved in build field when new tags arrive
  • b86ed56: 672: Support pulling tags in checkout bot

Your commit was automatically rebased without conflicts.

Pushed as commit 82aa583.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.