Skip to content

Put the state back when a transfer cannot be started (#166) - #167

Merged
eliasbakken merged 1 commit into
mainfrom
fix-166-transfer-start-failure
Sep 18, 2026
Merged

eliasbakken merged 1 commit into
mainfrom
fix-166-transfer-start-failure

Conversation

@eliasbakken

Copy link
Copy Markdown
Contributor

Fixes #166.

Pressing Download showed a progress bar counting up, then frozen at 0m:22s 10.3 MB/s 0m:9s with a Cancel button - while nothing was downloading. No .part on the drive, no Starting download in reflash.log, and /api/get_progress reporting IDLE with the figures of the previous, cancelled download. The request never reached the board; the UI invented a transfer out of stale polled values.

Cause

downloadSelected, uploadSelected, startMagic and startMagicUpload set this.state before asking the board, then handle the answer in a .then with no catch. A rejected request skips checkProgress() - so polling never starts - and leaves the state on DOWNLOADING, with the bar rendering whatever the store still held. Same shape as #131.

installSelected and backupSelected do not set the state, so they failed silently instead. That drops the 409 from start_installation / start_magic carrying "The eMMC stopped responding. Power cycle the board and try again." (#137) - the most useful sentence the board can say.

Fix

All six share transferFailed(), which restores IDLE, drops this tab's claim on an upload that never started (so the unload beacon cannot cancel someone else's transfer), and reports the board's own words when it answered or the transport error when it did not.

Tests

11 new tests in TransferStart.spec.js, written failing first: each of the four state-setting handlers returns to IDLE and notifies on a rejected request and leaves the state alone on success, a failed upload start does not leave the tab owning the upload, the 409 message reaches the user, and a failed backup is reported.

make test: Go, bats, and 144 vitest tests pass.

🤖 Generated with Claude Code

Pressing Download showed a progress bar that counted up and then froze at
"0m:22s 10.3 MB/s 0m:9s" with a Cancel button, while nothing was downloading:
no .part on the drive, no "Starting download" in reflash.log, and get_progress
reporting IDLE with the figures of the previous, cancelled download. The request
had never reached the board, and the UI had invented a transfer out of stale
polled values. Only Cancel or a reload cleared it.

downloadSelected, uploadSelected, startMagic and startMagicUpload all set
this.state before asking the board, so the button can turn into Cancel, and all
four handled the answer in a .then with no catch. A rejected request therefore
skipped checkProgress - so no polling ever started - and left the state on
DOWNLOADING, with the bar rendering whatever the store still held. Same shape as
#131, where one failed request ended the polling for good.

installSelected and backupSelected do not set the state, so they failed silently
instead. That is worse in one specific way: start_installation and start_magic
answer 409 with "The eMMC stopped responding. Power cycle the board and try
again." (#137), and that sentence was being dropped on the floor. It is the most
useful thing the board can say, and the user saw nothing at all.

All six now share transferFailed(), which restores IDLE, drops this tab's claim
on an upload that never started, and reports the board's own words when it
answered or the transport error when it did not.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@eliasbakken
eliasbakken merged commit bd2f393 into main Sep 18, 2026
6 checks passed
@eliasbakken
eliasbakken deleted the fix-166-transfer-start-failure branch September 18, 2026 14:41
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.

A failed start_download leaves the UI stuck on a progress bar for a transfer that never started

1 participant