Skip to content

fix(update): stop the check racing the install, and asking GitHub on every reset - #574

Merged
EVWorth merged 1 commit into
mainfrom
fix/update-check-lifecycle
Sep 8, 2026
Merged

EVWorth merged 1 commit into
mainfrom
fix/update-check-lifecycle

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 8, 2026

Copy link
Copy Markdown
Owner

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 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-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. 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 nothing in the code would have said so. 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 running — 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. 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_ostree misses Flatpak, NixOS, Snap), #355 (formatter dialog preview — unrelated to updates, mislabelled into this area).

🤖 Generated with Claude Code

…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]>
@EVWorth
EVWorth merged commit 894a3f1 into main Sep 8, 2026
10 checks passed
@EVWorth
EVWorth deleted the fix/update-check-lifecycle branch September 8, 2026 03:50
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.

[P1/bug] Effect re-triggers checkForUpdates on every updateStatus flip to idle

1 participant