Close iMirror during silent update handoff - #48
Merged
Conversation
This was referenced Jul 3, 2026
Balragon
added a commit
that referenced
this pull request
Jul 3, 2026
) * Refactor update workflow into UpdateController Move the update orchestration out of MainWindow into a new UpdateController: startup/manual update checks, the automatic-notice policy, download, installer handoff, and the graceful shutdown from #48. MainWindow keeps only the WPF concerns (update-notice controls, status text, download-progress text) behind a new IUpdateNoticeView seam, and ISettingsHost/SettingsWindow are unchanged apart from delegating to the controller. UpdateService (SHA-256 fail-closed download) and UpdateLauncher (/IMIRROR_LAUNCH=1 silent handoff) are reused as-is; no behavior change. The controller takes injected delegates so it is unit-testable without WPF; adds 18 UpdateController tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Harden update download lifecycle: cleanup and shutdown cancellation Two fixes to the update workflow, built on the UpdateController extraction (#49): 1. Downloaded installers were never deleted, so %LOCALAPPDATA%\iMirror\Updates grew by one setup.exe per update forever. UpdateService.TryCleanUpDownloadedInstallers now removes leftover .exe/.download files at startup (best-effort; files locked by a still-running installer are skipped until the next start). 2. Update checks and installer downloads used CancellationToken.None, so an in-flight download raced process teardown when the user closed the app. UpdateController now owns a shutdown CancellationTokenSource that MainWindow cancels at the start of ShutdownApplicationAsync; a canceled install returns quietly without flashing the retry UI. The SHA-256 fail-closed verification and the #48 installer handoff (launch installer, then graceful shutdown, relaunch via /IMIRROR_LAUNCH=1) are unchanged. Adds 7 tests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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
Validation