Skip to content

portable-ruby: inline validation into test-bot, automate brew updates#22393

Merged
MikeMcQuaid merged 2 commits into
mainfrom
inline-portable-ruby-into-test-bot
May 24, 2026
Merged

portable-ruby: inline validation into test-bot, automate brew updates#22393
MikeMcQuaid merged 2 commits into
mainfrom
inline-portable-ruby-into-test-bot

Conversation

@p-linnane
Copy link
Copy Markdown
Member

@p-linnane p-linnane commented May 23, 2026


  • 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 Opus 4.7 did the initial implementation. I performed manual review and testing. The validation suite itself has not been exercised end-to-end yet. Its first live run will be on the next portable-ruby bump.


Adds Homebrew/brew PR-style validation (style, typecheck, tests --online, tests --generic, update-test, test-bot --test-default-formula) to test-bot's portable_formula! so a portable-ruby bottle is verified against brew's own code in the homebrew-core PR before bottling, instead of on the follow-up brew bump PR.

Consolidates brew update-portable-ruby into a single hidden one-shot command (read formula → write vendor files → vendor-install → sync bundler/gems/RBIs) so the companion Homebrew/homebrew-core#284463 can call it from publish-commit-bottles.yml after a portable-ruby bottle is published.

Also scopes actions/create-github-app-token permissions in vendor-gems.yml.

Copilot AI review requested due to automatic review settings May 23, 2026 02:08
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 shifts portable-ruby validation earlier into test-bot so the newly built portable-ruby bottle is exercised against Homebrew/brew’s own PR-gating checks during the homebrew-core bottle build, and it replaces the manual brew update-portable-ruby dev-cmd with an automated workflow that opens a brew bump PR when a portable-ruby bottle is published.

Changes:

  • Extend test-bot’s portable_formula! path to stage the built portable-ruby bottle, run brew vendor-install ruby, and then run brew’s PR validation surface.
  • Add Utils::PortableRuby.sync_bundler_version! helper and use it from test-bot/workflow to keep utils/ruby.sh bundler version in sync with the vendored portable Ruby.
  • Remove the update-portable-ruby dev-cmd/spec/RBI and add a bump-portable-ruby.yml workflow to open an automated brew bump PR.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Library/Homebrew/utils/portable_ruby.rb New helper for syncing bundler version based on the vendored portable Ruby contents.
Library/Homebrew/test_bot/formulae.rb Adds portable-ruby-specific post-bottle validation steps and threads args through portable_formula!.
Library/Homebrew/dev-cmd/update-portable-ruby.rb Removes the dev-cmd in favor of automation.
Library/Homebrew/test/dev-cmd/update-portable-ruby_spec.rb Removes tests for the deleted dev-cmd.
Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/update_portable_ruby.rbi Removes RBI for the deleted dev-cmd.
.github/workflows/vendor-gems.yml Scopes app-token permissions and updates messaging to point to the new workflow.
.github/workflows/bump-portable-ruby.yml New workflow to generate vendored portable-ruby updates and open an automated PR.
Files not reviewed (1)
  • Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/update_portable_ruby.rbi: Language not supported
Comments suppressed due to low confidence (2)

Library/Homebrew/test_bot/formulae.rb:836

  • Utils::PortableRuby is referenced here but there is no require "utils/portable_ruby" in test_bot/formulae.rb or any upstream require (a repo-wide search shows no requires). This will raise uninitialized constant Utils::PortableRuby when the portable-ruby validation path runs; add an explicit require in an appropriate entrypoint (e.g. test_bot.rb or this file).
        test "brew", "vendor-install", "ruby"

        bundler_version = Utils::PortableRuby.sync_bundler_version!(pkg_version)
        test "brew", "vendor-gems", "--no-commit", "--update=--ruby,--bundler=#{bundler_version}"
        test "brew", "typecheck", "--update"

Library/Homebrew/test_bot/formulae.rb:818

  • This computes a SHA256 via Digest::SHA256 without requiring digest/sha2. In the portable-ruby test-bot path, Digest may not have been loaded yet, causing a NameError. Consider using the existing Pathname#sha256 helper (bottle_file.sha256), which already does the necessary require and is used elsewhere in test-bot.
        tag_symbol = tag_string.to_sym
        bottle_tag = Utils::Bottles::Tag.from_symbol(tag_symbol)
        sha256 = Digest::SHA256.file(bottle_file).hexdigest
        version = pkg_version.split("_").first.to_s

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Library/Homebrew/utils/portable_ruby.rb
Comment thread Library/Homebrew/test_bot/formulae.rb
Comment thread .github/workflows/vendor-gems.yml
@p-linnane p-linnane force-pushed the inline-portable-ruby-into-test-bot branch 2 times, most recently from c3374c6 to 837bcc8 Compare May 23, 2026 02:22
@p-linnane p-linnane requested a review from Copilot May 23, 2026 02:23
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

Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/update_portable_ruby.rbi: Language not supported

Comment thread Library/Homebrew/test_bot/formulae.rb
Comment thread Library/Homebrew/test_bot/formulae.rb
Comment thread .github/workflows/bump-portable-ruby.yml Outdated
@p-linnane p-linnane force-pushed the inline-portable-ruby-into-test-bot branch from 837bcc8 to 28674d3 Compare May 23, 2026 02:33
@p-linnane p-linnane requested a review from Copilot May 23, 2026 02:34
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

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • Library/Homebrew/sorbet/rbi/dsl/homebrew/dev_cmd/update_portable_ruby.rbi: Language not supported

Comment thread Library/Homebrew/test_bot/formulae.rb
Comment thread Library/Homebrew/test_bot/formulae.rb Outdated
After `brew bottle portable-ruby` succeeds, stage the just-built bottle
into `HOMEBREW_CACHE`, swap in the vendored portable-ruby, and run the
Homebrew/brew PR CI surface against it so issues are caught in the
homebrew-core PR rather than the follow-up brew bump PR.

Shared bundler-syncing logic lives in a small `Utils::PortableRuby`
helper for reuse with the new `bump-portable-ruby` workflow.
@p-linnane p-linnane force-pushed the inline-portable-ruby-into-test-bot branch from 28674d3 to b0f0664 Compare May 23, 2026 02:43
@p-linnane
Copy link
Copy Markdown
Member Author

Not adding a new spec since we're inlining everything.

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, looking good, few more comments!

Comment thread Library/Homebrew/test_bot/formulae.rb
Comment thread .github/workflows/bump-portable-ruby.yml Outdated
Comment thread .github/workflows/bump-portable-ruby.yml Outdated
Comment thread .github/workflows/bump-portable-ruby.yml Outdated
Comment thread .github/workflows/bump-portable-ruby.yml Outdated
Rewrites `update-portable-ruby` as a single hidden command that reads the
`portable-ruby` formula, writes vendor files, runs `brew vendor-install
ruby`, then syncs `utils/ruby.sh`, vendored gems and RBI files via the
new `Utils::PortableRuby.sync_bundler_version!` helper. Drops
`--dry-run` and `--skip-vendor-install` and hides from `brew help` since
this is now meant to be invoked from the homebrew-core bottle-publish
workflow rather than by hand.

Also scopes the `actions/create-github-app-token` permissions in
`vendor-gems.yml` to `contents: write`.
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 24, 2026
Merged via the queue into main with commit 2dd64a5 May 24, 2026
39 checks passed
@MikeMcQuaid MikeMcQuaid deleted the inline-portable-ruby-into-test-bot branch May 24, 2026 12:02
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.

4 participants