Skip to content

test(updater): cover download-failure recovery and retry - #367

Open
dormouse-bot wants to merge 1 commit into
mainfrom
test/updater-download-failure-recovery
Open

test(updater): cover download-failure recovery and retry#367
dormouse-bot wants to merge 1 commit into
mainfrom
test/updater-download-failure-recovery

Conversation

@dormouse-bot

Copy link
Copy Markdown
Collaborator

Nightly survey found a coverage gap in the standalone auto-updater's download-failure recovery path.

downloadApprovedUpdate() has a catch branch that, on a failed update.download(), reverts the banner (downloading → available) and deliberately leaves pendingUpdate null so nothing bogus tries to install at quit — and because availableUpdate survives the failure, a subsequent approval re-attempts the download. This recovery behavior was untested: the existing does not crash on download failure test only asserted that download was called once, so a regression that (say) set pendingUpdate in the catch, or nulled availableUpdate, would have gone unnoticed.

This adds two assertions/tests, no production change:

  • The existing failure test now also asserts hasPendingUpdate() stays false after a failed download — guards against a phantom pending install surviving to quit-time.
  • A new test drives a second approveUpdate() after the failure and asserts download is re-invoked, covering the retry path (availableUpdate must survive the failure).

Both fail if the catch branch's invariants are broken. Test-only change; pnpm exec vitest run src/updater.test.ts passes (18 tests).

See the recovery branch in standalone/src/updater.ts (downloadApprovedUpdate) and the spec at docs/specs/auto-update.md.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 4df9248
Status: ✅  Deploy successful!
Preview URL: https://aea7269a.mouseterm.pages.dev
Branch Preview URL: https://test-updater-download-failur.mouseterm.pages.dev

View logs

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.

1 participant