enforce local policy after sync failure · Entire
enforce local policy after sync failure
c6529b2→main·
pfleidi·3w ago·2 files·+35 added/-0 removed
When pre-push cannot refresh checkpoint policy from the remote, still honor an already-local policy that blocks checkpoint writes.
This avoids pushing checkpoint metadata with an unsupported writer just because the remote policy check failed.
Sessions
98531e973f39View transcript
[?
Checkpoint Policy Enforcement and ValidationCodex·GPT-5.5·2 steps](/content/gh/entireio/cli/session/019efaa9-f5b2-72c0-bf9d-a2a75869ea82#timeline-98531e973f39/index.html)
Changes
2
cmd/entire/cli/strategy
Mcheckpoint_policy.go+5
Mcheckpoint_policy_test.go+30
52 unmodified lines
53
54
55
56
57
58
59
60
61
62
63
52 unmodified lines
state, err := checkpointpolicy.Sync(ctx, repo, target)
if err != nil {
warnOrLogCheckpointPolicySyncFailure(ctx, err)
localState, readErr := checkpointpolicy.ReadLocal(ctx, repo)
if readErr == nil && checkpointpolicy.UnsupportedWrite(localState.Policy) {
warnOrLogUnsupportedCheckpointWrite(ctx, localState.Policy)
return false
}
return true
}
if state.Source == checkpointpolicy.SourceLocalDiverged {
Mcmd/entire/cli/strategy/checkpoint_policy.go+5
184 unmodified lines
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
184 unmodified lines
require.Empty(t, strings.TrimSpace(out))
}
func TestPrePushSkipsCheckpointPushWhenSyncFailsAndLocalPolicyWriteUnsupported(t *testing.T) {
workDir := setupRepoWithCheckpointBranch(t)
bareDir := filepath.Join(t.TempDir(), "remote.git")
_, err := git.PlainInit(bareDir, true)
require.NoError(t, err)
runCheckpointPolicyGit(t, workDir, "remote", "add", "origin", bareDir)
repo, err := git.PlainOpen(workDir)
require.NoError(t, err)
t.Cleanup(func() {
_ = repo.Close()
})
writeUnsupportedCheckpointPolicy(t, repo)
t.Chdir(workDir)
paths.ClearWorktreeRootCache()
t.Setenv(interactive.EnvTestTTY, "1")
oldWriter := stderrWriter
var stderr bytes.Buffer
stderrWriter = &stderr
t.Cleanup(func() { stderrWriter = oldWriter })
require.NoError(t, os.RemoveAll(bareDir))
err = NewManualCommitStrategy().PrePush(context.Background(), "origin")
require.NoError(t, err)
require.Contains(t, stderr.String(), "Could not refresh checkpoint policy")
require.Contains(t, stderr.String(), "requires checkpoint support newer than this Entire CLI")
}
func TestSyncCheckpointPolicyForPrePushUsesPushTarget(t *testing.T) {
workDir := setupGitRepo(t)
originBareDir := filepath.Join(t.TempDir(), "origin.git")