Skip to content

Refresh brew tap before upgrading in kernel upgrade#208

Merged
masnwilliams merged 2 commits into
mainfrom
hypeship/brew-upgrade-refresh-tap
Jul 20, 2026
Merged

Refresh brew tap before upgrading in kernel upgrade#208
masnwilliams merged 2 commits into
mainfrom
hypeship/brew-upgrade-refresh-tap

Conversation

@masnwilliams

@masnwilliams masnwilliams commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

kernel upgrade detects a newer version from GitHub releases, then shells out to brew upgrade kernel/tap/kernel. But brew upgrade doesn't refresh the tap on its own, and Homebrew throttles its auto-update — so right after a release the local tap is stale, brew still sees the old formula, and the upgrade silently no-ops with "already installed" (exit 0). The user sees kernel upgrade announce a new version and then nothing changes.

Repro: release a new version, then on a machine whose tap hasn't refreshed run kernel upgrade → "New version available: X → Y" followed by "Warning: kernel/tap/kernel X already installed", no upgrade.

Fix

  • kernel upgrade now runs brew update before brew upgrade kernel/tap/kernel (brew method only; npm/pnpm/bun already pull @latest).
  • executeUpgrade/upgradeCommandArgs refactored to run an ordered list of commands so the brew path can do two steps; stderr from all steps is still captured for the existing old-tap error diagnosis.
  • The passive suggested-upgrade hint now shows brew update && brew upgrade kernel/tap/kernel for the same reason.

Testing

go build ./..., go vet, gofmt, and go test ./pkg/update/... all pass (suggestion-string test updated).


Note

Low Risk
CLI-only change to upgrade command sequencing and user-facing hints; no auth, data, or core runtime behavior beyond fixing stale-tap brew upgrades.

Overview
Fixes Homebrew upgrades silently doing nothing right after a release when the local tap is stale: kernel upgrade now runs brew update before brew upgrade kernel/tap/kernel for the brew install path only.

Upgrade execution is refactored so each install method returns an ordered list of shell commands ([][]string). executeUpgrade runs them sequentially and still aggregates stderr across steps for the existing old-tap error handling. Dry-run / displayed commands use brew update && brew upgrade kernel/tap/kernel.

Passive upgrade hints in SuggestUpgradeCommand (brew and unknown-method fallback) use the same two-step brew string. Tests cover brew command ordering and the updated suggestion text.

Reviewed by Cursor Bugbot for commit 1332054. Bugbot is set up for automated code reviews on this repo. Configure here.

brew upgrade doesn't refresh the tap, so right after a release the new
formula is invisible and the upgrade silently no-ops ("already installed")
while kernel upgrade reports a new version is available. Run brew update
first, and update the suggested-upgrade hint to match.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@masnwilliams
masnwilliams marked this pull request as ready for review July 20, 2026 19:16
@masnwilliams
masnwilliams requested a review from jarugupj July 20, 2026 19:16

@jarugupj jarugupj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

non blocking: for cmd/upgrade.go:103 - could we add a small unit test confirming brew update runs before brew upgrade?

Assert brew update runs before brew upgrade, and cover the command args and
display string per install method.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@masnwilliams

Copy link
Copy Markdown
Contributor Author

Added cmd/upgrade_test.goTestUpgradeCommandArgsBrewUpdatesBeforeUpgrade asserts the brew update step precedes brew upgrade for the brew method, plus table coverage of the per-method command args and the display string. go test ./cmd/... green.

@masnwilliams
masnwilliams merged commit 8a82c78 into main Jul 20, 2026
7 checks passed
@masnwilliams
masnwilliams deleted the hypeship/brew-upgrade-refresh-tap branch July 20, 2026 21:10
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.

2 participants