Skip to content

Commit 3511f4a

Browse files
committed
Remove v2 checkpoint write gate
Entire-Checkpoint: 58d96f1248ed
1 parent 49f9355 commit 3511f4a

5 files changed

Lines changed: 28 additions & 627 deletions

File tree

cmd/entire/cli/settings/settings.go

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -969,27 +969,6 @@ func CheckpointsVersion(ctx context.Context) int {
969969
return version
970970
}
971971

972-
// CheckpointsWriteVersion returns the checkpoint version used for new writes.
973-
// Checkpoints v2 settings are no longer supported for writes, so legacy v2
974-
// configuration falls back to v1.
975-
func CheckpointsWriteVersion(ctx context.Context) int {
976-
s, err := Load(ctx)
977-
if err != nil {
978-
return 1
979-
}
980-
return s.CheckpointsWriteVersion()
981-
}
982-
983-
// IsCheckpointsV2WriteEnabled returns whether new writes should create v2
984-
// checkpoint refs. Legacy settings are disallowed for writes, so this is false.
985-
func IsCheckpointsV2WriteEnabled(ctx context.Context) bool {
986-
s, err := Load(ctx)
987-
if err != nil {
988-
return false
989-
}
990-
return s.IsCheckpointsV2WriteEnabled()
991-
}
992-
993972
// WarnIfCheckpointsV2Disallowed emits the user-facing fallback warning when a
994973
// settings file still requests checkpoints v2. Call this from push-time flows
995974
// so users learn why v1 metadata is being pushed instead.
@@ -1083,8 +1062,7 @@ func (s *EntireSettings) GetCheckpointRemote() *CheckpointRemoteConfig {
10831062
}
10841063

10851064
// IsCheckpointsV2Enabled checks if checkpoints v2 is enabled for read paths.
1086-
// Writes use IsCheckpointsV2WriteEnabled instead so existing v2 checkpoint
1087-
// metadata remains readable while new writes fall back to v1.
1065+
// Existing v2 checkpoint metadata remains readable while new writes use v1.
10881066
func (s *EntireSettings) IsCheckpointsV2Enabled() bool {
10891067
if s.StrategyOptions == nil {
10901068
return false
@@ -1119,18 +1097,6 @@ func (s *EntireSettings) CheckpointsVersion() int {
11191097
return 1
11201098
}
11211099

1122-
// IsCheckpointsV2WriteEnabled always returns false. Legacy checkpoints v2
1123-
// settings are read-compatible but no longer enable new v2 writes.
1124-
func (s *EntireSettings) IsCheckpointsV2WriteEnabled() bool {
1125-
return false
1126-
}
1127-
1128-
// CheckpointsWriteVersion returns the checkpoint version used for writes.
1129-
// Writes always use v1 now, even when legacy settings request v2.
1130-
func (s *EntireSettings) CheckpointsWriteVersion() int {
1131-
return 1
1132-
}
1133-
11341100
// WarnIfCheckpointsV2Disallowed emits the v2 fallback warning when any legacy
11351101
// settings key requests v2 writes or pushes.
11361102
func (s *EntireSettings) WarnIfCheckpointsV2Disallowed() {

cmd/entire/cli/settings/settings_test.go

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -855,57 +855,6 @@ func TestCheckpointsVersion(t *testing.T) {
855855
}
856856
}
857857

858-
func TestCheckpointsWriteVersion(t *testing.T) {
859-
t.Parallel()
860-
861-
tests := []struct {
862-
name string
863-
opts map[string]any
864-
want int
865-
}{
866-
{"unset defaults to one", nil, 1},
867-
{"empty options defaults to one", map[string]any{}, 1},
868-
{"integer 2 disallowed for writes", map[string]any{"checkpoints_version": 2}, 1},
869-
{"float 2 disallowed for writes", map[string]any{"checkpoints_version": float64(2)}, 1},
870-
{"string 2 disallowed for writes", map[string]any{"checkpoints_version": "2"}, 1},
871-
{"integer 1 remains one", map[string]any{"checkpoints_version": 1}, 1},
872-
}
873-
874-
for _, tt := range tests {
875-
t.Run(tt.name, func(t *testing.T) {
876-
t.Parallel()
877-
s := &EntireSettings{StrategyOptions: tt.opts}
878-
if got := s.CheckpointsWriteVersion(); got != tt.want {
879-
t.Errorf("CheckpointsWriteVersion() = %d, want %d", got, tt.want)
880-
}
881-
})
882-
}
883-
}
884-
885-
func TestIsCheckpointsV2WriteEnabled_AlwaysFalseAfterDisallow(t *testing.T) {
886-
t.Parallel()
887-
888-
tests := []struct {
889-
name string
890-
opts map[string]any
891-
}{
892-
{"checkpoints_version 2", map[string]any{"checkpoints_version": 2}},
893-
{"checkpoints_v2 true", map[string]any{"checkpoints_v2": true}},
894-
{"both true", map[string]any{"checkpoints_v2": true, "checkpoints_version": 2}},
895-
{"empty options", map[string]any{}},
896-
}
897-
898-
for _, tt := range tests {
899-
t.Run(tt.name, func(t *testing.T) {
900-
t.Parallel()
901-
s := &EntireSettings{StrategyOptions: tt.opts}
902-
if s.IsCheckpointsV2WriteEnabled() {
903-
t.Error("expected IsCheckpointsV2WriteEnabled to be false")
904-
}
905-
})
906-
}
907-
}
908-
909858
func TestWarnIfCheckpointsV2Disallowed(t *testing.T) {
910859
tests := []struct {
911860
name string

0 commit comments

Comments
 (0)