Skip to content

Commit 4bc591a

Browse files
JusterZhuclaude
andauthored
feat: disable backup feature by default (#511)
* feat: disable backup feature by default Backup is now opt-in rather than opt-out. Users who need backup before applying updates must explicitly set BackupEnabled = true or set the BACKUP environment variable to true. This reduces unnecessary I/O and storage consumption for users who don't require rollback capability. Rollback via backup remains fully functional when enabled. Option.BackupEnabled default: true -> false BackupConfig.Enabled default: true -> false Co-Authored-By: Claude <noreply@anthropic.com> * fix: update backup tests to match new default (false) Test assertions that expected BackupEnabled default to be true now expect false. Also renamed Options_BackupEnabled_DefaultIsTrue to Options_BackupEnabled_DefaultIsFalse for clarity. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3851056 commit 4bc591a

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/c#/GeneralUpdate.Core/Configuration/Option.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public override bool Equals(object? obj)
124124

125125
public static Option<bool?> PatchEnabled { get; } = ValueOf<bool?>("PATCH", true);
126126

127-
public static Option<bool?> BackupEnabled { get; } = ValueOf<bool?>("BACKUP", true);
127+
public static Option<bool?> BackupEnabled { get; } = ValueOf<bool?>("BACKUP", false);
128128

129129
public static Option<bool> Silent { get; } = ValueOf<bool>("ENABLESILENTUPDATE", false);
130130

src/c#/GeneralUpdate.Core/Configuration/UpdateContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public class UpdateContext : UpdateConfiguration
120120

121121
/// <summary>
122122
/// Whether to back up the current version before applying an update.
123-
/// Computed from <see cref="Option.BackupEnabled" />, defaults to <c>true</c>.
123+
/// Computed from <see cref="Option.BackupEnabled" />, defaults to <c>false</c>.
124124
/// </summary>
125125
public bool? BackupEnabled { get; set; }
126126

src/c#/GeneralUpdate.Core/FileSystem/StorageManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,9 +727,9 @@ public sealed class BackupConfig
727727
public List<string> Directories { get; set; } = new();
728728

729729
/// <summary>
730-
/// Whether the backup feature is enabled. Default is <c>true</c>.
730+
/// Whether the backup feature is enabled. Default is <c>false</c>.
731731
/// </summary>
732-
public bool Enabled { get; set; } = true;
732+
public bool Enabled { get; set; } = false;
733733
}
734734

735735
/// <summary>

tests/CoreTest/Configuration/UpdateContextWiringTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ public void Options_VerifyChecksum_DefaultIsTrue()
205205
=> Assert.True(Option.VerifyChecksum.DefaultValue);
206206

207207
[Fact]
208-
public void Options_BackupEnabled_DefaultIsTrue()
209-
=> Assert.True(Option.BackupEnabled.DefaultValue);
208+
public void Options_BackupEnabled_DefaultIsFalse()
209+
=> Assert.False(Option.BackupEnabled.DefaultValue);
210210

211211
[Fact]
212212
public void Options_PatchEnabled_DefaultIsTrue()

tests/CoreTest/Configuration/UpdateOptionsStaticTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void PatchEnabled_HasCorrectDefault()
4949
[Fact]
5050
public void BackupEnabled_HasCorrectDefault()
5151
{
52-
Assert.True(Option.BackupEnabled.DefaultValue);
52+
Assert.False(Option.BackupEnabled.DefaultValue);
5353
}
5454

5555
[Fact]

0 commit comments

Comments
 (0)