-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
[WIP] diagnostic: check outdated mirrors and repositories #21383
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
base: main
Are you sure you want to change the base?
Conversation
0f7c6bd to
9795c77
Compare
Signed-off-by: botantony <antonsm21@gmail.com>
9795c77 to
12f224d
Compare
| HOMEBREW_CORE_DEFAULT_GIT_REMOTE, | ||
| "https://github.com/Homebrew/homebrew-cask", # There's no `HOMEBREW_CASK_DEFAULT_GIT_REMOTE` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two can intentionally get outdated on a device without HOMEBREW_NO_INSTALL_FROM_API so may want to conditionally include these two.
(as demonstrated by the CI failures here)
| You can solve this by setting the origin remote: | ||
| git -C "#{repository_path}" remote set-url origin #{Formatter.url(desired_origin)} | ||
| EOS | ||
| elsif (Time.now - last_commit_time) > Homebrew::API::DEFAULT_API_STALE_SECONDS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just using the default auto-update stale interval is too short for multiple reasons. Firstly, it might have just not got to auto-forcing an update yet if it has just passed - you want some leeway.
Secondly, there's also some things with slower update cadences, e.g: GitHub Actions images for example could be outdated by as much as a month. For end-users, this cadence might actually be more sporadic as not every command triggers an auto-update.
And thirdly since this also checks Homebrew/brew, people without developer mode enabled might not even have 1 update a week. We sometimes have made releases on 2-3 week intervals if something is baking in main. And it's worth having some extra leeway on top of that in case something major happens.
Overall point being: I don't think we want to make this too tight to simply be a "it's been a couple days, Homebrew might have an update" check and lean more towards a "Homebrew installation is obviously majorly outdated" check. The problems that inspired this check have all been cases where things have been outdated by several months.
| cask_tap_migrations.jws.json | ||
| cask.jws.json | ||
| formula_tap_migrations.jws.json | ||
| formula.jws.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these all correct under the new internal API?
| # These are popular mirrors with known problems | ||
| bad_mirrors = [ | ||
| %r{^https?://mirrors\.aliyun\.com/homebrew/.+}, # Last update was in May 2025 | ||
| ] | ||
| problems = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems annoying to maintain - any entry could spring to life at a moments notice and there could be others we're not aware of. It might even do the opposite of what we want and discourage mirrors from fixing their outdated ones in favour of just making a new URL (easier than requesting us to delist it from here). It's technically also incorrect as while the API mirror is outdated, the brew git mirror is not.
In any case, does this check matter if the other one is always going to trigger anyway (and already mentions mirrors)? You're going to get two warnings that effectively say the same thing. This can be an open question to other reviewers too.
brew lgtm(style, typechecking and tests) with your changes locally?Draft PR, feel free to discuss and suggest changes (what checks should be added/removed, other mirrors with known problems, etc.)