Harden settings load and save safety#47
Closed
danielchalmers wants to merge 1 commit into
Closed
Conversation
This keeps the settings PR focused on direct data-loss prevention. Startup no longer saves the loaded settings object just to determine whether settings can be saved; it now loads settings and probes directory writability with a throwaway file. When an existing primary settings file is malformed, empty, or unreadable, the load path copies it to a timestamped .corrupt-* snapshot before recovered default settings are allowed to save over the primary path. If the unreadable primary cannot be copied aside, saving is disabled for the run so fallback defaults do not overwrite the only recoverable copy. Settings writes now go through a temporary file in the same directory and then replace or move into the primary path. That reduces the chance that a shutdown, installer interruption, or write failure leaves a truncated settings file behind. The tests cover malformed and empty primary files, locked unreadable files, startup probing without rewriting the real file, atomic save cleanup, and property-level deserialization errors preserving unrelated valid settings. The intentionally deferred pieces are installer behavior, graceful close/exit save, settings relocation, and last-known-good automatic restore.
1f0907d to
1dc6ca2
Compare
Owner
Author
|
This is too much |
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
Part of #46.
This PR keeps the settings resiliency work narrowly focused on direct data-loss prevention:
CanBeSaved.corrupt-*snapshots before fallback defaults can be savedOut Of Scope
This intentionally removes the broader pieces from the first draft:
.lastgoodbackup/automatic restore flowThe MSI wildcard cleanup is split into a separate PR so it can be reviewed and reverted independently.
Validation
dotnet build RadialActions.slndotnet test RadialActions.sln(68 passed)