Repository navigation
cmd: test update follow-up paths and clarify the dev rollback hint - #586
Conversation
…sh installs stable Co-Authored-By: Claude Opus 5.5 <[email protected]>
jrusso1020
left a comment
There was a problem hiding this comment.
Approving at 35b1e9958a.
The updateRollbackError seam is fine. It's an unexported package var. Production never reassigns it. The one test that swaps it restores it with t.Cleanup, and nothing in update_cdn_test.go or update_notice_test.go calls t.Parallel, so the swap can't leak into another test. Since go-selfupdate doesn't export the rollback error type, this is the smallest seam that works.
The untested true flag, read in code instead. newReleaseUpdater builds selfUpdater only when prerelease is true. cdnUpdater serves every other case, and its UpdateTo passes false. Both paths end in the same go-selfupdate/update.Apply (Updater.UpdateTo returns it directly), so RollbackError matches the GitHub path too. A dev build running update --version vX.Y.Z for a stable tag also goes through the GitHub updater, so it sees the dev wording. That's the right outcome: it's a dev build, and the hint tells it where both kinds of build live.
Each new test fails when the code it covers is broken (go test ./cmd/heygen/, Go 1.26, all green unmodified):
- Dropping
errors.Is(err, errNoPlatformEntry)fromDetectVersionfailsTestUpdate_VersionResolvesItsCDNFolder(the new "version lacks this platform" case). - Checking only the outer error instead of unwrapping fails
TestWithRollbackHint. - Never adding the dev hint, and always adding it, each fail
TestWithRollbackHint. - Counting
("", nil)as a failure failsTestUpdateCheckWorker_RecordsOutcome. So does keeping the previously cachedLateston("", nil), so the test also pins that a platform with no build clears the cached latest.
The dev hint wording is accurate: install.sh only ever installs the stable release, and dev prereleases are published only as GitHub releases.
Scope
Surfaces: CLI | Module: Self-update
Summary
Follow-up to #584 from review: tests for three
heygen updatepaths that had none, and clearer recovery wording for dev builds when a failed update cannot restore the old binary. Live on the next release.How it works
install.shinstalls the latest stable release, and where dev builds are published. Stable builds see the same message as before.--versionfor a release that has no build for this platform reports "not found".Testing
make lintand thecmd/heygentests pass.🤖 Generated with Claude Code