feat: add self-update system with graceful restart#547
Merged
wizzomafizzo merged 8 commits intomainfrom Mar 3, 2026
Merged
Conversation
- Add update.check and update.apply API methods using go-selfupdate with injectable functions for testability - Add CheckAndNotify startup routine that posts inbox notification when an update is available, with injectable CheckFn and context - Add auto_update config option (defaults to true) with IsDevelopmentVersion guard to skip dev builds - Add publish-update-manifest CI job that generates checksums and manifest YAML, uploads to Bunny CDN - Add media indexing guard to reject update.apply during active database writes - Add injectable exitFn to HandleUpdateApply to prevent os.Exit from killing test processes - Add comprehensive tests for updater, API handlers, and config
- Add ManagedByPackageManager() to Platform interface with detection for MiSTer Downloader and Batocera pacman - Rename AutoUpdate param from managedInstall to defaultEnabled for consistency with VirtualGamepadEnabled pattern - Add integration test for managed install disabling auto-update - Add inline comment documenting MiSTer Downloader database IDs
Replace os.Exit-based shutdown with graceful RestartService() state flag and restart.Exec() for binary re-execution after updates. Extract restart.ExecIfRequested() helper to deduplicate the restart-check pattern across 5 platform entry points. Add ResponseWithCallback to ensure API responses are flushed before triggering restart. Add tests for restart and state changes.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Add nolint:gosec to os.StartProcess in restart_windows.go matching the pattern in restart_unix.go. Extract manifest generator logic into testable functions with 10 tests. Add ResponseWithCallback POST handler test covering the AfterWrite unwrap path. Add cancelled context tests for updater Check/Apply covering makeUpdater and error branches.
Detect pre-release versions (alpha, beta, rc, nightly) by checking for a hyphen in the version tag. Mark them as pre-release in GitHub and skip publishing the update manifest to CDN.
Move publish-update-manifest from build.yml into a separate workflow triggered on release published events. This allows editing release notes before the manifest is pushed to CDN. Add --release-notes flag to the manifest generator to include release body in the manifest.
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.
Summary
go-selfupdatewith platform-specific asset filtering againsthttps://updates.zaparoo.org/(GitHub releases)update.checkandupdate.applyAPI methods with startup auto-check (configurable viaupdater.auto_updateconfig)pkg/service/restartpackage for graceful binary re-execution after updates (syscall.Execon Unix,os.StartProcesson Windows)ResponseWithCallbackpattern to flush API response before triggering restartRestartService()/RestartRequested()state management for clean shutdown-and-restart flowrestart.ExecIfRequested()helper to deduplicate restart logic across 5 platform entry points