Skip to content

fix(updates): no install without a staged update, and a tested update flow - #136

Merged
thethinkmachine merged 1 commit into
mainfrom
fix/update-flow
Oct 3, 2026
Merged

thethinkmachine merged 1 commit into
mainfrom
fix/update-flow

Conversation

@thethinkmachine

Copy link
Copy Markdown
Owner

The bug

The update dialog showed Restart & Install under Up to Date, and clicking it failed with UPD-99.

.btn-p, .btn-g { display: inline-flex } outranks the user agent's [hidden] { display: none }, so updateInstall.hidden = true never hid the button. Clicking it called quitAndInstall() with nothing downloaded, and that error fell through to UPD-99.

  • css/modals.css: .btn-p[hidden], .btn-g[hidden] { display: none } on the base rule; the one local copy in panels.css is gone.
  • tests/hidden-markup.test.js: fails on any element index.html ships hidden whose class sets a display without a [hidden] override. Before the fix it flagged exactly #update-install.

The update flow

The main-process updater moves from electron/main.cjs to electron/updates.cjs. main.cjs keeps only loading electron-updater and the IPC channels, so tests/updates.test.js can drive the controller with a fake updater.

  • Install is refused unless an update is staged. A refused or failed install is the new UPD-07 (documented). It also stops offering the restart, so the button can't retry into the same failure. UPD-99 now says "while updating", not "while checking".
  • "Later" says what it does. autoInstallOnAppQuit is set deliberately rather than left at its default, and "Update Ready" says a staged update installs the next time the app is closed.
  • Long sessions recheck every 6 hours. Silent, like the launch check, and skipped once an update is staged.
  • Release notes. The GitHub release body is converted to plain text in the main process, capped at 4000 characters, and shown under "What's new" with textContent.
  • Background download failures are visible. The menu item reads "Update Failed — Retry". A failed background check still says nothing, since being offline is ordinary.
  • The rejection of downloadPromise is now handled; its error is reported once, through the 'error' event.
  • The dialog's words per status live in js/update-view.js, an import-free module covered by the same tests.

Testing

  • npm test: 2813 pass, 22 of them new.
  • Mutation-checked: removing the CSS fix or the staged-update guard fails the tests meant to catch it.
  • npm run build succeeds.
  • Not yet exercised in a packaged build. Worth checking in the next release: how real release notes render, and the "Update Failed — Retry" state when a download fails.

… flow

"Restart & Install" showed under "Up to Date" because .btn-p/.btn-g set a
display of their own, which beats the user agent's [hidden] rule. Clicking it
asked electron-updater to install nothing, which surfaced as UPD-99. The base
rule now honours [hidden], and a test fails on any statically hidden element
whose class overrides it.

The main-process updater moves to electron/updates.cjs so it can be driven by
a fake updater in tests/updates.test.js. Along the way:

- install is refused unless an update is staged; a failed install is UPD-07
  and stops offering the restart
- autoInstallOnAppQuit is set on purpose, and "Update Ready" says a staged
  update installs at the next quit
- a long session rechecks every six hours
- release notes reach the dialog as plain text under "What's new"
- a background download that fails marks the menu item "Update Failed — Retry"
- the download promise's rejection is handled; its error is reported once
Copilot AI balanced review requested due to automatic review settings October 3, 2026 12:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@thethinkmachine
thethinkmachine merged commit dc2f5df into main Oct 3, 2026
17 checks passed
@thethinkmachine
thethinkmachine deleted the fix/update-flow branch October 3, 2026 12:07
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.

2 participants