Skip to content

fix(release): hoist install out of the generated formula's on_arm blocks - #212

Merged
gjtorikian merged 1 commit into
mainfrom
fix/homebrew-formula-style
Jul 27, 2026
Merged

fix(release): hoist install out of the generated formula's on_arm blocks#212
gjtorikian merged 1 commit into
mainfrom
fix/homebrew-formula-style

Conversation

@gjtorikian

Copy link
Copy Markdown
Contributor

Summary

brew style workos/tap fails on Formula/workos.rb, which takes brew test-bot --only-tap-syntax red on every workos/homebrew-tap pull request (e.g. homebrew-tap#3, a README-only change).

Homebrew 6.0 enforces RuboCop's Sorbet/BlockMethodDefinition, which rejects def inside a block. scripts/gen-homebrew-formula.ts emits a def install inside each on_arm/on_intel stanza, so the generated formula now trips it four times:

Formula/workos.rb:17:7: C: [Correctable] Sorbet/BlockMethodDefinition:
  Do not define methods in blocks (use define_method as a workaround).
      def install ...

Change

Drop install from the per-arch stanzas (they now pin only url + sha256) and emit one class-level def install that globs whichever asset the current platform downloaded. This is the same shape as Formula/workos-emulate.rb, which is already clean under the new cop — so the tap ends up with one consistent pattern.

  def install
    binary = Dir["workos-*"].first
    odie "No workos-* binary in the staging directory" if binary.nil?
    bin.install binary => "workos"
  end

The odie guard is the one deviation from the emulate formula: a bare Dir[...].first returns nil on a miss and fails with an opaque error, so this names the cause.

Verification

Ran the generator with stub binaries, then the full --only-tap-syntax suite against a scratch tap built from the real remote main with the patched formula dropped in — local brew is 6.0.13, the same version CI uses:

step before after
brew style 3 files, 4 offenses 3 files, no offenses
brew readall --aliases --os=all --arch=all pass pass
brew audit --except=installed pass pass

Notes

  • Formula-only restructuring — no change to URLs, shas, version stamping, or the release workflow.
  • The tap's checked-in Formula/workos.rb stays stale until the next release regenerates it, so it needs the same edit by hand to unblock homebrew-tap CI now. Companion PR: fix: hoist install out of workos.rb's on_arm blocks homebrew-tap#4.

🤖 Generated with Claude Code

Homebrew 6.0 enforces RuboCop's Sorbet/BlockMethodDefinition, which
rejects `def` inside a block. The generated formula put a `def install`
in each on_arm/on_intel stanza, so `brew style workos/tap` now fails
with four offenses and takes `brew test-bot --only-tap-syntax` red on
every homebrew-tap pull request.

Emit a single class-level `def install` that globs the one asset the
current platform downloaded, matching Formula/workos-emulate.rb in the
same tap. Verified with brew 6.0.13: style, readall, and audit are all
clean against a scratch tap built from the patched formula.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Jul 27, 2026

Copy link
Copy Markdown

Greptile Summary

Updates the Homebrew formula generator to:

  • Keep architecture blocks limited to platform-specific URLs and checksums.
  • Emit one class-level install method that discovers and installs the downloaded WorkOS binary.
  • Provide a clear error when no matching binary exists.

Confidence Score: 5/5

The PR appears safe to merge with no actionable defects identified in the generator change.

The generated formula retains architecture-specific URLs and checksums while moving installation to a valid class-level method that installs the single downloaded platform asset.

Important Files Changed

Filename Overview
scripts/gen-homebrew-formula.ts Hoists the generated Homebrew install method out of architecture blocks while preserving platform-specific artifact selection and checksum declarations.

Reviews (1): Last reviewed commit: "fix(release): hoist install out of the f..." | Re-trigger Greptile

@gjtorikian
gjtorikian merged commit 6550742 into main Jul 27, 2026
5 checks passed
@gjtorikian
gjtorikian deleted the fix/homebrew-formula-style branch July 27, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant