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

Enable triagebot no-merges check #114157

Merged
merged 1 commit into from
Oct 16, 2023
Merged

Conversation

pitaj
Copy link
Contributor

@pitaj pitaj commented Jul 28, 2023

Follow-up on rust-lang/triagebot#1704

Motivation

Occasionally, a merge commit like cb5c011 makes it past manual review and gets merged into master.

At one point, we tried adding a check to CI to prevent this from happening (#105058), but that ended up problematic and was reverted. This kind of check is simply too fragile for CI, and there must be a way for a human to override the bot's decision.

The capability to detect and warn about merge commits has been present in triagebot for quite some time, but was never enabled at rust-lang/rust, possibly due to concerns about false positives on rollup and subtree sync PRs. This PR intends to alleviate those concerns.

Configuration

This configuration will exclude rollup PRs and subtree sync PRs from merge commit detection, and it will post the default warning message and add the has-merge-commits and S-waiting-on-author labels when merge commits are detected on other PRs.

The eventual vision is to have bors refuse to merge if the has-merge-commits label is present. A reviewer can still force the merge by removing that label if they so wish.

Note for contributors

The rollup tool should add that label automatically, but anyone performing subtree updates should begin including "subtree update" in the titles of those PRs, to avoid false positives.

r? infra

Open Questions

  1. This configuration uses the default message that's built into triagebot:

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git rebase -i master
$ # delete any merge commits in the editor that appears
$ git push --force-with-lease

Any changes to this are easy, I'll just have to add a message option. Should we mention the excluded titles in the message?

@rustbot rustbot added A-meta Area: Issues & PRs about the rust-lang/rust repository itself S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 28, 2023
bors added a commit to rust-lang/rust-analyzer that referenced this pull request Aug 1, 2023
@pitaj pitaj added the T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. label Sep 2, 2023
@ehuss
Copy link
Contributor

ehuss commented Sep 3, 2023

but anyone performing submodule/subtree updates should begin including the sync label on those PRs, to avoid false positives.

This shouldn't affect submodule updates, should it? I don't think they have multiple parents.

Affecting subtree updates seems like a real concern. I don't know what their workflow is like, but asking people to manually set labels seems like it would be a bit too much of an ask. Have you consulted with the people doing subtree updates? Would it be possible to add a configuration to ignore certain directories?

BTW, I recommend not doing things like r? infra. That randomly assigns someone from the team, many of whom aren't doing reviews. I'm going to reassign, though Mark has an excessive load. If the subtree issue is resolved, I can approve.

r? @Mark-Simulacrum

@rustbot rustbot assigned Mark-Simulacrum and unassigned shepmaster Sep 3, 2023
@pitaj
Copy link
Contributor Author

pitaj commented Sep 3, 2023

This shouldn't affect submodule updates, should it? I don't think they have multiple parents.

Yeah I think you're right.

Affecting subtree updates seems like a real concern. I don't know what their workflow is like, but asking people to manually set labels seems like it would be a bit too much of an ask. Have you consulted with the people doing subtree updates? Would it be possible to add a configuration to ignore certain directories?

It's really too bad that Github doesn't have better support for pull request templates, or I would recommend that. I haven't consulted with them, that's a good idea. Ignoring directories may or may not work - I imagine most sync PRs touch both inside and outside the subtree. I'll have to experiment and see how I can exclude subtree commits.

Edit: Ignoring directories would work, but would of course come with a small amount of false negatives. I haven't found any other way of detecting if a commit comes from a subtree update. I've started a discussion with some contributors who commonly open sync PRs.

@Mark-Simulacrum
Copy link
Member

r? @ehuss -- I think the only concern from me is also the subtree updates. FWIW, I have wanted to move those towards automation... but that's probably a longer term thing.

@rustbot rustbot assigned ehuss and unassigned Mark-Simulacrum Sep 10, 2023
bors added a commit to rust-lang/miri that referenced this pull request Sep 11, 2023
add subtree-sync label to rustc update PRs

For rust-lang/rust#114157
@pitaj
Copy link
Contributor Author

pitaj commented Sep 11, 2023

Alright so I've talked with the most prolific subtree updaters including:

And the consensus was that the label method is better than a triagebot heuristic. Most will simply begin adding the subtree-sync label manually, but Ralf asked me to update the link in his Miri update script. That was done at rust-lang/miri#3057

Those wanting to add the label manually can use a link like the following:

https://github.com/rust-lang/rust/compare/{github_user}:{branch}?quick_pull=1&labels=subtree-sync

Or you can use Github CLI tool:

gh pr create --label subtree-sync

If anyone else is already using scripts or would like a script for this, please let me know and I'll be happy to open a PR to add that to your repo.

@pitaj
Copy link
Contributor Author

pitaj commented Sep 11, 2023

One final concern is backport PRs. I don't know if any of those contain merge commits, or if they are always cherry-picks.

triagebot.toml Outdated
@@ -402,6 +402,10 @@ message_on_add = """\
Issue #{number} "{title}" has been added.
"""

[no-merges]
exclude_labels = ["rollup", "subtree-sync"]
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Ah, we should probably do the same in Miri. And that that point the sync PRs for the rustc → Miri direction (which are auto-created via our cronjob) should then also get that label.

@RalfJung
Copy link
Member

Hm, the label doesn't seem to actually work? In rust-lang/miri#3059 the bot complained loudly about the merge commits.

@ehuss
Copy link
Contributor

ehuss commented Sep 12, 2023

There is probably a race between creating the PR and adding the labels. AFAIK, GitHub doesn't do that atomically.

@RalfJung
Copy link
Member

Hm, but that means the planned strategy of using the labels to silence the bot isn't working.

An alternative might be to have a tag inside the PR comment, like "triagebot: subtree-sync". I assume when triagebot runs to do its initial checks, it has definite access to the PR comment text, so there's no chance of a race condition here.

@pitaj
Copy link
Contributor Author

pitaj commented Sep 12, 2023

Yeah I might need to add a delay or something. It has worked fine in my testing but that very well could be because the rust repo has a very large triagebot config and there was enough processing before no-merges to act as suitable delay.

RalfJung pushed a commit to RalfJung/rust that referenced this pull request Sep 12, 2023
add subtree-sync label to rustc update PRs

For rust-lang#114157
@pitaj
Copy link
Contributor Author

pitaj commented Sep 12, 2023

I think things like @rustbot label +subtree-sync in the body are processed before everything else but I'll need to check.

I don't particularly love using the body but that may be the easiest way.

@RalfJung
Copy link
Member

Is it possible to set the body in a PR URL?

@pitaj
Copy link
Contributor Author

pitaj commented Sep 12, 2023

@Mark-Simulacrum
Copy link
Member

I think things like @rustbot label +subtree-sync in the body are processed before everything else but I'll need to check.

I don't think the label set by that is guaranteed to be visible to later triagebot commands, even if the processing happens before. In general if we need some metadata around PR creation time you either need to schedule the work to happen in the background after a delay or depend on metadata set in the PR (e.g., PR title, description).

@pitaj
Copy link
Contributor Author

pitaj commented Sep 16, 2023

rust-lang/triagebot#1720

This configuration will exclude rollup PRs and subtree sync PRs from
merge commit detection. On other PRs, it will post the default warning
message and add the `has-merge-commits` and `S-waiting-on-author`
labels when merge commits are detected.

The eventual vision is to have bors refuse to merge if the
`has-merge-commits` label is present. A reviewer can still
force the merge by removing that label if they so wish.
@pitaj
Copy link
Contributor Author

pitaj commented Oct 16, 2023

Updated for rust-lang/triagebot#1720 which has been merged

@ehuss
Copy link
Contributor

ehuss commented Oct 16, 2023

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 16, 2023

📌 Commit 4baa12b has been approved by ehuss

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 16, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 16, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#114157 (Enable triagebot no-merges check)
 - rust-lang#116257 (Suggest trait bounds for used associated type on type param)
 - rust-lang#116430 (vendoring in tarball sources)
 - rust-lang#116709 (Update minifier version to 0.2.3)
 - rust-lang#116786 (Update my mailmap entry)
 - rust-lang#116790 (opt-dist: disable unused features for tabled crate)
 - rust-lang#116802 (Remove `DefiningAnchor::Bubble` from opaque wf check)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit cf25110 into rust-lang:master Oct 16, 2023
11 checks passed
@rustbot rustbot added this to the 1.75.0 milestone Oct 16, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 16, 2023
Rollup merge of rust-lang#114157 - pitaj:triagebot_no-merges, r=ehuss

Enable triagebot no-merges check

Follow-up on rust-lang/triagebot#1704

### Motivation

Occasionally, a merge commit like rust-lang@cb5c011 makes it past manual review and gets merged into master.

At one point, we tried adding a check to CI to prevent this from happening (rust-lang#105058), but that ended up [problematic](rust-lang#106319 (comment)) and was [reverted](rust-lang#106320). This kind of check is simply too fragile for CI, and there must be a way for a human to override the bot's decision.

The capability to detect and warn about merge commits has been present in triagebot for quite some time, but was never enabled at rust-lang/rust, possibly due to concerns about false positives on rollup and subtree sync PRs. This PR intends to alleviate those concerns.

### Configuration

This configuration will exclude rollup PRs and subtree sync PRs from merge commit detection, and it will post the default warning message and add the `has-merge-commits` and `S-waiting-on-author` labels when merge commits are detected on other PRs.

The eventual vision is to have bors refuse to merge if the `has-merge-commits` label is present. A reviewer can still force the merge by removing that label if they so wish.

### Note for contributors

The rollup tool should add that label automatically, but anyone performing subtree updates should begin including "subtree update" in the titles of those PRs, to avoid false positives.

r? infra

## Open Questions

1. This configuration uses the default message that's built into triagebot:

> There are merge commits (commits with multiple parents) in your changes. We have a [no merge policy](https://rustc-dev-guide.rust-lang.org/git.html#no-merge-policy) so these commits will need to be removed for this pull request to be merged.
>
> You can start a rebase with the following commands:
> ```shell-session
> $ # rebase
> $ git rebase -i master
> $ # delete any merge commits in the editor that appears
> $ git push --force-with-lease
> ```

Any changes to this are easy, I'll just have to add a `message` option. Should we mention the excluded titles in the message?
bors-ferrocene bot added a commit to ferrocene/ferrocene that referenced this pull request Oct 17, 2023
54: Pull upstream master 2023 10 17 r=pietroalbini a=Veykril

* rust-lang/rust#116196
* rust-lang/rust#116824
* rust-lang/rust#116822
* rust-lang/rust#116477
* rust-lang/rust#116826
* rust-lang/rust#116820
  * rust-lang/rust#116811
  * rust-lang/rust#116808
  * rust-lang/rust#116805
  * rust-lang/rust#116800
  * rust-lang/rust#116798
  * rust-lang/rust#116754
* rust-lang/rust#114370
* rust-lang/rust#116804
  * rust-lang/rust#116802
  * rust-lang/rust#116790
  * rust-lang/rust#116786
  * rust-lang/rust#116709
  * rust-lang/rust#116430
  * rust-lang/rust#116257
  * rust-lang/rust#114157
* rust-lang/rust#116731
* rust-lang/rust#116550
* rust-lang/rust#114330
* rust-lang/rust#116724
* rust-lang/rust#116782
  * rust-lang/rust#116776
  * rust-lang/rust#115955
  * rust-lang/rust#115196
* rust-lang/rust#116775
* rust-lang/rust#114589
* rust-lang/rust#113747
* rust-lang/rust#116772
  * rust-lang/rust#116771
  * rust-lang/rust#116760
  * rust-lang/rust#116755
  * rust-lang/rust#116732
  * rust-lang/rust#116522
  * rust-lang/rust#116341
  * rust-lang/rust#116172
* rust-lang/rust#110604
* rust-lang/rust#110729
* rust-lang/rust#116527
* rust-lang/rust#116688
* rust-lang/rust#116757
  * rust-lang/rust#116753
  * rust-lang/rust#116748
  * rust-lang/rust#116741
  * rust-lang/rust#116594
* rust-lang/rust#116691
* rust-lang/rust#116643
* rust-lang/rust#116683
* rust-lang/rust#116635
* rust-lang/rust#115515
* rust-lang/rust#116742
  * rust-lang/rust#116661
  * rust-lang/rust#116576
  * rust-lang/rust#116540
* rust-lang/rust#116352
* rust-lang/rust#116737
  * rust-lang/rust#116730
  * rust-lang/rust#116723
  * rust-lang/rust#116715
  * rust-lang/rust#116603
  * rust-lang/rust#116591
  * rust-lang/rust#115439
* rust-lang/rust#116264
* rust-lang/rust#116727
  * rust-lang/rust#116704
  * rust-lang/rust#116696
  * rust-lang/rust#116695
  * rust-lang/rust#116644
  * rust-lang/rust#116630
* rust-lang/rust#116728
  * rust-lang/rust#116689
  * rust-lang/rust#116679
  * rust-lang/rust#116618
  * rust-lang/rust#116577
  * rust-lang/rust#115653
* rust-lang/rust#116702
* rust-lang/rust#116015
* rust-lang/rust#115822
* rust-lang/rust#116407
* rust-lang/rust#115719
* rust-lang/rust#115524
* rust-lang/rust#116705
* rust-lang/rust#116645
* rust-lang/rust#116233
* rust-lang/rust#115108
* rust-lang/rust#116670
* rust-lang/rust#116676
* rust-lang/rust#116666



Co-authored-by: Benoît du Garreau <[email protected]>
Co-authored-by: Colin Finck <[email protected]>
Co-authored-by: Ian Jackson <[email protected]>
Co-authored-by: Joshua Liebow-Feeser <[email protected]>
Co-authored-by: León Orell Valerian Liehr <[email protected]>
Co-authored-by: Trevor Gross <[email protected]>
Co-authored-by: Evan Merlock <[email protected]>
Co-authored-by: joboet <[email protected]>
Co-authored-by: Ralf Jung <[email protected]>
Co-authored-by: DaniPopes <[email protected]>
Co-authored-by: Mark Rousskov <[email protected]>
Co-authored-by: onur-ozkan <[email protected]>
Co-authored-by: Nicholas Nethercote <[email protected]>
Co-authored-by: The 8472 <[email protected]>
Co-authored-by: Samuel Thibault <[email protected]>
Co-authored-by: reez12g <[email protected]>
Co-authored-by: Jakub Beránek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Issues & PRs about the rust-lang/rust repository itself S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants