honor committed read ref in CLI paths · Entire

honor committed read ref in CLI paths

2326aa2→main·

pfleidi·1mo ago·5 files·+32 added/-4 removed

Route user-facing committed metadata reads through the configured read store so v1.1 mode reads the local mirror as-is.

Add a regression that diverges v1 after seeding the custom ref to catch accidental fallback to the primary branch.

Sessions

18d361781db9View transcript

[?
Centralize Checkpoint Metadata Mirror UpdatesCodex·GPT-5.5·2 steps](/content/gh/entireio/cli/session/019e89b2-44f8-7393-aa5f-ca3123a80a76#timeline-18d361781db9/index.html)

Changes

5

170 unmodified lines

171
172
173
174
174
175
176
177

170 unmodified lines

return nil, err
    }

store := checkpoint.NewGitStore(repo)
    store := checkpoint.NewCommittedReadStore(ctx, repo)
    infos, err := store.ListCommitted(ctx)
    if err != nil {
        return nil, fmt.Errorf("list committed checkpoints: %w", err)
    }

Mcmd/entire/cli/dispatch/mode_local.go+1/-1

51 unmodified lines

52
53
54
55
55
56
57
58

51 unmodified lines

return false, false, ""
    }
    defer repo.Close()
    store := checkpoint.NewGitStore(repo)
    store := checkpoint.NewCommittedReadStore(ctx, repo)
    summary, err := checkpoint.ReadCommittedCheckpoint(ctx, store, cpID)
    if err != nil || summary == nil {
        logging.Debug(ctx, "head checkpoint flags: resolve checkpoint summary",

Mcmd/entire/cli/head_checkpoint_flags.go+1/-1

2 unmodified lines

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
13 unmodified lines

33
34
35
36
37
38
39
96 unmodified lines

136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162

2 unmodified lines

import (
    "context"
    "os"
    "path/filepath"
    "strings"
    "testing"

"github.com/entireio/cli/cmd/entire/cli/checkpoint"
    "github.com/entireio/cli/cmd/entire/cli/checkpoint/id"
    "github.com/entireio/cli/cmd/entire/cli/paths"
    "github.com/entireio/cli/cmd/entire/cli/testutil"
    "github.com/entireio/cli/redact"
    "github.com/go-git/go-git/v6"
    "github.com/go-git/go-git/v6/plumbing"
    "github.com/stretchr/testify/require"
)

13 unmodified lines

testutil.GitAdd(t, tmpDir, "init.txt")
    testutil.GitCommit(t, tmpDir, "init")
    t.Chdir(tmpDir)
    paths.ClearWorktreeRootCache()

repo, err := git.PlainOpen(tmpDir)
    require.NoError(t, err)
96 unmodified lines

require.False(t, hasInvestigation, "wrapper must not piggyback on HasReview")
    require.Empty(t, info, "info must be empty when the wrapper returns false")
}

func TestHeadCheckpointFlags_V11ReadsCustomRefAsIs(t *testing.T) {
    repo := setupHeadFlagsRepo(t)
    cwd, err := os.Getwd()
    require.NoError(t, err)
    require.NoError(t, os.MkdirAll(filepath.Join(cwd, paths.EntireDir), 0o755))
    require.NoError(t, os.WriteFile(
        filepath.Join(cwd, paths.EntireDir, paths.SettingsFileName),
        []byte(`{"enabled": true, "strategy_options": {"checkpoints_version": "1.1"}}`),
        0o644,
    ))

cpID := writeHeadCheckpointWithFlags(t, repo, true, true)
    v1Ref, err := repo.Reference(plumbing.NewBranchReferenceName(paths.MetadataBranchName), true)
    require.NoError(t, err)
    require.NoError(t, repo.Storer.SetReference(plumbing.NewHashReference(plumbing.ReferenceName(paths.MetadataRefName), v1Ref.Hash())))

writeHeadCheckpointWithFlags(t, repo, false, false)

hasReview, hasInvestigation, info := headCheckpointFlags(context.Background())
    require.True(t, hasReview, "v1.1 reads must use the custom ref, not the diverged v1 branch")
    require.True(t, hasInvestigation, "v1.1 reads must use the custom ref, not the diverged v1 branch")
    require.Contains(t, info, cpID.String())
}

Mcmd/entire/cli/head_checkpoint_flags_test.go+28

97 unmodified lines

98
99
100
101
101
102
103
104

97 unmodified lines

return ""
    }
    defer repo.Close()
    store := checkpoint.NewGitStore(repo)
    store := checkpoint.NewCommittedReadStore(ctx, repo)

var lines []string
    seen := map[checkpointid.CheckpointID]bool{}

Mcmd/entire/cli/review_context.go+1/-1

304 unmodified lines

305
306
307
308
308
309
310
311

304 unmodified lines

// Warn (once per process) if metadata branches are disconnected
    WarnIfMetadataDisconnected()

store := checkpoint.NewGitStore(repo)
    store := checkpoint.NewCommittedReadStore(ctx, repo)
    committed, err := store.ListCommitted(ctx)
    if err != nil {
        return nil, fmt.Errorf("failed to list committed checkpoints: %w", err)
    }

Mcmd/entire/cli/strategy/common.go+1/-1