Repository navigation
fix(app): keep the exit save overlay stable while disks save in parallel - #252
Merged
Merged
Conversation
When several disks were saved in parallel on exit, every progress report overwrote the overlay with its own disk's name and byte counts, so the text and bar flickered between disks. The overlay now shows an aggregate. ExitSaveProgressTracker folds the per-disk reports into one thread-safe, size-weighted, monotonic state: a fixed byte total known up front, "Saving N disk images (k/N done)" for several disks, the disk's own name for one, and distinct texts for finishing and for failed saves. The save threads only update the tracker; the screen is refreshed through a coalescing signal at background priority so it cannot flood the dispatcher. MountManager.Dispose now reports just (disk, fraction), without the overall fraction, the byte count or the aggregator, and RamDisk.WillSaveOnDispose tells the app which disks will really be written.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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
When several RAM disks are saved in parallel on exit, each progress report overwrote the overlay with its own disk's name and byte counts, so the status text and progress bar flickered between disks. Reports could also be delivered out of order, nudging the bar backwards.
The overlay now shows an aggregate instead of whichever disk reported last.
Changes
ExitSaveProgressTracker(new, thread-safe): folds the per-disk reports into one monotonic, size-weighted state with a fixed byte total known before the first report. The bar and the byte count share a 99% ceiling until the save is completed, so an untracked disk that is still saving cannot be hidden behind a full bar.CoalescingSignalatBackgroundpriority, so a burst of reports cannot flood the dispatcher or delay input.SaveFailedmarks a disk as failed only once its own final save has begun, so an earlier periodic auto-save failure does not mark a disk whose final save then succeeds. A failed disk is never shown as finished.MountManager.Dispose(Action<RamDisk, double>): the callback now reports only the disk and its own fraction. The overall fraction, the used-byte count andDisposeProgressAggregator(with its tests) are removed, since the app aggregates by size itself.RamDisk.WillSaveOnDispose(backed byRamDiskSaveDecisions): tells the app which disks will really be written, so clean disks are not counted as "disk images".CLAUDE.mddocuments the exit-save progress pipeline and its ordering rules.Notes
MountManager.Dispose(Action<RamDisk, double, double, ulong>)is replaced by a two-argument overload. The app is the only caller.App.ShutdownAsync(CollectExitSaveSizes, theSaveFailedhookup,BeginExitSavebeforeDispose) is not unit-tested because it needs a realRamDisk(WinFsp driver) or the WPFApp.SettingsStoreTests.Update_ConcurrentUpdatesOfDifferentFields_KeepsEveryChangefailed intermittently on some runs. It is unrelated to this change and passes on rerun.Test plan
dotnet build ManagedDrive.slnx(no warnings)dotnet test tests/ManagedDrive.Tests(1859 tests; new tests for the tracker,CoalescingSignal, the view model texts and the localization keys)