Preserve legacy Homebrew formula migrations - #704
Conversation
TheGreatAxios
left a comment
There was a problem hiding this comment.
Review · Approve
The release path preserves Homebrew formula rename metadata across reruns.
No findings.
TheGreatAxios
left a comment
There was a problem hiding this comment.
Review · Approve
Generates Formula/corbits-code.rb from scripts/generate-homebrew-tap.ts, removes the legacy Formula/corbits.rb, and records corbits → corbits-code in the tap-root formula_renames.json so brew upgrade on a legacy install migrates; scripts/prepare-homebrew-tap-release.sh makes reruns push a committed-but-unpushed tap commit.
No findings.
Notes
- Rename mechanism matches Homebrew's reader (
Library/Homebrew/tap.rb:1241-1249,migrator.rb:114); the live tap has noformula_renames.jsontoday, so this is what makes the migration work. scripts/release.sh:262andscripts/prepare-homebrew-tap-release.sh:13now fail on an unborn tap HEAD where the oldrev-parse --verify HEADguard tolerated it. Not applicable to the live tap.- Repo URL / binary / description are now duplicated between
scripts/generate-homebrew-tap.ts:14-24andscripts/release.sh:45-51. Drift risk only. - Checks:
bun run typecheck,bun run lint,bun test tests/unit/generate-homebrew-tap.test.ts tests/unit/prepare-homebrew-tap-release.test.ts src/upgrade/index.test.ts(26 pass),shellcheckon both scripts (new script clean),ruby -con the generated formula, and an end-to-end rerun in a scratch tap (push-required→push-required→current).
release.sh already owned the repo, binary, formula, and description; the tap generator hard-coded copies of the same values. It now takes them from the environment release.sh sets, so they cannot drift.
TheGreatAxios
left a comment
There was a problem hiding this comment.
Review · Comment (approve intent — gh blocks self-approve)
Branch diff vs main only (scripts/generate-homebrew-tap.ts, scripts/prepare-homebrew-tap-release.sh, scripts/release.sh, upgrade detection test, unit tests). CI green; 26 targeted tests pass locally.
Blocking
None.
Should-fix
None for correctness of the stated migration/rerun goals.
File-for-later
tests/unit/prepare-homebrew-tap-release.test.tsonly pins the “already committed, ahead of upstream →push-required” path. The “dirty Formula/renames → commit thenpush-required” and “fully synced →current” paths are untested (script is short enough to eyeball; worth permanent coverage).scripts/prepare-homebrew-tap-release.sh:10hardcodes commit messagecorbits-code $VERSIONinstead of$BREW_FORMULA(matches today’s constant; drifts if the formula name changes).- Preflight
pull --ff-only+ prepare@{upstream}assume a born branch with upstream tracking. Fine for the live tap; a brand-new empty tap still fails earlier than the oldrev-parse --verify HEADguard.
Correctness notes (verified, not defects)
- Generator validates
formula_renames.jsonbefore any Formula mutation; merges unrelated keys; writescorbits → corbits-code; removesFormula/corbits.rb; installs binarycorbitsunder classCorbitsCode. - Release URLs remain
.../releases/download/v$VERSION/...(TAG=v$VERSIONinrelease.sh:84). - Rerun durability: committed-but-unpushed tap no longer skipped. Preflight
pull --ff-onlysucceeds when local is strictly ahead (confirmed), so prepare can still returnpush-requiredandgit_push. - Latest commit correctly moves repo/binary/formula/description into env from
release.sh(no hard-coded drift in the generator CLI path). - Upgrade test only pins existing
/cellar/corbits/detection insrc/upgrade/index.ts:103; no production upgrade-path change in this diff.
Merge readiness
Ready to merge for CL-7118 Homebrew rename migration + release rerun push. (Would Approve; GitHub rejects self-approve on this token.)
Checks run
bun test tests/unit/generate-homebrew-tap.test.ts tests/unit/prepare-homebrew-tap-release.test.ts src/upgrade/index.test.ts→ 26 pass- Manual:
git pull --ff-onlywith tap ahead of origin → exit 0, still ahead
Summary
Verification
bun run checkpasses.Contributes to CL-7118