Skip to content

Comments

Throttle version bumps based on recently merged PRs.#15286

Closed
reitermarkus wants to merge 1 commit intoHomebrew:masterfrom
reitermarkus:bump-throttle-days
Closed

Throttle version bumps based on recently merged PRs.#15286
reitermarkus wants to merge 1 commit intoHomebrew:masterfrom
reitermarkus:bump-throttle-days

Conversation

@reitermarkus
Copy link
Member

@reitermarkus reitermarkus commented Apr 21, 2023

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

The existing throttling method (patch version must be a multiple of n) does not work for most casks. This changes throttling to instead check if a PR was merged for a given cask/formula in the last n days instead.

@reitermarkus reitermarkus requested a review from a team April 21, 2023 21:46
Copy link
Member

@nandahkrishna nandahkrishna left a comment

Choose a reason for hiding this comment

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

Would it be better if we checked for recent PRs that update the version instead of any/all recent PRs? That is, if the formula was modified recently without bumping the version, wouldn't this prevent an "acceptable" version bump?

@carlocab
Copy link
Member

carlocab commented Apr 22, 2023

Also, not sure this should replace the existing throttle mechanism in Homebrew/core. This is much less transparent for users/contributors: currently, they know to expect a (for example) vim update every 50 patches. Now it depends on repository activity, which is a lot harder to follow.

I'm open to be being persuaded otherwise, though.

@reitermarkus
Copy link
Member Author

Would it be better if we checked for recent PRs that update the version

Yeah, that would be better, how do we best check that though?

Now it depends on repository activity, which is a lot harder to follow.

Too much repository activity is the reason for throttling in the first place, so shouldn't it depend on repository activity?

@carlocab
Copy link
Member

Too much repository activity is the reason for throttling in the first place, so shouldn't it depend on repository activity?

Sure, it should. But we also care about UX, and the UX for throttling based on patch versions is better than throttling solely based on repository activity. Patch version increments is also a function of repository activity, so the current throttling method also depends on repository activity.

@reitermarkus
Copy link
Member Author

UX for throttling based on patch versions is better than throttling solely based on repository activity

How is the UX for brew bump? Will it not only work when the version is currently a multiple and fail again say a day later when a new patch version is released?

@reitermarkus
Copy link
Member Author

Also, does the livecheck audit need to be skipped for throttled formulae?

@carlocab
Copy link
Member

How is the UX for brew bump? Will it not only work when the version is currently a multiple and fail again say a day later when a new patch version is released?

Sure, but that's the same after your change too. What isn't the same is doing brew bump-formula-pr --version=. Neither is how easy it for users to work out what the next version they'll get when they do brew upgrade.

@reitermarkus
Copy link
Member Author

reitermarkus commented Apr 23, 2023

Sure, but that's the same after your change too.

Not quite what I meant. To clarify, if you run brew bump when say vim 9.0.1501 is released (i.e. you missed running it when 9.0.1500 was the latest version, it will currently fail. With this approach, brew bump will bump it to 9.0.1501, which is the latest version.

What isn't the same is doing brew bump-formula-pr --version=.

How so?

Neither is how easy it for users to work out what the next version they'll get when they do brew upgrade.

I don't get this argument, this is literally how every non-throttled formula works. What is there to work out for users? I doubt users object to a newer patch release if it is already available. Users get whatever version upstream released at the time of a version bump.

@carlocab
Copy link
Member

To clarify, if you run brew bump when say vim 9.0.1501 is released (i.e. you missed running it when 9.0.1500 was the latest version, it will currently fail.

It should probably use patch-version throttling information so that it doesn't fail, then.

What isn't the same is doing brew bump-formula-pr --version=.

How so?

Currently, brew bump-formula-pr --version=X vim should work if X has been tagged and is a multiple of 50. With this change, I don't know whether it'll work without checking recent PRs.

I don't get this argument, this is literally how every non-throttled formula works.

Not exactly. For most non-throttled formulae, you get new versions shortly after they're released by upstream. For throttled formulae, under the current scheme, you get specific versions shortly after they're released upstream. Under the new scheme, for throttled formulae, you get some updates some of the time, but you don't really know which ones unless you watch Homebrew/core.

@carlocab
Copy link
Member

To put it a different way: the existing throttling mechanism for formulae is simple, works well, and easily-understandable for users. We even get non-regular contributors making pull requests regarding throttled formulae occasionally: Homebrew/homebrew-core@5a5ce7c

Given that, I think the burden is on this change to demonstrate that it is clearly superior to what we're doing now, and I don't think there's really much shown about why that's the case so far.

@reitermarkus
Copy link
Member Author

The PR you linked to wouldn't even be needed if it was based on days rather than patch versions.

the burden is on this change to demonstrate that it is clearly superior

I'm not claiming it is clearly superior, I'm claiming it will work just as well for the intended purposes. The question here comes down to: Do we want to maintain two different throttling mechanisms for casks and formulae? My preference would be to use the same for both.

@carlocab
Copy link
Member

The PR you linked to wouldn't even be needed if it was based on days rather than patch versions.

I don't think you can say that for certain. How do you know that we would've throttled this based on the an appropriate number of days, rather than too few or too many?

I'm not claiming it is clearly superior

Then if it isn't broken: don't fix it.

@SMillerDev
Copy link
Member

I think adopting the version number based approach for casks is the better approach here. People already know it, and it's judged on a parameter they can actually predict. Judging when you can make a PR based on what you guess other people will do is near impossible.

@reitermarkus
Copy link
Member Author

I think adopting the version number based approach for casks is the better approach here.

I fail to see how this “multiple of N” approach can work for casks which sometimes don't even have a patch version. How would this even work for date-based versions, dates aren't multiples of N? This approach will work regardless of how weird a cask's versioning scheme is.

@carlocab
Copy link
Member

For the record, I'm fine with doing this for casks. I'm just not convinced we should do the same for formulae.

@MikeMcQuaid
Copy link
Member

I fail to see how this “multiple of N” approach can work for casks which sometimes don't even have a patch version. How would this even work for date-based versions, dates aren't multiples of N? This approach will work regardless of how weird a cask's versioning scheme is.

Which casks do you plan on throttling from the outset and what are their version schemes?

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

This needs more discussion before merge.

@reitermarkus
Copy link
Member Author

Which casks do you plan on throttling from the outset and what are their version schemes?

The puzzles cask needs to be throttled and has a date-based version, e.g. currently 20230424, which would already not work with “multiples of N”.

@MikeMcQuaid
Copy link
Member

The puzzles cask needs to be throttled and has a date-based version, e.g. currently 20230424, which would already not work with “multiples of N”.

I mean, it could definitely be done if you're saying e.g. 20230424 shouldn't be updated until at least 20230524 i.e. multiples of days.

return if formula_suffix.modulo(throttled_rate).zero?

odie "#{formula} should only be updated every #{throttled_rate} releases on multiples of #{throttled_rate}"
GitHub.check_recently_merged_pull_requests(
Copy link
Member

Choose a reason for hiding this comment

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

I agree that I'd want to see @homebrew/core express a need for this before it's implemented here.

stable_url_version = Version.parse(stable.url)
stable_url_minor_version = stable_url_version.minor.to_i

formula_suffix = stable.version.patch.to_i
Copy link
Member

Choose a reason for hiding this comment

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

This should not be removed unless @Homebrew/core agrees the approach in this PR is needed/better.

Copy link
Member

@carlocab carlocab May 19, 2023

Choose a reason for hiding this comment

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

Note: I don't agree with changing the throttling scheme for formulae, and I think neither does @SMillerDev (given the 👍 to one of my earlier comments).

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @carlocab @SMillerDev. Yeh, in that case: let's strip this out please @reitermarkus.

pr["html_url"].include?("/pull/") && regex.match?(pr["title"])
query += " is:pr"
query += " created:#{created}" if created
issues_for_formula(query, tap_remote_repo: tap_remote_repo, state: state).select do |issue|
Copy link
Member

Choose a reason for hiding this comment

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

Does this use the search API? I assume not but just wanted to check because it's rate-limited so aggressively.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes it does, same as the open/closed PR checks, but it's only called for throttled casks/formulae.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think it's a great idea to rely on this. As mentioned: the rate limits are already very low and stretched thin.

Copy link
Member Author

Choose a reason for hiding this comment

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

We already rely on this for open/closed PRs. Also, this is only called if there is a version bump and it is throttled, i.e. pretty rarely compared to the other checks.

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Ok, I'm fine with this. I'd like to see someone from @Homebrew/core approve the formulae-side changes, though. Have requested a few reviews but anyone else: feel free to chime in.

@MikeMcQuaid MikeMcQuaid enabled auto-merge May 8, 2023 15:54
@MikeMcQuaid
Copy link
Member

@reitermarkus Needs rebased and then should be good to merge, thanks again!

@carlocab carlocab disabled auto-merge May 19, 2023 17:01
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.

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Jun 10, 2023
@github-actions github-actions bot closed this Jun 17, 2023
@github-actions github-actions bot added the outdated PR was locked due to age label Jul 17, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated PR was locked due to age stale No recent activity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants