checkpoint: trim v1.1 removal leftovers · Entire

checkpoint: trim v1.1 removal leftovers

10436bd→main·

pfleidi·1mo ago·8 files·+27 added/-90 removed

Remove no-op settings-based committed ref resolution and stale facade surface after collapsing committed metadata to v1. Route the remaining resume path through checkpoint.Open and keep summary generation on the committed store it uses.

Sessions

14d6de264f7fView transcript

[?
Collapse Checkpoint Metadata to v1Codex·GPT-5.5·2 steps](/content/gh/entireio/cli/session/019ed756-10c2-7381-85f9-e4e65afabf11#timeline-14d6de264f7f/index.html)

Changes

8

20 unmodified lines

21
22
23
24
24
25
26
26 unmodified lines

53
54
55
57
58
56
57
61
58
59
63
64
65
60
61
62
63
70
71
64
65
66
67

20 unmodified lines

"github.com/entireio/cli/cmd/entire/cli/interactive"
    "github.com/entireio/cli/cmd/entire/cli/logging"
    "github.com/entireio/cli/cmd/entire/cli/session"
    "github.com/entireio/cli/cmd/entire/cli/settings"
    "github.com/entireio/cli/cmd/entire/cli/strategy"
    "github.com/entireio/cli/cmd/entire/cli/trailers"
    "github.com/entireio/cli/cmd/entire/cli/validation"
26 unmodified lines

// transcript's first user prompt. Used by `entire review attach` when a
    // pending-review marker has the exact prompt the user was asked to run.
    ReviewPromptOverride string
    // entireSettings, when non-nil, supplies already-resolved settings.
    entireSettings *settings.EntireSettings
}

// committedRefs resolves the topology, honoring an injected EntireSettings.
// committedRefs resolves the committed metadata topology.
func (opts attachOptions) committedRefs(ctx context.Context) cpkg.CommittedRefs {
    if opts.entireSettings != nil {
        return cpkg.ResolveCommittedRefsFromSettings(opts.entireSettings)
    }
    return cpkg.ResolveCommittedRefs(ctx)
}

// openAttachStore opens the committed store for the resolved topology. refs is
// passed explicitly (not re-resolved from live settings) so attach preserves
// any injected EntireSettings / PrimaryAsRead() pinning.
// passed explicitly so attach preserves PrimaryAsRead() pinning.
func openAttachStore(ctx context.Context, repo *git.Repository, refs cpkg.CommittedRefs) (*cpkg.GitStore, error) {
    stores, err := cpkg.Open(ctx, repo, cpkg.OpenOptions{Refs: &refs})
    if err != nil {

Mcmd/entire/cli/attach.go+2/-9

116 unmodified lines

117
118
119
120
121
120
121
122
123
124

116 unmodified lines

assert.Equal(t, refs, store.Refs())
}

// Not parallel: uses t.Chdir() so settings.Load resolves the test repo.
func TestNewGitStore_SelectsRefByVersion(t *testing.T) {
// Not parallel: uses t.Chdir() to exercise on-disk settings being ignored.
func TestNewGitStore_IgnoresCheckpointsVersion(t *testing.T) {
    dir, repo, h := newTestRepo(t)
    setRef(t, repo, v1BranchRef(), h)
     t.Chdir(dir)
}

Mcmd/entire/cli/checkpoint/committed_read_store_test.go+2/-2

6 unmodified lines

7
8
9
10
10
11
12
34 unmodified lines

47
48
49
51
52
53
54
55

6 unmodified lines

"github.com/go-git/go-git/v6/plumbing"

"github.com/entireio/cli/cmd/entire/cli/paths"
    "github.com/entireio/cli/cmd/entire/cli/settings"
// CommittedRefs is the committed-metadata ref topology.
34 unmodified lines

func ResolveCommittedRefs(_ context.Context) CommittedRefs {
    return DefaultV1Refs()
}

// ResolveCommittedRefsFromSettings returns the committed metadata topology.
func ResolveCommittedRefsFromSettings(_ *settings.EntireSettings) CommittedRefs {
    return DefaultV1Refs()
}

Mcmd/entire/cli/checkpoint/committed_refs.go-6

5 unmodified lines

6
7
8
9
10
9
10
13
11
12
13
14
14 unmodified lines

29
30
31
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
32
33
34

5 unmodified lines

"github.com/go-git/go-git/v6/plumbing"
    "github.com/stretchr/testify/assert"

"github.com/entireio/cli/cmd/entire/cli/settings"
// Not parallel: uses t.Chdir() so settings.Load resolves the test repo.
// Not parallel: uses t.Chdir() to exercise on-disk settings being ignored.
func TestResolveCommittedRefs(t *testing.T) {
    v1 := v1BranchRef()
    tests := []struct {
14 unmodified lines

}
}

func TestResolveCommittedRefsFromSettings(t *testing.T) {
    t.Parallel()
    v1 := v1BranchRef()
    settingsWithVersion := &settings.EntireSettings{
        StrategyOptions: map[string]any{"checkpoints_version": "1.1"},
    }
    tests := []struct {
        name     string
        settings *settings.EntireSettings
        want     CommittedRefs
    }{
        {"nil", nil, CommittedRefs{Primary: v1, Read: v1, Push: []plumbing.ReferenceName{v1}}},
        {"empty", &settings.EntireSettings{}, CommittedRefs{Primary: v1, Read: v1, Push: []plumbing.ReferenceName{v1}}},
        {"checkpoints version ignored", settingsWithVersion, CommittedRefs{Primary: v1, Read: v1, Push: []plumbing.ReferenceName{v1}}},
    }
    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            t.Parallel()
            assert.Equal(t, tt.want, ResolveCommittedRefsFromSettings(tt.settings))
        })
    }
}

func TestDefaultV1Refs(t *testing.T) {
    t.Parallel()
    v1 := v1BranchRef()

Mcmd/entire/cli/checkpoint/committed_refs_test.go+1/-26

3 unmodified lines

4
5
6
7
8
7
8
11
12
9
10
11
12
13
1 unmodified line

15
16
17
20
21
22
23
24
25
26
27
18
19
20
21
22
23
32
33
34
35
36
37
38
24
25
26
27
4 unmodified lines

32
33
34
49
50
51
35
36
53
37
38
39
40
8 unmodified lines

49
50
51
68
69
52
53
71
72
73
74
54
55
56
57
78
79
80
58
59
60
83
84
61
62
86
87
88
89
90

3 unmodified lines

"context"

"github.com/go-git/go-git/v6"

"github.com/entireio/cli/cmd/entire/cli/settings"
// OpenOptions configures Open. The zero value resolves the committed-ref
// topology from on-disk settings and attaches no blob fetcher.
// OpenOptions configures Open. The zero value uses the default committed-ref
// topology and attaches no blob fetcher.
type OpenOptions struct {
    // BlobFetcher is the CLI-level on-demand blob fetcher. The checkpoint
    // package cannot resolve it itself, so the CLI layer injects it here and
    1 unmodified line

// fetching off.
    BlobFetcher BlobFetchFunc

// Settings overrides on-disk settings when resolving the committed-ref
    // topology. nil resolves from disk via ResolveCommittedRefs. Ignored when
    // Refs is non-nil.
    Settings *settings.EntireSettings

// Refs overrides the resolved committed-ref topology outright. nil resolves
    // from Settings (or disk). A non-nil value wins — e.g. attach pins reads to
    // Primary via PrimaryAsRead().
    // Refs overrides the default committed-ref topology. A non-nil value wins,
    // e.g. attach pins reads to Primary via PrimaryAsRead().
    Refs *CommittedRefs
}

// Stores is the facade returned by Open: the committed store plus the git-only
// temporary capability and the resolved topology accessors callers need during
// the transition to pluggable backends
// temporary capability and resolved committed-ref topology.
type Stores struct {
    // Primary is the committed store — the source of truth that serves all
    // committed reads and writes.
4 unmodified lines

}

// Open resolves the checkpoint storage topology and constructs the backing
// store(s). It is the single construction seam that replaces scattered
// NewGitStore(repo, ResolveCommittedRefs(ctx)) calls, so ref resolution and
// blob-fetcher wiring live in one place.
// store. It keeps ref resolution and blob-fetcher wiring in one place.
//nolint:unparam // The error result is part of the forward-looking facade contract: pluggable backends (Phase 2+) can fail to open. The git backend never returns one today.
//nolint:unparam // Callers treat store construction as fallible at this boundary; the git backend has no fallible setup today.
func Open(ctx context.Context, repo *git.Repository, opts OpenOptions) (*Stores, error) {
    refs := resolveOpenRefs(ctx, opts)
    store := NewGitStore(repo, refs)
8 unmodified lines

}

func resolveOpenRefs(ctx context.Context, opts OpenOptions) CommittedRefs {
    switch {
    case opts.Refs != nil:
        if opts.Refs != nil {
            return *opts.Refs
    case opts.Settings != nil:
        return ResolveCommittedRefsFromSettings(opts.Settings)
        default:
            return ResolveCommittedRefs(ctx)
        }
    return ResolveCommittedRefs(ctx)
}
// Temporary returns the git-backed temporary (shadow-branch) store. Temporary
// capture is inherently git-only; a future non-git Primary would leave this
// pointing at a dedicated git store.
// Temporary returns the git-backed temporary (shadow-branch) store.
func (s *Stores) Temporary() *GitStore { return s.temporary }

// Refs returns the resolved committed-ref topology. Transition accessor: this
// ref logic moves behind sync/admin capabilities in a later phase.
// Refs returns the resolved committed-ref topology.
func (s *Stores) Refs() CommittedRefs { return s.refs }

// Repository returns the underlying git repository. Transition accessor for
// git-topology operations (e.g. mirror repair) that have not yet moved behind a
// capability.
func (s *Stores) Repository() *git.Repository { return s.Primary.Repository() }