Put the state back when a transfer cannot be started (#166) - #167
Merged
Merged
Conversation
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>
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.
Fixes #166.
Pressing Download showed a progress bar counting up, then frozen at
0m:22s 10.3 MB/s 0m:9swith a Cancel button - while nothing was downloading. No.parton the drive, noStarting downloadinreflash.log, and/api/get_progressreportingIDLEwith 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,startMagicandstartMagicUploadsetthis.statebefore asking the board, then handle the answer in a.thenwith nocatch. A rejected request skipscheckProgress()- so polling never starts - and leaves the state onDOWNLOADING, with the bar rendering whatever the store still held. Same shape as #131.installSelectedandbackupSelecteddo not set the state, so they failed silently instead. That drops the 409 fromstart_installation/start_magiccarrying "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 restoresIDLE, 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 toIDLEand 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