clarify unsupported policy versions · Entire
clarify unsupported policy versions
36eac56→main·
pfleidi·3w ago·3 files·+6 added/-6 removed
Report unsupported checkpoint policy versions as unsupported by this CLI instead of exposing internal read/write support distinctions.
Sessions
70394ff65490View transcript
[?
Checkpoint Policy Command and Feature ImprovementsCodex·GPT-5.5·2 steps](/content/gh/entireio/cli/session/019ef6e7-b75d-7050-920a-93eed6d34c27#timeline-70394ff65490/index.html)
Changes
3
cmd/entire/cli
Mcheckpoint_policy_test.go+2/-2
checkpointpolicy
Mpolicy.go+2/-2
Mpolicy_test.go+2/-2
32 unmodified lines
33
34
35
36
37
36
37
38
39
40
32 unmodified lines
args []string
wantErr string
} {
{name: "checkpoint version", args: []string{"--checkpoint-version", "refs-v1"}, wantErr: "not write-supported"},
{name: "minimum version", args: []string{"--checkpoint-min-version", "refs-v1"}, wantErr: "not read-supported"},
{name: "checkpoint version", args: []string{"--checkpoint-version", "branch-v2342"}, wantErr: `checkpoint_version "branch-v2342" is not supported by this Entire CLI`},
{name: "minimum version", args: []string{"--checkpoint-min-version", "refs-v1"}, wantErr: `checkpoint_min_version "refs-v1" is not supported by this Entire CLI`},
}
for _, tt := range tests {
Mcmd/entire/cli/checkpoint_policy_test.go+2/-2
35 unmodified lines
36
37
38
39
39
40
41
42
1 unmodified line
44
45
46
47
47
48
49
50
35 unmodified lines
return fmt.Errorf("checkpoint_version: %w", err)
}
if !CanWrite(version) {
return fmt.Errorf("checkpoint_version %q is not write-supported by this Entire CLI", policy.CheckpointVersion)
return fmt.Errorf("checkpoint_version %q is not supported by this Entire CLI", policy.CheckpointVersion)
}
minVersion, err := ParseFormat(policy.CheckpointMinVersion)
1 unmodified line
return fmt.Errorf("checkpoint_min_version: %w", err)
}
if !CanRead(minVersion) {
return fmt.Errorf("checkpoint_min_version %q is not read-supported by this Entire CLI", policy.CheckpointMinVersion)
return fmt.Errorf("checkpoint_min_version %q is not supported by this Entire CLI", policy.CheckpointMinVersion)
}
if Compare(minVersion, version) > 0 {
return fmt.Errorf("checkpoint_min_version %q is newer than checkpoint_version %q", policy.CheckpointMinVersion, policy.CheckpointVersion)
Mcmd/entire/cli/checkpointpolicy/policy.go+2/-2
23 unmodified lines
24
25
26
27
28
27
28
29
30
31
23 unmodified lines
}{
{name: "default", policy: checkpointpolicy.DefaultPolicy()},
{name: "unknown current", policy: checkpointpolicy.Policy{CheckpointVersion: "future-v1", CheckpointMinVersion: "branch-v1"}, wantErr: "unknown checkpoint family"},
{name: "unsupported current", policy: checkpointpolicy.Policy{CheckpointVersion: "refs-v1", CheckpointMinVersion: "branch-v1"}, wantErr: "not write-supported"},
{name: "unsupported minimum", policy: checkpointpolicy.Policy{CheckpointVersion: "branch-v1", CheckpointMinVersion: "refs-v1"}, wantErr: "not read-supported"},
{name: "unsupported current", policy: checkpointpolicy.Policy{CheckpointVersion: "branch-v2342", CheckpointMinVersion: "branch-v1"}, wantErr: `checkpoint_version "branch-v2342" is not supported by this Entire CLI`},
{name: "unsupported minimum", policy: checkpointpolicy.Policy{CheckpointVersion: "branch-v1", CheckpointMinVersion: "refs-v1"}, wantErr: `checkpoint_min_version "refs-v1" is not supported by this Entire CLI`},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {