fix(selfupdate): list all release pages so latest stable is found#520
Conversation
`self update` (and its e2e dry-run test) failed with "no release found" once more than ~30 pre-releases had shipped since the last stable release. go-selfupdate's default GitHub source lists only the first page (30 releases), so the latest stable fell onto page 2 and was never seen by DetectLatest/DetectVersion. Inject a custom Source that pages through all releases via go-github, embedding the stock GitHubSource so asset downloads are unchanged. Fixes both stable and beta channels regardless of how many pre-releases precede the target. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
✅ Deploy Preview for devsydev canceled.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughA new ChangesPaginated Release Source
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Deploy Preview for images-devsy-sh canceled.
|
✅ Deploy Preview for images-devsy-sh canceled.
|
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Problem
self updatefails withno release found, and theself-updatee2e spec (self update --dry-run) fails in CI — independent of this being a network/token issue.Root cause is release pagination, not rate limiting:
go-selfupdate's GitHub source lists only the first page (30 releases) viaListReleases(..., nil).devsy-org/devsycurrently has 31 pre-releases (v1.10.0-beta.*) ahead of the latest stablev1.9.8(index 31 → page 2).DetectLatest/DetectVersionfilter page 1, find no non-prerelease, and returnfound=false→no release found→ exit 1.It looked "flaky" but is actually deterministic and time-dependent: it breaks once ≥30 pre-releases accumulate after the last stable, and will recur whenever that happens.
Fix
Inject a custom
selfupdate.Source(allPagesSource) that pages through all releases usinggo-github, and pass it viaselfupdate.Config{Source: ...}. It embeds the stockGitHubSource, so asset download/decompress/replace is unchanged — only release listing is overridden. HonorsGITHUB_TOKENwhen present (same as the library).This fixes both channels:
Changes
pkg/selfupdate/source.go—allPagesSourcepaginating Source +newAllPagesSourcepkg/selfupdate/selfupdate.go— wire the source intodetectReleasepkg/selfupdate/source_test.go— httptest-backed test verifying pagination followsNextPageand a release on page 2 is returnedgo.mod— promotesgoogle/go-github/v74from indirect to direct (same version)Summary by CodeRabbit
Release Notes
Bug Fixes
Tests
Chores