Stop relying on transitive uri loads#22161
Merged
MikeMcQuaid merged 1 commit intomainfrom May 7, 2026
Merged
Conversation
Signed-off-by: Patrick Linnane <patrick@linnane.io>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes reliance on transitive require "uri" loading by either explicitly requiring Ruby’s uri stdlib where it’s used at runtime or by preventing Sorbet runtime signature evaluation from referencing URI::Generic.
Changes:
- Switch selected Sorbet signatures that mention
URI::GenerictoT::Sig::WithoutRuntime.sigto avoid runtime evaluation. - Add explicit
require "uri"whereURI(...)/URI::...is used at runtime (e.g., Formulary URI loading, Cask URL parsing).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Library/Homebrew/utils/github/api.rb | Avoids runtime evaluation of sigs that reference URI::Generic by using T::Sig::WithoutRuntime.sig. |
| Library/Homebrew/github_packages.rb | Uses T::Sig::WithoutRuntime.sig for the URI::Generic-typed schema resolver signature to avoid transitive uri dependency. |
| Library/Homebrew/formulary.rb | Adds explicit require "uri" to support runtime URI parsing/regex usage in formulary loaders. |
| Library/Homebrew/cask/url.rb | Adds explicit require "uri" to support runtime URI(...) usage in cask URL handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
brew lgtm(style, typechecking and tests) with your changes locally?Claude Code grepped for the same
URI::Generic-without-require "uri"shape across the tree, classified each site (sig-only vs runtime use), and applied the matching fix. I reviewed the diff and ensured a cleanbrew lgtm.Companion to #22160. Fixes the remaining instances of this issue.