fix(update): failed download returns to Download, not Install (#26)

A resumable-but-failed download leaves partial component files in update-staging.
has_staged_update() treated ANY staged file as "install-ready", so the state
self-heal kept update_in_progress=true and the UI showed Install instead of
Download (no clean retry).

- update.rs: write a .download-complete marker only after EVERY component
  downloads+verifies; has_staged_update() now checks that marker. Partial/failed
  downloads (no marker) correctly read as not-staged → self-heal clears
  update_in_progress → UI shows Download. Resume still works (partial files kept).
- SystemUpdate.vue: on a genuine download failure, reset downloaded/in_progress
  and re-sync, so the user lands back on Download immediately.

cargo check + vue-tsc clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
archipelago
2026-06-16 10:31:12 -04:00
co-authored by Claude Opus 4.8
parent 3a9d1db763
commit 82cfc8ccba
2 changed files with 27 additions and 6 deletions
+7
View File
@@ -871,6 +871,13 @@ async function downloadUpdate() {
await loadStatus()
showStatus(t('systemUpdate.upToDateMessage'))
} else {
// A failed download is NOT a staged update — return the UI to the
// Download button so the user can retry, instead of stranding them on
// Install. Re-sync from the backend (its self-heal clears a stale
// update_in_progress once the partial staging is cleaned up).
downloaded.value = false
updateInProgress.value = false
await loadStatus()
showStatus(`${t('systemUpdate.downloadFailed')} ${msg}`, true)
}
if (import.meta.env.DEV) console.warn('Download failed', e)