Skip to content

feat(release): publish binary archives and a Homebrew formula - #1338

Merged
rdimitrov merged 2 commits into
mainfrom
feat/homebrew-tap-publishing
Sep 10, 2026
Merged

rdimitrov merged 2 commits into
mainfrom
feat/homebrew-tap-publishing

Conversation

@rdimitrov

Copy link
Copy Markdown
Member

Summary

A vX.Y.Z tag previously produced only ko container images and a Helm chart in GHCR — no GitHub Release, no binary archives — so the only documented way to get mecatl was to clone the repo and run task build.

  • Adds GoReleaser alongside ko to publish the CLI half of a release: one tarball per platform (darwin+linux × amd64+arm64) carrying both mecated and mecatui, attached to a real GitHub Release with checksums.txt, cosign sign-blob bundles, per-archive SBOMs and build provenance.
  • Pushes a generated mecatl formula to the existing public stacklok/homebrew-tap, so brew install stacklok/tap/mecatl installs both executables. Mirrors the mechanism stacklok/modelith and stacklok/toolhive already use.
  • ko remains the sole owner of every container image; the five existing image/chart jobs are untouched.
  • Also supplies the signed, checksummed binary that ADR 0028 §5 asks for, so the mecatequi composite action can eventually stop building from source on every consumer run.

Development stage

  • Plan / Interface
  • Implementation
  • Combined
  • Spike / Routine — acceptance-plan spine exempt

Checked for the spine-exempt property only. The work classifies as Architectural; the directing human explicitly waived the spine, which the template has no dedicated box for. See Contract linkage.

Contract linkage

  • Work classification: Architectural
  • Classification rationale: introduces a new deployment/operator distribution channel and a cross-repository write boundary (a GitHub App installation token committing to a public repo), and it redefines what a root v* tag produces — docs/usage/install.md previously described those as "container-image tags".
  • Decision record: None — no ADR authored, because the spine (and with it the ADR requirement) was waived for this work.
  • Human waiver of spine: Yes — the directing human authorized "waive the spine" for Homebrew tap publishing for mecatl, after being shown the Architectural classification and the alternative routes. Per docs/development-process.md the waiver lifts plan/interface ceremony only; layering rules, AGENTS.md invariants, verification gates and human merge authority are unchanged and were all honoured.
  • Acceptance plan: none (waived)
  • Human decisions resolved and recorded: Yes — payload, tooling, supply-chain parity, platform scope, tap-write mode, and smoke-test coverage were each decided by the directing human before implementation.
  • Plan / Interface PR: n/a (waived)
  • Approved commit baseline: n/a (waived)
  • Combined/exemption rationale: n/a

Interface conformance

No gRPC/protobuf, exported Go API, tool schema, event or persistence change. The interface surface is build/release configuration plus three new local-only Taskfile targets:

  • task release:check — validate .goreleaser.yaml offline
  • task release:snapshot — build archives + formula locally (no tag, no upload, no tokens)
  • task release:verify — assert both binaries per archive, the linker stamp, and brew style

New CI/release surface: one publish-cli job in release.yml, one smoke-darwin-arm64 job and one config-validation step in ci.yml.

Issue relationship

Closes #891
Relates to #890
Relates to #893

Divergence from the issues as written, all decided by the directing human. #890–#894 were filed 2026-08-31 describing a different route; three of their premises are deliberately superseded:

Issue as written This PR Why
#892: create a new private stacklok/homebrew-mecatl Uses the existing public stacklok/homebrew-tap The org already runs one tap for thv and modelith; a second tap repo was not wanted. Most of #892 and #894 become unnecessary.
#890/#892: private pre-launch tap + a user-owned credential shim for private asset downloads, "isolated for deletion at public launch" Not implemented Accepted instead: the formula 404s until stacklok/mecatl is public, which is days away. Avoids building and then deleting a credential workaround.
#890: Darwin ARM64 only, Intel macOS and Linux explicit non-goals; #892 AC3 wants Intel rejected All four platforms; Intel supported Deliberate widening. The code is CGO-free and cross-compiles cleanly.
#893: begin with a reviewable tap PR Direct commit to the tap's main Matches toolhive and modelith; the tap's main is unprotected.

#891's ACs are met with one wording difference: it specifies mecatl_vX.Y.Z_darwin_arm64.tar.gz plus a per-file .sha256 sidecar; GoReleaser strips the leading v and emits a single checksums.txt covering every artifact. The archive URL is still immutable under releases/download/vX.Y.Z/.

Type of change

  • Behavioral/interface plan
  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation/process
  • Other

Test plan

Baseline checks

  • Acceptance-plan checker — n/a, spine waived (no plan to check)
  • Linting (task lint) — 0 issues across all seven modules
  • Offline test suite (task test) — exit 0, zero failures
  • Offline demo (go run ./cmd/mecademo) — turn → tool.call → permission.ask + approval → result
  • Markdown changed: docs generation/link checks (task docs) — 372 docs, 3556 refs, 0 broken/orphan/unreachable
  • User docs changed: site build (task site:build) — clean under onBrokenLinks: 'throw'; /docs/install renders
  • Guarded engine API affected: compatibility check (task api:check) — runs under task test; no engine API touched
  • Intentional engine API change — n/a
  • Landed plan: strict acceptance trace (task ac-trace-strict) — n/a, no plan
  • Final implementation review: /panel-review — not run; available on request

Additionally:

  • actionlint clean; check-reusable-pins.sh and check-action-templates.sh pass.
  • task release:check + release:snapshot + release:verify: four archives built, both binaries at each archive root, --version reports the stamp (not dev+<sha>), brew style reports no offences.
  • The smoke-darwin-arm64 job's exact logic was run locally on darwin/arm64: both binaries build CGO-free, execute, and report <name> v0.0.0-cismoke.

Not runnable before merge, stated plainly: brew install stacklok/tap/mecatl cannot be exercised until the formula exists and stacklok/mecatl is public — Homebrew's downloader does not authenticate. cosign verify-blob and gh attestation verify likewise need the workflow's OIDC token, so a local snapshot has nothing to verify. brew audit requires the formula to live in a real tap, so only brew style was run.

One environment note: .github/scripts/lint-vet-workflow_test.sh cannot run on macOS (it uses mapfile, which needs bash 4+; macOS ships 3.2). Its assertions were hand-verified instead — analysis gained no go vet, no || true and no continue-on-error, and the vet job whose shell body it pins byte-for-byte is untouched.

Changes

File Change
.goreleaser.yaml New. Two builds, one archive carrying both binaries, checksums, SBOMs, cosign signing, the brews block, changelog and release config.
.github/workflows/release.yml New publish-cli job; concurrency re-keyed on the tag; header/permissions comments.
.github/workflows/ci.yml smoke-darwin-arm64 job; goreleaser check validation in analysis.
Taskfile.yml GORELEASER_VERSION + release:check / release:snapshot / release:verify; stale Go-version comment.
.gitignore Ignore /dist/.
user-docs/install.md New canonical install page.
user-docs/mecatui/getting-started.md Leads with brew install; task build demoted to a subsection.
README.md, docs/usage/install.md, docs/usage.md Install section; brew path; corrected tag framing.
13 further user-docs/ files Cross-links, category renumbering, and the bin/ → bare-command sweep.
.claude/skills/cut-release/SKILL.md Post-release verification of the Release and the tap; fix-forward warning; stuck-draft recovery.

User-facing change

brew install stacklok/tap/mecatl installs mecated and mecatui on macOS (Apple silicon and Intel) and Linux (x86_64 and arm64). Every release also attaches four verifiable archives to its GitHub Release. mecademo, mecatequi and mecak8s are not in the formula and remain source- or image-only.

The formula will 404 until stacklok/mecatl is public — Homebrew sends no credentials, so this affects everyone, not just non-members. It is inert in the meantime: the tap has no formula-validating CI, and a tap is independent Ruby files with no cross-formula resolution, so thv and modelith cannot be affected.

Special notes for reviewers

Five details worth scrutiny, each guarding a silent failure:

  1. The ldflags symbol is internal/buildinfo.BuildID, not main.version — the latter does not exist in this repo, and GoReleaser's default ldflags would stamp four nonexistent main.* symbols, leaving every tap user with dev+<sha>. It uses v{{ .Version }} because GoReleaser strips the leading v that ko and the Taskfile both stamp. Three things now pin this: the formula's test: block, task release:verify, and the new macOS smoke job.
  2. publish-cli checks out at fetch-depth: 0, unlike every ko job's fetch-depth: 1 — GoReleaser needs the full tag graph, and depth-1 also leaves .git/shallow. That also supplies origin/main for the tag-on-main guard without a credentialed fetch (verified in actions/checkout at the pinned SHA: fetchDepth <= 0 takes the all-history refspec unconditionally for tags). Note the guard uses origin/main, not modelith's git fetch --no-tags origin main, which would fail here under persist-credentials: false on an internal repo.
  3. concurrency was re-keyed from github.ref to the tag. On workflow_dispatch github.ref is refs/heads/main but on a tag push it is refs/tags/vX.Y.Z, so the two paths sat in different groups — a dispatch re-publish could race the original run. Tolerable for idempotent ko jobs; not for a Release object and a cross-repo commit.
  4. brews: is deprecated upstream in favour of homebrew_casks, and is kept deliberately: the tap is a Formula/ tap and casks must live in Casks/. Migrating is an org-wide move across three repos. Consequence: goreleaser check can exit 2, so both the CI step and task release:check tolerate 0|2 and fail only on 1.
  5. No gomod: block, deliberately. gomod.proxy: true would fetch github.com/stacklok/mecatl/engine from proxy.golang.org, where it does not exist — the root reaches it via replace … => ./engine. That would be a total release failure. Relatedly, go run github.com/goreleaser/goreleaser/v2@<ver> does not build on this toolchain (its graph resolves grpc v1.80.0 against an x/net lacking http2.TrailerPrefix), which is why the Taskfile expects goreleaser on PATH, like ko. CI is unaffected — goreleaser-action downloads a prebuilt binary.

The Homebrew-prefix guidance in session-storage-operations.md is prose outside the code fences. cmd/mecated/session_storage_continuity_scenario9_test.go parses those fenced blocks and asserts the exact /usr/local/bin/mecated argv. All four fenced blocks in that file are byte-identical to main (hash-compared before and after editing).

Coordination risk with no automated gate: the archive name_template, checksums.txt, the .sigstore.json suffix, and the cosign --certificate-identity-regexp are quoted verbatim in user-docs/install.md and the cut-release skill. They agree with the committed config today, but nothing enforces that they keep agreeing.

Credentials are already in place and reuse toolhive's App: stacklok/mecatl's HOMEBREW_TAP_APP_CLIENT_ID is byte-identical to toolhive's, so the App's installation on homebrew-tap and its contents: write grant are proven by toolhive's own releases rather than merely configured. One consequence worth noting: a single App's private key now sits in two repositories' secrets.

🤖 Generated with Claude Code

rdimitrov and others added 2 commits September 10, 2026 15:02
A `vX.Y.Z` tag previously produced only ko container images and a Helm chart
in GHCR — no GitHub Release, no binary archives — so the only documented way
to get mecatl was to clone the repo and run `task build`.

Add GoReleaser alongside ko to publish the CLI half of a release: one tarball
per platform (darwin/linux x amd64/arm64) carrying both `mecated` and
`mecatui`, attached to a real GitHub Release with checksums, cosign sign-blob
bundles, per-archive SBOMs and build provenance, plus a generated `mecatl`
formula committed to the public stacklok/homebrew-tap. ko remains the sole
owner of every container image; the new `publish-cli` job takes no `needs:`
edge and runs the reusable-pin gate itself.

This mirrors the mechanism stacklok/modelith and stacklok/toolhive already
use, and it also supplies the signed, checksummed binary that ADR 0028 §5
asks for so the mecatequi composite action can stop building from source on
every consumer run.

Three details that would otherwise fail silently:

* The ldflags stamp is `internal/buildinfo.BuildID`, not `main.version`
  (which does not exist here), and uses `v{{ .Version }}` because GoReleaser
  strips the leading `v` that ko and the Taskfile both stamp. The formula's
  `test:` block asserts both binaries report the tag, so a regression fails
  `brew test` instead of shipping `dev+<sha>` to every tap user.
* `publish-cli` checks out at `fetch-depth: 0`, unlike the ko jobs, because
  GoReleaser needs the full tag graph; that also provides `origin/main` for
  the tag-on-main guard without a credentialed fetch.
* `concurrency` is now keyed on the tag rather than `github.ref`, which
  differs between the tag-push and workflow_dispatch paths and would let a
  re-publish race the original run.

`brews:` is deprecated upstream in favour of `homebrew_casks` but kept
deliberately: the tap is a `Formula/` tap and casks must live in `Casks/`.
`goreleaser check` therefore tolerates exit 2 in CI and `task release:check`.

Docs: `user-docs/install.md` is the new canonical install page (nothing owned
that topic before), `brew install` leads the README and the mecatui
getting-started page, and PATH-style examples drop their `bin/` prefix. The
Homebrew-prefix guidance in session-storage-operations.md is prose outside the
fences, because cmd/mecated's Scenario9 tests parse those code blocks and
assert the exact `/usr/local/bin/mecated` argv.

Local verification: `task release:check`, `task release:snapshot` and
`task release:verify` build the archives and formula with no tag, no upload
and no tokens; `release:verify` asserts both binaries are at the archive
root, that the linker stamp landed, and that `brew style` is clean.

`brew install stacklok/tap/mecatl` will 404 until stacklok/mecatl is public,
because Homebrew's downloader does not authenticate. The formula is inert
until then and cannot affect other formulas in the tap.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Release archives are cross-compiled for darwin on an ubuntu runner, which
cannot execute them, so nothing in CI ever ran a darwin binary. The only
execution check was the formula's own `brew test`, which runs after the
formula is already public.

Add a macos-14 job that builds `mecated` and `mecatui` CGO-free, runs each
with `--version`, and asserts the exact `<name> <BuildID>` output. That pins
the buildinfo.BuildID linker stamp: a wrong -X symbol path still compiles and
still yields a working binary, it just reports the `dev+<vcs-rev>` fallback —
so this is the only gate that catches it before publication.

Addresses the native-smoke-test note in #891.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@rdimitrov
rdimitrov merged commit 56f4bfa into main Sep 10, 2026
33 checks passed
@rdimitrov
rdimitrov deleted the feat/homebrew-tap-publishing branch September 10, 2026 12:29
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.

release: publish signed darwin/arm64 mecated and mecatui archives

2 participants