Skip to content

add cask pre-release check #8351

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

Merged
merged 2 commits into from
Sep 2, 2020
Merged

Conversation

SMillerDev
Copy link
Member

@SMillerDev SMillerDev commented Aug 14, 2020

  • 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 tests with your changes locally?

Sorry, something went wrong.

@SMillerDev
Copy link
Member Author

Should resolve Homebrew/homebrew-cask#86192

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.

brew style --fix should fix the style warnings I've not added suggestions for.

@@ -476,7 +537,6 @@ def check_bitbucket_repository

def get_repo_data(regex)
return unless online?
return unless new_cask?
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice to use this function everywhere instead of @new_cask

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand? This is a removal, so this would allow for that

Copy link
Member

Choose a reason for hiding this comment

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

Yeh, sorry, I'm pointing out that elsewhere in this file it uses @new_cask when I think it'd be nicer to use new_cask?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure what the difference is, but sure

@@ -14,6 +14,16 @@ def github_repo_data(user, repo)
nil
end

def github_release_data(user, repo, tag)
id = "#{user}/#{repo}/#{tag}"
Copy link
Member

Choose a reason for hiding this comment

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

I'd be tempted to use the full URL as the key.

@vitorgalvao
Copy link
Contributor

Does it allow the parameter to disable the check on specific cases?

That’s essential, because otherwise we’re trading a few false positives on one repo for a lot of false negatives on another.

@MikeMcQuaid
Copy link
Member

Does it allow the parameter to disable the check on specific cases?

Not sure what's meant by "parameter" here but you can add to an allow list in the code.

@vitorgalvao
Copy link
Contributor

Not sure what's meant by "parameter"

Something like:

appcast "https://github.com/example.atom",
        smart_check: false

This feature will often need to be off (e.g. when there’s no stable version yet), so we need to control it on a per-cask basis.

@SMillerDev
Copy link
Member Author

I don't think that's really feasible since it adds a lot of manual work. A better option would be to make this run only on the main cask tap for example.

@vitorgalvao
Copy link
Contributor

I don't think that's really feasible since it adds a lot of manual work.

If you’re referring to the casks themselves, that’s not an issue. must_contain is required in much more cases and we handle it just fine. It doesn’t need to be done all at once—cases are fixed as they break so they take no more effort than any other stanza.

Not having the option to disable it on a per-cask basis is what takes more effort, because it requires checking CI every time to make sure it’s it’s a false negative or not, and requires merging non-passing tests (which happens today).

We could do the reverse. If the smart check is off by default and we turn it on when needed, fewer casks will need modification. The trade-off is that occasionally a non-stable version might slip up, but that’s what happens now.

A better option would be to make this run only on the main cask tap for example.

It’s not cut-and-dry. Both repos have casks that may need the option on or off.

Without the parameter there’s no reason to have the feature, because we could get better results by selectively using the API endpoint or the atom feed.

@MikeMcQuaid
Copy link
Member

I can't really see the reasoning here. Either Homebrew/cask thinks (new) prerelease casks or desirable or they are not. If they are desirable: this shouldn't be an audit at all. If they are not: we should build an allow list of casks currently using prereleases and ensure they are eventually migrated away.

@vitorgalvao
Copy link
Contributor

Either Homebrew/cask thinks (new) prerelease casks or desirable or they are not.

The problem is that developers aren’t consistent. Some apps only have pre-releases until 1.0 (relegating those to homebrew/cask-versions makes little sense and isn’t what users expect) and others label versions as pre-releases despite them being stable (as defined by the authors themselves).

This check isn’t a huge necessity; we’ve been doing without it for years. Rather, it’s a nice-to-have that will save us review time by not having us need to check and overturn CI as often. It will also reduce the amount of cases where we need to merge a PR despite CI failing, which has been stated as a goal.

If every developer were consistent, we wouldn’t need a toggle. But because they’re not, if we don’t have a simple way to define exceptions we’re not solving anything, just shifting the problem around. That’s why the issue that defines this feature defines the case on the first post.

If code complexity in the core is a big consideration to not have the toggle, it’s better to abandon the feature entirely and go the API-URL-in-appcast route directly (assuming we won’t get into rate-limiting problems).

@SMillerDev
Copy link
Member Author

Developers aren't consistent in the software that core ships either. That's why I think we should just ask them for clarification and not try and fix a human issue with technical solutions.

Some apps only have pre-releases until 1.0 (relegating those to homebrew/cask-versions makes little sense and isn’t what users expect)

I'd say this should be exactly what users expect.

and others label versions as pre-releases despite them being stable (as defined by the authors themselves).

You can add it to the whitelist or tell upstream that we can't ship it as a pre-release

@MikeMcQuaid
Copy link
Member

If code complexity in the core is a big consideration to not have the toggle

It's not that as much as I think an audit that's sometimes on and sometimes off is more confusing to contributors.

The problem is that developers aren’t consistent. Some apps only have pre-releases until 1.0 (relegating those to homebrew/cask-versions makes little sense and isn’t what users expect) and others label versions as pre-releases despite them being stable (as defined by the authors themselves).

They aren't consistent because we allow them to not be. I think we should be consistent for the benefit of our users. That said, if we choose to ignore this and remove this audit for cask: that seems fine, too.

@vitorgalvao
Copy link
Contributor

I'd say this should be exactly what users expect.

But it isn’t. This the way Homebrew Cask has worked forever, from way before it was merged with Homebrew, so that expectation only lowered with time. And I still think it makes sense.

If we followed what you’re suggesting, we’d require frequent tap migrations and would get a lot of duplicate submissions to the main repo. Both of those are unnecessary work that mostly affects maintainers.

You can add it to the whitelist or tell upstream that we can't ship it as a pre-release

Perhaps you can explain that better. I’m not following why a whitelist—which is a separate file—is better than a parameter—something we can see at a glance and in scope.

They aren't consistent because we allow them to not be. I think we should be consistent for the benefit of our users.

I agree! I refuse plenty of workarounds in casks for that very reason. Every time there’s a bug or oddity in a software and a user tries to circumvent it in the cask, I make a point to not merge and ask them to request the fix upstream, so everyone can benefit.

What’s maybe not coming across here is that appcast is absolutely irrelevant to users, it only matters to us maintainers. It has zero impact on a user’s usage of a cask, but it has a large impact on how we review and evaluate what needs to be merged, it’s for our benefit.

@MikeMcQuaid
Copy link
Member

Perhaps you can explain that better. I’m not following why a whitelist—which is a separate file—is better than a parameter—something we can see at a glance and in scope.

Having a parameter encourages users to "add the parameter to make the error go away".

What’s maybe not coming across here is that appcast is absolutely irrelevant to users, it only matters to us maintainers. It has zero impact on a user’s usage of a cask, but it has a large impact on how we review and evaluate what needs to be merged, it’s for our benefit.

Agreed, same with audits. Both exist for us to enforce standards we think are beneficial so users can have a consistent experience. To me (although I defer to you): "we don't include prereleases in Homebrew/homebrew-cask" or "we include them" is an easier mental model for contributors and users than "it depends".

@vitorgalvao
Copy link
Contributor

Having a parameter encourages users to "add the parameter to make the error go away".

I see your point. Not a problem here because we never ask users to run the --appcast audit; it’s exclusively run by CI and users seldom fix CI errors unless prompted.

Seems like the best course of action here will be to change some high-profile casks to use the API URL, see how that goes, and reevaluate.

@core-code Would you need any changes on your checks?

@core-code
Copy link
Contributor

Seems like the best course of action here will be to change some high-profile casks to use the API URL, see how that goes, and reevaluate.

i guess basically the question is, how many casks that are hosted on github do not have a stable release yet and therefore should (ideally) have this additional check turned off? if its just a few then an additional parameter doesn't make much sense as we can just manually merge them. hard data would be nice (*)

@core-code Would you need any changes on your checks?

thanks for the heads-up, doesn't look that way ;)

__

@SMillerDev the github release API (both asking for all as well just the latest release) will return NOTHING for projects which don't have binaries in their releases. e.g. cask 'zotero' and a few dozen others. a fall-back to the atom feed is necessary here. forgive the noise if you've already taken care of that.


(*) ok so i've run a short test to generate some data. i've looked at around 3200 casks. it seems only 28 of those have all releases marked as pre-release and therefore need an exception. i think those are so few that we can approve updates for them manually and don't need a flag:
altdeploy amd-power-gadget drop-to-gif duplicati extraterm freetube graphsketcher haptickey irccloud jenkins-menu lidarr messenger-native mongotron my-budget nuclear pock profilecreator qdesktop radarr raven seaglass servpane shadowsocksx-ng-r splitshow syntax-highlight themeengine toggl xit

@SMillerDev
Copy link
Member Author

(*) ok so i've run a short test to generate some data. i've looked at around 3200 casks. it seems only 28 of those have all releases marked as pre-release and therefore need an exception. i think those are so few that we can approve updates for them manually and don't need a flag:

I think in line with #8351 (comment) it's pretty reasonable to ask these upstreams to change their naming.

the github release API (both asking for all as well just the latest release) will return NOTHING for projects which don't have binaries in their releases. e.g. cask 'zotero' and a few dozen others.

I think that's just if they don't make GitHub releases but tags right? If not, do you have a link for me? Cause that would be an improvement for core as well.

@core-code
Copy link
Contributor

I think that's just if they don't make GitHub releases but tags right? If not, do you have a link for me? Cause that would be an improvement for core as well.

could be they are just tags, though they show up in the release page and the release atom feed:

https://github.com/zotero/zotero/releases
https://github.com/zotero/zotero/releases.atom

versus

https://api.github.com/repos/zotero/zotero/releases

@core-code
Copy link
Contributor

core-code commented Aug 19, 2020

I think in line with #8351 (comment) it's pretty reasonable to ask these upstreams to change their naming.

while i generally agree that problems should be fixed upstream, this is not a 'problem'.

if a project has no stable release yet, marking it as stable would just be wrong.

i don't think we should ask projects to do wrong things just because it makes it easier for us.

@SMillerDev
Copy link
Member Author

The problem is that developers aren’t consistent. Some apps only have pre-releases until 1.0 (relegating those to homebrew/cask-versions makes little sense and isn’t what users expect) and others label versions as pre-releases despite them being stable (as defined by the authors themselves).

In #8351 (comment) would suggest that sometimes upstream is using pre-releases when they shouldn't be according to the common definition of a pre-release. I don't think they should mark something stable when it isn't, but if they mark something unstable when it isn't that is just as incorrect.

Either way, 28/3200 is not a terrible number and I'll leave it up to you how you want to deal with this.

@vitorgalvao vitorgalvao added the cask Homebrew Cask label Aug 22, 2020
@SMillerDev
Copy link
Member Author

@core-code @vitorgalvao can I get some yay/nays on this?

@core-code
Copy link
Contributor

i am absolutely positive that we need this feature, many thanks for working on this!

regarding the implementation, sorry i cannot give any feedback on ruby code.

regarding the recently discussed issue, i think the consensus is that it isn't a problem if we have to manually merge updates for projects that only have 'unstable' releases and will therefore fail this new check. as mentioned it should affect less than 30 casks. so i think further complicating the implementation for these corner cases is not necessary. the only problem i see here is that it seems to be impossible to merge casks that fail CI due to some recent changes made just a few days ago, so that could pose a real problem here.
but if there are workarounds that allow maintainers to still merge updates those few casks despite the CI failure then no problem!

@SMillerDev
Copy link
Member Author

the only problem i see here is that it seems to be impossible to merge casks that fail CI due to some recent changes made just a few days ago, so that could pose a real problem here.

Can you link me some more info on this?

@core-code
Copy link
Contributor

there has been some discussion here:

Homebrew/homebrew-cask#88388

@SMillerDev
Copy link
Member Author

That thread seems to indicate that it's still possible, just difficult. I guess I can merge this then?

@reitermarkus
Copy link
Member

Yes, it's now possible if a maintainer applies the ci-verified-manually label, so feel free to merge @SMillerDev.

Co-authored-by: Markus Reiter <me@reitermark.us>
@SMillerDev SMillerDev merged commit 742b3fa into Homebrew:master Sep 2, 2020
@vitorgalvao
Copy link
Contributor

Did this end up receiving the per-repo disabling (i.e. don’t do the pre-release check on homebrew/cask-versions)?

@SMillerDev
Copy link
Member Author

It didn't, ik try and fix that today. Unless someone beats me to it.

@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Dec 14, 2020
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Dec 14, 2020
@SMillerDev SMillerDev deleted the audit/pre_release branch September 21, 2022 13:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cask Homebrew Cask outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants