Repository navigation
fix: installUpdate guard + surface install errors (#240) - #246
Merged
Merged
Conversation
Two related problems with the update flow surfaced by the Bazzite test (issue #244) and the 0.4.0 release audit: 1. The "Update to v0.4.0" chip called installUpdate() unconditionally. If a query was running, the relaunch() killed it. If editor tabs had unsaved changes, the relaunch() discarded them. No warning, no chance to cancel. 2. The error chip said "Update failed" with no underlying reason. When the .rpm install on Bazzite silently rejected (issue #244), the user couldn't tell whether it was a network error, a signature mismatch, or an atomic-distro transactional failure. Fix: src/stores/settingsStore.ts - Cache the Update object in a new pendingUpdate field set during checkForUpdates. installUpdate uses the cached value instead of re-running check() (which wasted a network round-trip and could return a different object on flaky networks). - Add an updateError string field. Set on check failure (network) AND on install failure (download/install/signature errors). Cleared on a new check. src/components/layout/StatusBar.tsx - The update-available chip now consults two guards before calling installUpdate: * resultStore.isExecuting (a query is running) * editorStore.tabs[i].isDirty (any tab has unsaved changes) If either guard fires, the click sets updateStatus: 'error' and populates updateError with a human-readable explanation. The error chip title now embeds the underlying error string, so users see "Update failed: rpm install failed: transaction check failed" or similar instead of just "Update failed". src/stores/__tests__/settingsStore.test.ts - Updated to reflect the cached-Update flow: installUpdate now consumes pendingUpdate (set via setState) instead of calling check(). Added a test that asserts updateError surfaces the underlying error message. src/components/layout/__tests__/StatusBar.test.tsx - Three new tests: * blocks install when a query is executing * blocks install when an editor tab has unsaved changes * surfaces the underlying install error in the chip title Out of scope: - The Bazzite-specific .rpm update path (issue #244) requires detecting rpm-ostree and routing through rpm-ostree update instead of rpm -U. Separate from this PR. - A confirm dialog instead of just blocking — considered, but blocking + showing why is sufficient friction.
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.
fix: installUpdate guard + surface install errors (#240)
Two related problems with the update flow surfaced by the Bazzite
test (issue #244) and the 0.4.0 release audit:
The "Update to v0.4.0" chip called installUpdate() unconditionally.
If a query was running, the relaunch() killed it. If editor tabs
had unsaved changes, the relaunch() discarded them. No warning,
no chance to cancel.
The error chip said "Update failed" with no underlying reason.
When the .rpm install on Bazzite silently rejected (issue bug: auto-updater broken on Bazzite (rpm-ostree) — uses rpm -U where rpm-ostree update is required #244),
the user couldn't tell whether it was a network error, a signature
mismatch, or an atomic-distro transactional failure.
Fix:
src/stores/settingsStore.ts
checkForUpdates. installUpdate uses the cached value instead of
re-running check() (which wasted a network round-trip and could
return a different object on flaky networks).
AND on install failure (download/install/signature errors). Cleared
on a new check.
src/components/layout/StatusBar.tsx
installUpdate:
If either guard fires, the click sets updateStatus: 'error' and
populates updateError with a human-readable explanation. The error
chip title now embeds the underlying error string, so users see
"Update failed: rpm install failed: transaction check failed" or
similar instead of just "Update failed".
src/stores/tests/settingsStore.test.ts
consumes pendingUpdate (set via setState) instead of calling
check(). Added a test that asserts updateError surfaces the
underlying error message.
src/components/layout/tests/StatusBar.test.tsx
Out of scope:
detecting rpm-ostree and routing through rpm-ostree update
instead of rpm -U. Separate from this PR.
blocking + showing why is sufficient friction.