Skip to content

fix: move bottle block below url in image formulas - #16

Merged
tuler merged 1 commit into
mainfrom
fix/components-order
Aug 11, 2026
Merged

tuler merged 1 commit into
mainfrom
fix/components-order

Conversation

@tuler

@tuler tuler commented Aug 11, 2026

Copy link
Copy Markdown
Member

brew style currently fails on main, which blocks every PR against the tap (including #15):

FormulaAudit/ComponentsOrder: url (line 12) should be put before bottle (line 5)

Why this happened

pr-pull put the bottle block there itself, in the two commits it pushed to main earlier today (1fad0bb, 061fefe). The two tools disagree because of the VERSION/LINUX_IMAGE constants sitting between homepage and url:

  • pr-pull inserts the block via FormulaAST#add_bottle_block → add_stanza (Library/Homebrew/utils/ast.rb). That walks the formula body top-to-bottom and breaks at the first node it does not recognise as a stanza. A constant assignment is not a stanza, so it stops there and inserts after the last thing it did recognise — homepage.
  • FormulaAudit/ComponentsOrder does no positional scanning. It ignores the constants entirely and compares the relative order of known components, so it sees bottle before url.

With the constants between homepage and url, the two can never agree.

This did not fail CI on main because pushes made by Actions with GITHUB_TOKEN do not trigger workflows, so tests.yml never ran after pr-pull rewrote the files.

The fix

Remove the constants and inline the URL, so url sits in its canonical position and install derives the filename from it. Both tools then agree, and a future pr-pull takes the replace_bottle_block path anyway, which edits in place.

⚠️ brew style --fix does not fix this correctly — it hoists url above the constants it interpolates, and both formulas then fail to load with uninitialized constant LINUX_IMAGE / ROOTFS_IMAGE.

Bottles

Version and revision are unchanged and the bottle blocks are preserved verbatim, so the published bottles stay valid. This should be merged normally rather than with the pr-pull label, to avoid republishing bottles for a version+revision already in ghcr.io.

Verification

Locally on arm64 macOS:

  • brew style cartesi/tap — 6 files, no offenses (fails with 2 offenses before this change)
  • brew readall --aliases --os=all --arch=all cartesi/tap — clean
  • brew info --json=v2 — still 0.21.0 revision 2 for both, so existing bottles match
  • brew reinstall --build-from-source — identical cellar layout and etc/cartesi/images symlinks as before

🤖 Generated with Claude Code

brew style rejects the bottle block position that pr-pull produced:

  FormulaAudit/ComponentsOrder: url (line 12) should be put before
  bottle (line 5)

The two tools disagree because of the VERSION/LINUX_IMAGE constants
sitting between homepage and url. pr-pull inserts the bottle block via
FormulaAST#add_stanza, which scans the body top-to-bottom and stops at
the first node it does not recognise as a stanza -- a constant
assignment -- so it lands the block right after homepage. The
ComponentsOrder cop ignores the constants entirely and only compares the
relative order of known components, so it sees bottle before url.

Removing the constants lets both agree: url now sits in its canonical
position and install derives the filename from the url instead.

Note that `brew style --fix` does not fix this correctly -- it hoists url
above the constants it interpolates, and the formulas then fail to load
with "uninitialized constant LINUX_IMAGE".

Version and revision are unchanged, so the published bottles remain
valid and no republish is needed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@tuler
tuler merged commit 9e75e8f into main Aug 11, 2026
2 checks passed
@tuler
tuler deleted the fix/components-order branch August 11, 2026 18:03
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.

1 participant