Skip to content

Desktop: download updates in the background and install on quit (parked for upstream #17588) - #40

Draft
scuttletoby wants to merge 1 commit into
mainfrom
fork/desktop-install-on-quit
Draft

scuttletoby wants to merge 1 commit into
mainfrom
fork/desktop-install-on-quit

Conversation

@scuttletoby

Copy link
Copy Markdown
Owner

Why this is a separate, parked PR

This is the desktop half of #5, moved out so #5 is only the server updater. It is parked, not for merge yet. Upstream pingdotgg#17588 ("download updates in the background and install them on quit") does the same thing. When it lands, the fork gets it from the nightly follow and this PR is closed. Keeping it here, not deleted, keeps the reviewed work in case pingdotgg#17588 stalls or is rejected.

Rejected alternatives:

Differences from pingdotgg#17588 (read only, as of 11-06): pingdotgg#17588 has no setting. It is always on, but only Windows and AppImage install at quit; macOS and .deb still need Install. This PR is opt-in ("autoUpdate": true in desktop-settings.json, off by default) and arms install-on-quit on every platform electron-updater supports.

What

  • Setting on, update available: after the startup check and each poll check, the update is downloaded. When the download is complete and still offerable, it calls setAutoInstallOnAppQuit(true).
  • At quit: a finalizer on the updater's scope runs as the app shuts down, before electron-updater's own quit handler installs.
    • It reads the setting again. If it is now off, or the download is gone, install-on-quit is switched off and nothing installs.
    • Otherwise it writes the same install record the Update button writes. A crash or power cut before a real quit leaves no record, so it is not reported as an install that did not apply.
  • An install at quit that did not apply: the app restarts on the old version, and the existing "last update did not apply" check reports it. That version is then not armed again automatically, which prevents a silent loop. The Update button still offers it.
  • Turning it off: if the setting is off at a poll, or the update track changes, install-on-quit is switched off.

Failure cases

Case What happens Test (DesktopAutoInstall.test.ts)
Crash or kill before a real quit No install record, so there is no false "did not apply" "a stop without a quit leaves no record"
Setting turned off just before quit Install-on-quit is switched off at the quit step, so nothing installs "turning the setting off just before quitting installs nothing"
Install at quit did not apply Reported at startup; that version is not armed again round-1 cases
Track changed after the download Install-on-quit is switched off round-1 cases

Hand breaks from the #5 rounds, each turning the tests red: no quit step (2), record written at arm time (5), setting not re-read at quit (1).

Tests

Rebased on fork main with one conflict in DesktopUpdates.ts (the channel change now restores the release floor on error; the disarm stays before it). Desktop typecheck is clean. src/updates + src/app: 235/235 pass, with GH_TOKEN/GITHUB_TOKEN unset and an empty GH_CONFIG_DIR.

Not proven: no real electron-updater download and install-on-quit (that needs a published fork release). A reboot that kills the app during the quit step, after the record but before the install, would still report "did not apply".

General vs project

All general: one desktop setting in the public fork, nothing project-specific.

🤖 Generated with Claude Code

Opt-in "autoUpdate": true in desktop-settings.json: after each background
check an available update is downloaded and installed when the app quits.
The install record is written at the real quit, and the setting is read
again there.

Moved out of the server auto-update PR (#5) and parked: upstream pingdotgg#17588
does the same thing and replaces this when it lands. Reviewed in #5
rounds 1-3; rebased on fork main with no behaviour change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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