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

Improve duplicate pull request handling #18206

Merged

Conversation

MikeMcQuaid
Copy link
Member

@MikeMcQuaid MikeMcQuaid commented Aug 30, 2024

  • change the messaging depending on how confident we are that we're actually looking at duplicates i.e. we're not confident without a version number supplied
  • similarly, just warn instead of failing with an error (and no override) if we're not confident that we're looking at duplicates because a version wasn't supplied
  • change bump-cask-pr and bump-formula-pr to always check for all pull requests with the new version number (to allow failing on this) rather than only checking closed pull requests with a version number
  • change bump to check for definite/maybe duplicate PRs and only exit if they are definitely duplicates
  • cleanup some variable usage to DRY things up a bit

Inspired by conversation in #18205

@MikeMcQuaid MikeMcQuaid requested a review from carlocab August 30, 2024 07:46
@MikeMcQuaid MikeMcQuaid mentioned this pull request Aug 30, 2024
7 tasks
@MikeMcQuaid MikeMcQuaid changed the title Improve GitHub.check_for_duplicate_pull_requests Improve GitHub.check_for_duplicate_pull_requests Aug 30, 2024
@MikeMcQuaid MikeMcQuaid force-pushed the improve_github_check_for_duplicate_pull_requests branch from 5671ff1 to 0f45691 Compare August 30, 2024 07:55
Copy link
Member

@carlocab carlocab left a comment

Choose a reason for hiding this comment

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

Makes sense, I think.

Any reason why we have different handling for bump-cask-pr and bump-formula-pr?

Also, do we not need changes for dev-cmd/bump.rb too?

@MikeMcQuaid
Copy link
Member Author

Any reason why we have different handling for bump-cask-pr and bump-formula-pr?

@carlocab Can you elaborate? They should be functionally equivalent, they just use different code paths to get there. I'm deliberately trying to avoid changing behaviour beyond just the targeted change here.

Also, do we not need changes for dev-cmd/bump.rb too?

It doesn't call GitHub.check_for_duplicate_pull_requests? What did you have in mind there?

@carlocab
Copy link
Member

They should be functionally equivalent, they just use different code paths to get there. I'm deliberately trying to avoid changing behaviour beyond just the targeted change here.

Yes, sorry, I was confused by the cosmetic differences!

Also, do we not need changes for dev-cmd/bump.rb too?

It doesn't call GitHub.check_for_duplicate_pull_requests? What did you have in mind there?

You're right that it doesn't, but the problem that motivates #18205 isn't just because of GitHub.check_for_duplicate_pull_requests.

In particular, my impression is that when BrewTestBot fails to open a version bump PR in Homebrew/core, GitHub.check_for_duplicate_pull_requests is never even called.

We can that in this workflow run. Here, we see BrewTestBot calling brew bump, which identifies a candidate duplicate PR (but isn't an exact match for the version). From what I can tell, it never even tries to call brew bump-formula-pr, or else we'd see an error message about duplicate pull requests. So it seems to me that changing GitHub.check_for_duplicate_pull_requests, bump-formula-pr, and bump-cask-pr is not sufficient here.

Does that make sense?

@MikeMcQuaid
Copy link
Member Author

@carlocab makes sense but: ugh, this is why I like consistency. I'll likely port brew bump's PR calls to use the same methods.

@carlocab
Copy link
Member

makes sense but: ugh, this is why I like consistency.

Same! But this is part of why I wanted to punt; the code is kinda all over the place.

- change the messaging depending on how confident we are that we're
  actually looking at duplicates i.e. we're not confident without a
  version number supplied
- similarly, just warn instead of failing with an error (and no
  override) if we're not confident that we're looking at duplicates
  because a version wasn't supplied
- change `bump-cask-pr` and `bump-formula-pr` to always check for all
  pull requests with the new version number (to allow failing on this)
  rather than only checking closed pull requests with a version number
- change `bump` to check for definite/maybe duplicate PRs and only
  exit if they are definitely duplicates
- cleanup some variable usage to DRY things up a bit
@MikeMcQuaid MikeMcQuaid force-pushed the improve_github_check_for_duplicate_pull_requests branch from 0f45691 to fe909c4 Compare August 30, 2024 13:21
@MikeMcQuaid MikeMcQuaid changed the title Improve GitHub.check_for_duplicate_pull_requests Improve duplicate pull request handling Aug 30, 2024
@MikeMcQuaid
Copy link
Member Author

I'll likely port brew bump's PR calls to use the same methods.

I didn't but: I should have fixed the brew bump case you mentioned.

@MikeMcQuaid MikeMcQuaid merged commit 76543a9 into master Aug 30, 2024
27 checks passed
@MikeMcQuaid MikeMcQuaid deleted the improve_github_check_for_duplicate_pull_requests branch August 30, 2024 15:08
@MikeMcQuaid
Copy link
Member Author

Let's give this a go.

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

Successfully merging this pull request may close these issues.

4 participants