test: hoist the branch-v1 stamp into a constant (goconst) · Entire

test: hoist the branch-v1 stamp into a constant (goconst)

b976526→main·

Soph·1w ago·1 file·+7 added/-3 removed

The new dry-run tests added a third "branch-v1" literal, tripping goconst. Name it once as legacyCheckpointVersion.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Sessions

01KWY80X77KHP4HV0Z9EJHFK16View transcript

Investigate CLI Enable Backend PingClaude Code·4 steps Fix Checkpoint Push and Doctor Command IssuesClaude Code·1 step

Changes

1

20 unmodified lines

21
22
23
24
25
26
27
28
29
30
88 unmodified lines

119
120
121
118
122
123
124
125
173 unmodified lines

299
300
301
298
302
303
304
305
37 unmodified lines

343
344
345
342
346
347
348
349

20 unmodified lines

"github.com/entireio/cli/redact"

// legacyCheckpointVersion is the checkpoint_version stamp older git-branch
// checkpoints carry; the migration drops it for the refs layout.
const legacyCheckpointVersion = "branch-v1"

// sampleSession builds a checkpoint write request with deterministic content,
// shared so a checkpoint written to the git-branch and git-refs stores has
// byte-identical session contents.
88 unmodified lines

// cid1 carries legacy metadata: a checkpoint_version stamp plus an unmodeled field.
mutateBranchCheckpointMetadata(t, repo, cid1, func(doc map[string]any) {
    doc["checkpoint_version"] = "branch-v1"
    doc["checkpoint_version"] = legacyCheckpointVersion
    doc["future_field"] = "keep-me"
})

173 unmodified lines

// Legacy metadata so normalization rewrites the tree — the case that used to
    // persist a blob + tree even under dry-run.
mutateBranchCheckpointMetadata(t, repo, cid, func(doc map[string]any) {
    doc["checkpoint_version"] = "branch-v1"
    doc["checkpoint_version"] = legacyCheckpointVersion
})

before := countObjects(t, repo)
37 unmodified lines

cid := id.MustCheckpointID("a1b2c3d4e5f6")
    seedBranchCheckpoint(t, branch, cid, "s1")
    mutateBranchCheckpointMetadata(t, repo, cid, func(doc map[string]any) {
    doc["checkpoint_version"] = "branch-v1"
    doc["checkpoint_version"] = legacyCheckpointVersion
    })

// Real migration persists the normalized tree.

Mcmd/entire/cli/checkpoint/migrate_test.go+7/-3