Remove checkpoints v2 write paths#1249
Merged
Merged
Conversation
When strategy_options.checkpoints_version is set to 2, emit a one-time warning to stderr and fall back to version 1. The setting was the entry point for v2-only mode (skipping v1 writes); ignoring it routes all writes back to v1 while leaving the underlying v2 code paths intact for read-side fallback. Tests that previously asserted v2-only behavior now assert the new fallback-to-v1 behavior. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Entire-Checkpoint: c996e57d6669
Contributor
There was a problem hiding this comment.
Pull request overview
This PR changes settings handling so strategy_options.checkpoints_version: 2 is treated as disallowed: the code emits a one-time stderr warning and falls back to checkpoints version 1, while keeping other configuration behavior intact. The test suite is updated to reflect the new “v2 ignored → v1 behavior” across unit, integration, and attach surfaces.
Changes:
- Update
EntireSettings.CheckpointsVersion()to warn once when configured to2and return1instead. - Adjust unit tests to assert the new warning + fallback behavior (including
IsCheckpointsV2Enabled/IsPushV2RefsEnabledexpectations). - Update integration + attach tests that previously validated “strict v2-only” behavior to validate fallback-to-v1 behavior and absence of v2 refs when only
checkpoints_version: 2is set.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/entire/cli/settings/settings.go | Implements the one-time warning and fallback-to-v1 behavior when checkpoints_version is set to 2. |
| cmd/entire/cli/settings/settings_test.go | Updates unit tests to validate fallback behavior and warning emission. |
| cmd/entire/cli/integration_test/v2_resume_test.go | Changes resume integration test from “v2-only” expectations to “v2 disallowed → v1 restore” expectations. |
| cmd/entire/cli/integration_test/v2_push_test.go | Updates push integration test to expect v1 metadata branch push and no v2 refs when checkpoints_version: 2 is configured. |
| cmd/entire/cli/integration_test/v2_dual_write_test.go | Updates dual-write integration tests to expect v1 writes and no v2 refs when checkpoints_version: 2 is configured. |
| cmd/entire/cli/attach_test.go | Updates attach tests to expect v1 metadata behavior and v1-oriented refuse hints when checkpoints_version: 2 is configured. |
Comments suppressed due to low confidence (2)
cmd/entire/cli/settings/settings_test.go:893
- The helper
resetCheckpointsVersionWarningOnceassigns a newsync.Once{}into a package-level variable. If any parallel test is executingcheckpointsVersionWarningOnce.Do(...)at the same time, this is a data race. Either avoid resetting the global entirely (structure warning assertions to run in one place), or ensure all tests in this package that might touchCheckpointsVersion()are fully serialized while this helper is in use.
// resetCheckpointsVersionWarningOnce zeroes the package-level warn-once so
// each test can independently assert the warning behavior. Cannot restore the
// prior Once value (sync.Once contains a noCopy field, and copying-then-
// assigning back triggers govet's copylocks). Tests using this helper must
// not run in parallel.
func resetCheckpointsVersionWarningOnce(t *testing.T) {
t.Helper()
checkpointsVersionWarningOnce = sync.Once{}
}
cmd/entire/cli/settings/settings_test.go:923
- This test and its subtests are marked
t.Parallel()but include a case that callsIsPushV2RefsEnabled()withcheckpoints_version: 2, which now emits a global warn-once to stderr. Running in parallel increases the chance of interfering with stderr-capture/warn-once assertions elsewhere in this package and can introduce race-detector failures if tests reset the globalsync.Once. Consider removing parallelization here (or at least for the subtest that usescheckpoints_version: 2).
func TestIsPushV2RefsEnabled_RequiresBothFlags(t *testing.T) {
t.Parallel()
tests := []struct {
name string
opts map[string]any
expected bool
}{
{"checkpoints_version 2 ignored after disallow", map[string]any{"checkpoints_v2": false, "push_v2_refs": false, "checkpoints_version": 2}, false},
{"both true", map[string]any{"checkpoints_v2": true, "push_v2_refs": true}, true},
{"only checkpoints_v2", map[string]any{"checkpoints_v2": true}, false},
{"only push_v2_refs", map[string]any{"push_v2_refs": true}, false},
{"both false", map[string]any{"checkpoints_v2": false, "push_v2_refs": false}, false},
{"push_v2_refs wrong type", map[string]any{"checkpoints_v2": true, "push_v2_refs": "yes"}, false},
{"empty options", map[string]any{}, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
s := &EntireSettings{
These two strategy_options were the entry points for dual-write and v2 ref push. With checkpoints_version: 2 already disallowed, leaving them honored is incoherent — treat them the same way: - IsCheckpointsV2Enabled: always returns false. If checkpoints_v2: true is configured, emit a one-time stderr warning and ignore the setting. - IsPushV2RefsEnabled: always returns false. If push_v2_refs: true is configured, same warning treatment. Read-side fallback when the v2 /main ref exists locally is unchanged — committed_reader_resolve.go's hasLocalV2MainRef path still selects the DualCheckpointReader regardless of the (now-ignored) settings. Tests that exercised the v2 write/push happy paths via these settings are deleted; the disallow behavior is now covered by: - TestIsCheckpointsV2Enabled_TrueIgnoredAfterDisallow - TestIsCheckpointsV2Enabled_LoadFromFileIgnoresDisallowedSetting - TestIsCheckpointsV2Enabled_LocalOverrideIgnoresDisallowedSetting - TestIsPushV2RefsEnabled_AlwaysFalseAfterDisallow - TestRunSessionsFix_V2ChecksSkippedWhenSettingIgnored Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Entire-Checkpoint: 51d8634b453b
…checkpoints-v2-setting
Entire-Checkpoint: 9deadbe3849a
Entire-Checkpoint: ca7e7c49c125
Entire-Checkpoint: f678bfcfcfa0
Entire-Checkpoint: 7299217bf05d
Entire-Checkpoint: 749550d59b7d
Entire-Checkpoint: 58d96f1248ed
Entire-Checkpoint: 3a15f532e0cc
Soph
approved these changes
May 22, 2026
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.
https://entire.io/gh/entireio/cli/trails/413
Summary
strategy_options.checkpoints_version: 2,checkpoints_v2,push_v2, andpush_v2_refsnow fall back to v1 behavior.[entire] strategy_options.checkpoints_version %v is no longer supported. Falling back to version 1until the v2 setting is removed from settings.CheckpointsWriteVersion,IsCheckpointsV2WriteEnabled,IsPushV2RefsEnabled, and the private v2 push implementation.Test plan
go test ./cmd/entire/cli/settings ./cmd/entire/cli/strategy -run TestWarnIfCheckpointsV2Disallowedgo test ./cmd/entire/cli/strategygo test ./cmd/entire/cli -run TestAttach_CheckpointsVersion2_FallsBackToV1go test ./cmd/entire/cli -run TestListCommittedForExplain_MergesV1AndV2go test ./cmd/entire/cli -run TestGetBranchCheckpoints_V2PromptFallbackWhenV1Deletedgo test -tags integration ./cmd/entire/cli/integration_test -run TestV2Resumego test -tags integration ./cmd/entire/cli/integration_test -run TestCheckpointsVersion2DisallowedResumemise run lint