fix(release): patch the correct Homebrew cask checksum stanza - #88
Merged
yvonnedevlinrh merged 5 commits intoAug 24, 2026
Merged
Conversation
Specify strict darwin stanza targeting, independent release-manifest validation, and fixture-based regression tests executed by pull-request CI. The production integrity logic will live in one checked-in script used by both the release workflow and its tests. Fixes: unbound-force#87
Replace the inline awk with one checked-in integrity script that computes the downloaded darwin archive SHA, requires one matching release-manifest entry, patches exactly one strictly-adjacent darwin stanza, and verifies the result before replacing the cask. Add the v0.5.0 cask template as a regression fixture and exercise malformed stanzas, comments, stale candidates, and manifest failures in pull-request CI. Invalid inputs leave the original cask unchanged. Fixes: unbound-force#87
Separate the TOCTOU fix from the wrong-stanza checksum defect and record that v0.5.0 remained broken on macOS arm64 and Linux amd64.
Compare the extracted SHA with awk string equality rather than a dynamic regular expression, matching the specification's literal-comparison MUST. Assert every negative fixture emits an error annotation and compare the successful result against the complete expected cask. Correct the OpenSpec impact and verification descriptions to match the final CI and script surface.
yvonnedevlinrh
approved these changes
Aug 24, 2026
yvonnedevlinrh
left a comment
Contributor
There was a problem hiding this comment.
Review: APPROVE
Bug Verification: CONFIRMED
Reproduced locally by running both old and new AWK scripts against the actual v0.5.0 replicator.rb cask template.
Cask stanza structure — sha256 comes before url:
on_arm do
sha256 "ea3278e..." # line 7
url "...darwin_arm64..." # line 8 — marker is AFTER sha256
end- Old AWK: Forward-scan sets
found_arm64=1on theurlline, then the next/sha256/match belongs tolinux_amd64→ wrong stanza patched. - New AWK: Two-pass records all lines, tracks most-recently-seen
sha_line, snapshots it asdarwin_sha_linewhen/darwin_arm64/hits, patches only that line in END block → correct stanza patched.
Confirmed: old script produces linux_amd64 with darwin's hash; new script correctly patches only darwin_arm64.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sha256, then compare the patched value literallyRoot cause
GoReleaser emits each cask stanza as
sha256followed byurl. The old workflow started scanning when it sawdarwin_arm64on the URL line, then replaced the nextsha256— the followinglinux_amd64stanza.In v0.5.0 this left darwin's stale pre-notarization SHA on the darwin stanza and wrote darwin's actual SHA onto the linux_amd64 stanza.
brew installtherefore failed on both macOS arm64 and Linux amd64. The old file-wide grep still passed because the darwin SHA appeared somewhere in the file.The v0.5.0 tap remains broken until a subsequent release republishes the cask (or the tap is corrected separately). This PR makes subsequent releases self-heal from the clean GoReleaser cask asset.
Fixes #87
Verification
.github/scripts/patch-homebrew-cask_test.shdarwin_arm64comments::error::emitted on every failureactionlintv1.7.7 with ShellCheck v0.10.0: passmake check: passmake check-coverage: pass (all ratchets)go build ./cmd/replicator: passgovulncheck ./...: no vulnerabilitiesProcess
openspec/changes/fix-cask-sha-stanza-targeting/actions/checkoutremains pinned to verified v7.0.1 commit3d3c42e5aac5ba805825da76410c181273ba90b1