Skip to content

ci(release): pre-releases publish to Homebrew as fluree-beta - #2045

Merged
bplatz merged 4 commits into
mainfrom
ci/homebrew-beta-channel
Oct 14, 2026
Merged

bplatz merged 4 commits into
mainfrom
ci/homebrew-beta-channel

Conversation

@bplatz

@bplatz bplatz commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Pre-releases had no Homebrew path. The tap job skipped them, and turning on dist's publish-prereleases would have written each pre-release over fluree.rb, moving every brew upgrade user onto the beta.

What changes. The tap gets a second formula, fluree-beta, which follows the newest release, pre-release or stable. A pre-release tag updates only fluree-beta. A stable tag updates both, so beta users move to the stable release once it supersedes their beta. fluree stays on stable releases.

fluree-beta is keg-only: it installs beside fluree without replacing the one on PATH, and users run it as "$(brew --prefix fluree/tap/fluree-beta)/bin/fluree" or put its bin first in PATH. That suits comparing a beta with the stable release and going back. The name can't be fluree@beta, because Homebrew only turns @ into a valid class name when a digit follows it.

How the job works.

  • dist's formula is downloaded outside the tap checkout. Before, it landed directly in Formula/, which would have overwritten the stable fluree.rb in a pre-release run.
  • The beta formula is dist's own, with the class renamed to FlureeBeta, a keg_only line and its own desc. The job fails unless both the rename and the keg_only line happened, so a change in dist's formula can't publish a fluree-beta that Homebrew links.
  • Staged formulae go through brew style --fix under a Formula/ directory, since Homebrew applies its formula cops by path, so the stable formula gets the same fixes as before.
  • Each push attempt resets to the tap's latest commit and re-applies the formulae, retrying up to five times, so a concurrent push to the tap (fluree-ai's release also writes there) is retried rather than lost.
  • A formula never moves to an older version. Re-running an old release, or a stable 4.x release after a 5.0.0-beta from next, leaves the newer formula in place. A re-run that changes nothing makes no commit.

Verified. I ran the job's script, taken straight from this workflow, in an ubuntu:22.04 container against a copy of the real tap, with the beta.2 formula from its GitHub release. The cases: a pre-release commit touches only Formula/fluree-beta.rb; re-running it makes no commit; a stable release moves both formulae; an older stable re-run leaves both alone; a 5.0.0-beta.1 and then a stable 4.2.5 leave fluree-beta at 5.0.0-beta.1; and a push that lost a race to another commit succeeded on retry.

Separately, Homebrew installed the generated fluree-beta (beta.2) from a local tap beside an installed fluree 4.2.3. fluree on PATH stayed 4.2.3, the keg reported 4.2.4-beta.2, and Homebrew printed the keg-only caveat. actionlint passes with CI's flags.

The job only runs on a tag. This merges before v4.2.4 is tagged, so the stable 4.2.4 release is its first real run: it moves fluree to 4.2.4 and creates fluree-beta at 4.2.4. A tag runs the workflow file at the tagged commit, so a failed run can't be fixed by re-running; the fallback is a hand commit to the tap, as for 4.1.5. The tap's own README still mentions only fluree.

Every release now publishes to the tap. A stable release updates `fluree`
and `fluree-beta`; a pre-release updates only `fluree-beta`, a keg-only
copy of the dist formula that installs beside `fluree`. dist's own
publish-prereleases stays off: it writes a pre-release as `fluree.rb`.

Formulae are staged outside the tap checkout, so only the chosen ones
reach it. Each push attempt rebuilds on the tap's latest commit, skips
an unchanged formula and never moves one to an older version.
@bplatz bplatz added enhancement New feature or request area:cli fluree CLI UX, rdf toolkit, publish/export/insert flows labels Oct 9, 2026
@bplatz
bplatz requested a review from a team October 9, 2026 11:22
@aaj3f aaj3f mentioned this pull request Oct 13, 2026

@aaj3f aaj3f left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@bplatz this is a nice design, and no pushback from me on it: deriving fluree-beta from dist's own formula, staging outside the tap so a pre-release structurally can't reach fluree.rb, and the never-backwards guard together cover every case I could think of, and I ran them. One note on order with #2041: a tag runs the workflow at the tagged commit, so if this lands before v4.2.4 is tagged, the stable 4.2.4 run (the one that writes fluree.rb for everyone) becomes this job's first real run, rather than the next beta as the body says. I ran that path and expect it to be fine, so I don't think either PR needs to wait on the other; merging this one after the tag just means the first real run lands on the opt-in formula.

Full review below:


✅ Approve with nits.

Thanks @bplatz, this is carefully built. The part I most wanted to see is structural: dist's formula never lands in the tap checkout, so a pre-release can only reach Formula/fluree.rb through the manifest, and only an explicit announcement_is_prerelease: false puts it there. I ran the step's script in the runner's userland across the cases in your body plus a few more (details on line 381), and all of them behaved as described. There's one small hardening note inline and a couple of notes here.

  • 🟡 keg_only isn't checked (release.yml:391, inline). A missing license line yields a non-keg-only fluree-beta and a green job. It's a one-line flag.
  • First real run. The body says the next pre-release tag is this job's first real run. That holds only if this merges after v4.2.4 is tagged. If it's on main when #2041 merges and you tag, the stable 4.2.4 run comes first. I ran that path (commit fluree 4.2.4, fluree-beta 4.2.4, both formulae moved), so I don't expect trouble. If it did fail, a re-run wouldn't help (same workflow file at the tag), and the fix would be a hand commit to the tap like 4.1.5's. Merging after the tag avoids even that, but it's your call.
  • 🟡 The tap's README still lists only fluree. It's a two-line change in fluree/homebrew-tap, and since this PR is what creates fluree-beta there, I'd push it alongside. Minor, but if you agree, I'd rather it go out with this than after.

What I checked and found clean:

  • With the if: gone, the job runs exactly when host succeeded: every tag that made a GitHub Release, never a PR (it was skipped along with host on this PR's Release run). Docker and AUR keep their stable-only if:. announce now waits on the tap job for pre-releases too, but its only step is a checkout.
  • The dpkg-with-~ ordering agrees with Homebrew's own Version comparison on the pairs that matter (4.2.4 > 4.2.4-beta.2, beta.10 > beta.2, rc.1 > beta.2, 5.0.0-beta.1 > 4.2.5; checked with brew ruby). So brew upgrade does move a beta install to the stable release that supersedes it, as the quickstart says.
  • The generated fluree-beta.rb differs from dist's in exactly the class, desc and keg_only lines. url, sha256 and version are untouched, and ruby -c passes. Formulary.class_s("fluree@beta") is Fluree@beta, so the naming reasoning holds.
  • actionlint 1.7.12 with CI's flags passes. With shellcheck on, the new script is clean (the four remaining reports are in dist's unchanged steps).
  • The README anchor #option-2-homebrew-macos--linux matches the quickstart heading.

Adherence to repo commitments:

  • Patterns/abstractions: ✔ Stays inside dist's generated job (allow-dirty = ["ci"]) and derives the beta from dist's formula rather than templating a second one. releasing.md records why publish-prereleases stays off.
  • Performance (speed first, memory second): ✔ n/a: release workflow and docs only, no engine code.
  • Deployment targets: ✔ n/a for the engine. The job's one host is the ubuntu-22.04 runner, and the evidence (yours and mine) comes from ubuntu:22.04 containers.
  • Testing: ⚠️ Nothing in CI executes this job (publish jobs are skipped on PRs by construction), so the coverage is the two container runs plus workflow-lint. That's the right evidence for a tag-only job, just worth knowing.
  • Conventions: ✔ Multi-line commit body, self-describing title, and docs updated in all three places a user or releaser would look.

Verified locally at dc338bc3a: the step's script in ubuntu:22.04 against a bare copy of the tap (ten cases, all as described); the awk with and without a license line; Homebrew's Version ordering and class naming via brew ruby; actionlint with CI's flags and shellcheck on the new script; read-only gh api for check runs, release manifests, the tap's contents and history, and tags. I didn't run brew style --fix or a real push.

Approving so you can merge when ready, but maybe worth folding in the keg_only check first.

Comment thread .github/workflows/release.yml Outdated
sub(/^class [A-Za-z0-9]+/, "&Beta") { renamed = 1 }
/^ desc "/ { sub(/"$/, " (including pre-releases)\"") }
{ print }
/^ license / { print " keg_only \"it installs the same commands as the stable formula\"" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Optional: the keg_only line is the one guarantee here the script doesn't check.

The awk fails the job when no class line was renamed (END { exit !renamed }), but keg_only is only printed after a ^ license line, and nothing notices when that line isn't there. I ran this block (mawk, in ubuntu:22.04) on beta.2's fluree.rb with the license line removed: it exits 0 and writes a FlureeBeta with no keg_only.

Today that can't happen, since the workspace sets license = "BUSL-1.1" and dist is pinned at 0.31.0. But a dist bump that moves or drops that line would publish a fluree-beta that Homebrew tries to link, so it would collide with an installed fluree's bin/fluree, or, installed first, become the fluree on PATH. That's the opposite of what the quickstart now promises.

Setting a flag next to the print and checking both in END would make it fail loudly instead (illustrative, lines 391–392):

  /^  license / { print "  keg_only \"it installs the same commands as the stable formula\""; keg = 1 }
  END { exit !(renamed && keg) }

I recognize this is minor and non-blocking — but if you agree it's right, I'd rather see it folded in now than lost in the backlog.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Folded in (7ab08d8), with your flag: keg = 1 beside the print, and END { exit !(renamed && keg) }. I ran the block exactly as it is in the workflow on beta.2's fluree.rb under mawk in ubuntu:22.04 (and macOS awk):

  • unchanged, it exits 0, and the output still differs from dist's only in the class, desc and keg_only lines;
  • with the license line removed, it exits 1 and writes no keg_only;
  • with the class line broken, it exits 1.

brew update
# We avoid reformatting user-provided data such as the app description and homepage.
brew style --except-cops FormulaAudit/Homepage,FormulaAudit/Desc,FormulaAuditStrict --fix "Formula/${filename}" || true
if [ "$prerelease" = false ]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 Only an explicit false writes fluree.rb, and that held up when I ran it.

I ran this step's script verbatim in ubuntu:22.04 (mawk, dpkg 1.21.1, bash 5.1 under -e, with brew stubbed) against a bare copy of the real tap. beta.2 created only Formula/fluree-beta.rb. A re-run made no commit. A stable 4.2.4 moved both. A 4.2.3 re-run left both alone. 5.0.0-beta.1 and then a stable 4.2.5 left fluree-beta on the beta and kept a concurrent fluree-ai commit. A push rejected once by a hook went through on the second attempt.

I also dropped announcement_is_prerelease from the plan entirely: fluree.rb stayed put and only fluree-beta moved. So a manifest change fails toward the opt-in formula rather than the one every brew upgrade user gets. Staging dist's output outside the checkout is what makes that structural rather than careful.

The awk that derives fluree-beta.rb from dist's formula failed when no
class line was renamed, but added keg_only only after a license line and
never checked it had. A dist change that moved or dropped that line would
publish a fluree-beta Homebrew links, colliding with an installed fluree
or becoming the fluree on PATH. The job now fails unless both the class
rename and the keg_only line happened.
@bplatz

bplatz commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

@aaj3f thanks. On the two notes in the review body:

  • First real run. This is merging ahead of v4.2.4, so the stable 4.2.4 run is the job's first real one, as you described. It should make one tap commit that moves fluree.rb to 4.2.4 and creates fluree-beta.rb at 4.2.4. We'll check that commit and a brew install fluree/tap/fluree-beta once the tag runs. If the run fails, the fallback is a hand commit to the tap, as for 4.1.5. The body now says so.
  • Tap README. Agreed. Its fluree-beta section goes in once 4.2.4 creates the formula, so the README never points at a formula brew can't find.

The keg_only check is in 7ab08d8.

@bplatz
bplatz merged commit a4acb03 into main Oct 14, 2026
19 checks passed
@bplatz
bplatz deleted the ci/homebrew-beta-channel branch October 14, 2026 02:30
aaj3f added a commit that referenced this pull request Oct 14, 2026
Brings in #2102 (one HTTP status table), #2068, #2056, #2053, #2046,
#2045 and the v4.2.4 release.

- api error.rs: main's exhaustive status_code / error_type tables, with
  ApiError::ConfigUnavailable and TransactError::ConfigUnavailable
  classified as 500 err:storage/ReadFailure in both, and rows for them
  and RequestOverrideRefused in every_variant.
- server error.rs: main's derivation from ApiError; this branch's
  ConfigUnavailable arms move to the API tables.
- consensus: SubmissionError keeps both ConfigUnavailable and
  CommitContention.
- server routes/transact.rs: both submission arms and test rows.
- transaction.rs, tx_builder.rs: main's txn_attempts loops, with this
  branch's request-governance argument on every stage_plan / stage_all
  call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli fluree CLI UX, rdf toolkit, publish/export/insert flows enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants