Skip to content

Preserve legacy Homebrew formula migrations - #704

Merged
TheGreatAxios merged 4 commits into
mainfrom
cl-7118-migrate-legacy-homebrew-corbits-installs-to-corbits-code
Aug 28, 2026
Merged

Preserve legacy Homebrew formula migrations#704
TheGreatAxios merged 4 commits into
mainfrom
cl-7118-migrate-legacy-homebrew-corbits-installs-to-corbits-code

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • Generates deterministic Homebrew formula rename metadata without dropping unrelated mappings.
  • Makes release reruns push pending tap commits and validates tap metadata before mutating formula files.

Verification

  • bun run check passes.
  • 27 targeted formula-generation, release-rerun, and legacy-install detection tests pass.

Contributes to CL-7118

@linear-code

linear-code Bot commented Aug 28, 2026

Copy link
Copy Markdown

CL-7118

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Review · Approve

The release path preserves Homebrew formula rename metadata across reruns.

No findings.

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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 no formula_renames.json today, so this is what makes the migration work.
  • scripts/release.sh:262 and scripts/prepare-homebrew-tap-release.sh:13 now fail on an unborn tap HEAD where the old rev-parse --verify HEAD guard tolerated it. Not applicable to the live tap.
  • Repo URL / binary / description are now duplicated between scripts/generate-homebrew-tap.ts:14-24 and scripts/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), shellcheck on both scripts (new script clean), ruby -c on the generated formula, and an end-to-end rerun in a scratch tap (push-requiredpush-requiredcurrent).

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 TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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

  1. tests/unit/prepare-homebrew-tap-release.test.ts only pins the “already committed, ahead of upstream → push-required” path. The “dirty Formula/renames → commit then push-required” and “fully synced → current” paths are untested (script is short enough to eyeball; worth permanent coverage).
  2. scripts/prepare-homebrew-tap-release.sh:10 hardcodes commit message corbits-code $VERSION instead of $BREW_FORMULA (matches today’s constant; drifts if the formula name changes).
  3. 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 old rev-parse --verify HEAD guard.

Correctness notes (verified, not defects)

  • Generator validates formula_renames.json before any Formula mutation; merges unrelated keys; writes corbits → corbits-code; removes Formula/corbits.rb; installs binary corbits under class CorbitsCode.
  • Release URLs remain .../releases/download/v$VERSION/... (TAG=v$VERSION in release.sh:84).
  • Rerun durability: committed-but-unpushed tap no longer skipped. Preflight pull --ff-only succeeds when local is strictly ahead (confirmed), so prepare can still return push-required and git_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 in src/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-only with tap ahead of origin → exit 0, still ahead

@TheGreatAxios
TheGreatAxios merged commit 56e7c6e into main Aug 28, 2026
5 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-7118-migrate-legacy-homebrew-corbits-installs-to-corbits-code branch August 28, 2026 22:01
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.

1 participant