tui: u rechecks GitHub instead of trusting the hourly poll - #308
Merged
Merged
Conversation
u only read UpdateVersion, which the background check refreshes hourly, so a release published since the last poll got 'already up to date' while brew upgrade would install it. With nothing cached, u now asks GitHub on the spot and goes straight into the upgrade if it finds one. Also treat a non-200 from the releases API as an error: a rate-limit body decoded to an empty tag and read as 'up to date'. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
Pressing
uonly readUpdateVersion, which the background check refreshes at startup and then hourly. A release published since the last poll madeuflash "already up to date" whilebrew update && brew upgradewould happily install it.Fix
unow checks GitHub on the spot ("checking for updates…") via a newrecheckUpdateCmd/UpdateCheckedMsg, and goes straight into the brew upgrade if it finds one. Otherwise it flashes "already up to date", or the error if the check failed.updatecheck.Latesttreats a non-200 response as an error. Before this, a rate-limit body decoded to an empty tag and read as "up to date".Testing
TestUpdateKeyRechecksWhenNothingCachedcovers the up-to-date, error, and newer-found paths (fails on the old code).go test ./internal/tui ./internal/updatecheckpasses.internal/terminalfails locally only when run inside Ghostty (env leak, unrelated) and passes with theGHOSTTY_*vars unset.🤖 Generated with Claude Code