Make backup retention configurable#21
Merged
Merged
Conversation
BackupService captured a fixed retention count at construction. It now reads retention lazily via a Func<int> provider, wired in Bootstrap to AppConfig.BackupRetention, so a change made in Settings takes effect on the next write-triggered backup with no restart. Provider values are clamped to at least 1 at prune time so a bad config never wipes backups. Adds a "Backups to keep" NumberBox (1-200) to the Settings page and the BackupRetention property/persistence on SettingsViewModel. Co-Authored-By: Claude Opus 4.8 <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.
What
Surfaces backup retention as a user setting. Previously the "keep the last 20 backups" count was hard-coded at
BackupServiceconstruction.How
BackupServicenow reads retention lazily via aFunc<int>provider instead of capturing a fixedint. Wired inBootstrapto() => config.BackupRetention, so a change in Settings takes effect on the next write-triggered backup with no restart and no rebuilding of the DI singleton.intconstructor is retained (delegates to the provider) so its eager>= 1validation contract is unchanged.AppConfiggainsBackupRetention(default20, via newDefaultBackupRetentionconst, which is now the single source of truthBackupService.DefaultRetentionpoints at). Purely additive — no schema bump; old configs deserialise to the default.SettingsViewModelgains aBackupRetentionproperty (clamped, persisted) and the Settings page gains a "Backups to keep"NumberBox(1–200).Tests
BackupServiceTests: lazy provider is re-read on each prune; non-positive provider value clamps to 1; provider constructor rejects null.Review
codex exec review --base master: no correctness issues found.Verification still owed (Windows)
Core is fully tested on Linux; the WinUI head (
NumberBoxbinding, persistence across restart) wants a manual check on Windows: change "Backups to keep" to a small number, trigger several store writes, confirm pruning to that count and that the value survives a restart.🤖 Generated with Claude Code