test(updater): cover download-failure recovery and retry - #367
Open
dormouse-bot wants to merge 1 commit into
Open
test(updater): cover download-failure recovery and retry#367dormouse-bot wants to merge 1 commit into
dormouse-bot wants to merge 1 commit into
Conversation
Deploying mouseterm with
|
| Latest commit: |
4df9248
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://aea7269a.mouseterm.pages.dev |
| Branch Preview URL: | https://test-updater-download-failur.mouseterm.pages.dev |
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.
Nightly survey found a coverage gap in the standalone auto-updater's download-failure recovery path.
downloadApprovedUpdate()has a catch branch that, on a failedupdate.download(), reverts the banner (downloading → available) and deliberately leavespendingUpdatenull so nothing bogus tries to install at quit — and becauseavailableUpdatesurvives the failure, a subsequent approval re-attempts the download. This recovery behavior was untested: the existingdoes not crash on download failuretest only asserted thatdownloadwas called once, so a regression that (say) setpendingUpdatein the catch, or nulledavailableUpdate, would have gone unnoticed.This adds two assertions/tests, no production change:
hasPendingUpdate()staysfalseafter a failed download — guards against a phantom pending install surviving to quit-time.approveUpdate()after the failure and assertsdownloadis re-invoked, covering the retry path (availableUpdatemust survive the failure).Both fail if the catch branch's invariants are broken. Test-only change;
pnpm exec vitest run src/updater.test.tspasses (18 tests).See the recovery branch in
standalone/src/updater.ts(downloadApprovedUpdate) and the spec atdocs/specs/auto-update.md.