Skip to content

fix: installUpdate guard + surface install errors (#240) - #246

Merged
EVWorth merged 1 commit into
mainfrom
fix/240-install-update-guard
Jul 21, 2026
Merged

EVWorth merged 1 commit into
mainfrom
fix/240-install-update-guard

Conversation

@EVWorth

@EVWorth EVWorth commented Jul 21, 2026

Copy link
Copy Markdown
Owner

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:

  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 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

  • 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:

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.
@EVWorth
EVWorth merged commit 5ff5221 into main Jul 21, 2026
10 checks passed
@EVWorth
EVWorth deleted the fix/240-install-update-guard branch July 21, 2026 02:15
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.

1 participant