Skip to content

Stop relying on transitive uri loads#22161

Merged
MikeMcQuaid merged 1 commit intomainfrom
uri-explicit-loads
May 7, 2026
Merged

Stop relying on transitive uri loads#22161
MikeMcQuaid merged 1 commit intomainfrom
uri-explicit-loads

Conversation

@p-linnane
Copy link
Copy Markdown
Member


  • 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? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes. Non-maintainers may only have one AI-assisted/generated PR open at a time.

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 clean brew lgtm.


Companion to #22160. Fixes the remaining instances of this issue.

Signed-off-by: Patrick Linnane <patrick@linnane.io>
Copilot AI review requested due to automatic review settings May 7, 2026 06:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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::Generic to T::Sig::WithoutRuntime.sig to avoid runtime evaluation.
  • Add explicit require "uri" where URI(...) / 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.

Copy link
Copy Markdown
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.

Thanks!

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue May 7, 2026
Merged via the queue into main with commit 29bb419 May 7, 2026
40 checks passed
@MikeMcQuaid MikeMcQuaid deleted the uri-explicit-loads branch May 7, 2026 08:56
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.

3 participants