fix: harden tap bump against layout changes and bad downloads - #294
Merged
Conversation
This workflow rewrote each checksum by line position:
gsed -i "/ARTIFACT\"/!b;n;c\ sha256 \"${sha}\""
It matched the url line, advanced one line, and replaced whatever it
landed on. Correct only while sha256 sits directly beneath url inside an
on_macos or on_linux block, which is how Formula/all-smi.rb is written
today.
lablup/mlxcel and lablup/bssh carried the same construct, all three copied
from a common source. In mlxcel it went wrong: the formula moved its url to
the top level with a `version` stanza in between, so the next bump
overwrote `version` with the new checksum and left the previous release's
sha256 below it. The formula ended up with no version and two sha256 lines,
the second of which wins, so `brew install` failed on checksum. Nothing
validated the result and it sat broken in the tap for three days
(lablup/homebrew-tap 9969ec4).
all-smi is not broken today, but it is one formula edit away from the same
outcome. This is the last of the three copies.
Stanzas are now located by name. `set_artifact` finds the url stanza whose
value contains a given artifact, rewrites it, then rewrites the first
sha256 stanza below it, preserving indentation. Anything in between is
skipped rather than clobbered. Guards abort the run when the formula does
not hold exactly one matching url, or when no sha256 follows it, instead of
editing the wrong line.
Two other faults, both shared with bssh and fixed the same way:
Downloads used `curl -Ls` with no `-f`, so a missing or renamed asset
produced a zero-byte file and its checksum went to the tap unnoticed. They
now use `-f --retry 3`, reject empty files, and verify each archive is
readable with `unzip -t` or `tar -tzf`.
`git commit` ran unconditionally, so re-running for a version already in
the tap failed on an empty index. It now exits cleanly.
A validation step runs `ruby -c` and `brew style` on the formula, checks the
version stanza, and requires exactly the three checksums downloaded this
run, which catches a substitution that silently no-ops. `ruby -c` alone is
not enough: the corrupted mlxcel formula was valid Ruby.
Verified against the current tap formula. Bumping to a synthetic version
puts all three urls and checksums in the right place, the validation checks
pass, and `brew style` reports no offenses. The workflow YAML parses.
Unrelated observation, left alone here: the download base is still
https://github.com/inureyes/all-smi, which works only through GitHub's
rename redirect to lablup/all-smi. It also lands in the tap formula's url
stanzas. Worth changing deliberately rather than as a side effect of this
fix, since it alters what gets written to the tap.
inureyes
added a commit
that referenced
this pull request
Jul 31, 2026
Bump the version to 0.25.0 across Cargo.toml, Cargo.lock, the manpage, and debian/changelog, and add the README "Recent Updates" entry. Covers the 10 commits since v0.24.2: local collection pipeline parallelization (#299), continuous IOReport sampling and a dedicated local polling cadence (#286), time-scrolling history graphs (#285), the local-mode collection cost benchmark and its topology, pinning, and affinity-mask reporting (#289, #291, #296, #298), and the Homebrew tap bump workflow hardening and repository rename fix (#294, #295).
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.
Problem
update_homebrew_formula.ymlrewrote each checksum by line position:gsed -i "/ARTIFACT\"/!b;n;c\ sha256 \"${sha}\""It matched the url line, advanced one line (
n), and replaced whatever it landed on (c\). Correct only while sha256 sits directly beneath url inside anon_macos/on_linuxblock, which is howFormula/all-smi.rbis written today.lablup/mlxcel and lablup/bssh carried the same construct, all three copied from a common source. In mlxcel it went wrong: the formula moved its url to the top level with a
versionstanza in between, so the next bump overwroteversionwith the new checksum and left the previous release's sha256 below it:No version stanza, two sha256 lines,
brew installfailing on checksum. Nothing validated the result and it sat broken in the tap for three days (lablup/homebrew-tap9969ec4).all-smi is not broken today, but it is one formula edit away from the same outcome. This is the last of the three copies.
Fix
Stanzas are located by name.
set_artifactfinds the url stanza whose value contains a given artifact, rewrites it, then rewrites the first sha256 stanza below it, preserving indentation. Anything in between is skipped rather than clobbered. Guards abort when the formula does not hold exactly one matching url, or when no sha256 follows it.Two other faults, both shared with bssh and fixed the same way:
curl -Lswith no-f. A missing or renamed asset produced a zero-byte file whose checksum went to the tap unnoticed. Now-f --retry 3, plus an empty-file check and an archive integrity check (unzip -t/tar -tzf).git commit. Re-running for a version already in the tap failed on an empty index. It now exits cleanly.A validation step runs
ruby -candbrew style, checks the version stanza, and requires exactly the three checksums downloaded this run, which catches a substitution that silently no-ops.Verification
Formula/all-smi.rbto a synthetic versionbrew styleon the resultn;c\constructs remainingruby -calone is not sufficient: the corrupted mlxcel formula was valid Ruby and passes a syntax check. That is whybrew styleis in the validation step.Unrelated observation, deliberately left alone
The download base is still
https://github.com/inureyes/all-smi, which works only through GitHub's rename redirect tolablup/all-smi. It also lands in the tap formula's url stanzas. Worth changing deliberately rather than as a side effect of this fix, since it alters what gets written to the tap.Related
10facb2, repairing the damage in the tap.