Repository navigation
fix(update): stop the check racing the install, and asking GitHub on every reset - #574
Merged
Merged
Conversation
…every reset Closes #346, #347. ## Every return to idle was a request The status bar re-runs the check whenever updateStatus is "idle". A store reset, a hot reload, or any future dismiss action puts it back there, and each one went to GitHub. Automatic checks are now throttled to one a minute and one at a time. The user's own button and the retry after an error pass force and are never skipped — a throttle that silently swallows an explicit request is worse than no throttle. Typescript caught the interesting part of that: the manual button was wired as onClick={checkForUpdates}, so making the first parameter `force` handed it the click event, which is truthy. The button would have forced by accident and the intent would not have been visible anywhere. It passes force explicitly now. ## A check could land in the middle of an install Nothing stopped checkForUpdates running during a download. It would set "available" over "downloading", taking the progress display away from a download that was still going, and replace pendingUpdate with a different Update object. A check now returns early while an install is in flight, and installUpdate pins the version when the download starts and reports that one when it finishes — so the UI cannot end up naming a version other than the one on disk. ## Tests Four, three of which fail against the previous version. The fourth asserts that a forced check is still never skipped, which held before and had to keep holding. An earlier draft of these exported a reset helper from the store for the throttle state. That made the fails-against-old check inconclusive — the tests failed on the missing export rather than on the behaviour — and the helper was unnecessary, since vi.resetModules() already gives each test fresh module state. Removed, and the check redone. Co-Authored-By: Claude Opus 5 <[email protected]>
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.
Closes #346, #347. Third of the update-system work, after #572 and #573.
Every return to idle was a request
The status bar re-runs the check whenever
updateStatusis"idle". A store reset, a hot reload, or any future dismiss action puts it back there — and each one went to GitHub.Automatic checks are now throttled to one a minute and one at a time. The user's own button and the retry-after-error pass
forceand are never skipped — a throttle that silently swallows an explicit request is worse than no throttle.TypeScript caught the interesting part. The manual button was wired as:
so making the first parameter
forcehanded it the click event, which is truthy. The button would have forced by accident, and nothing in the code would have said so. It passesforceexplicitly now.A check could land in the middle of an install
Nothing stopped
checkForUpdatesrunning during a download. It would set"available"over"downloading"— taking the progress display away from a download that was still running — and replacependingUpdatewith a differentUpdateobject.A check now returns early while an install is in flight, and
installUpdatepins the version when the download starts and reports that one when it finishes. The UI can't end up naming a version other than the one on disk.Tests
Four, three of which fail against the previous version. The fourth asserts a forced check is still never skipped — that held before and had to keep holding.
One process note. An earlier draft exported a reset helper from the store so tests could clear the throttle state. That made the fails-against-old check inconclusive — the tests failed on the missing export rather than on the behaviour — and the helper turned out to be unnecessary, since
vi.resetModules()already gives each test fresh module state. Removed, and the check redone properly.1831 unit + 303 browser green; tsc/dprint/eslint clean.
Left in this area
#571 (rpm-ostree URL hardcodes x86_64), #353 (no preview of what's being installed), #354 (
is_rpm_ostreemisses Flatpak, NixOS, Snap), #355 (formatter dialog preview — unrelated to updates, mislabelled into this area).🤖 Generated with Claude Code