Skip to content

Commit b976526

Browse files
Sophclaude
andcommitted
test: hoist the branch-v1 stamp into a constant (goconst)
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> Entire-Checkpoint: 01KWY80X77KHP4HV0Z9EJHFK16
1 parent 40abd51 commit b976526

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

cmd/entire/cli/checkpoint/migrate_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ import (
2121
"github.com/entireio/cli/redact"
2222
)
2323

24+
// legacyCheckpointVersion is the checkpoint_version stamp older git-branch
25+
// checkpoints carry; the migration drops it for the refs layout.
26+
const legacyCheckpointVersion = "branch-v1"
27+
2428
// sampleSession builds a checkpoint write request with deterministic content,
2529
// shared so a checkpoint written to the git-branch and git-refs stores has
2630
// byte-identical session contents.
@@ -115,7 +119,7 @@ func TestMigrateBranchToRefs(t *testing.T) {
115119

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

@@ -295,7 +299,7 @@ func TestMigrateBranchToRefs_DryRunWritesNothing(t *testing.T) {
295299
// Legacy metadata so normalization rewrites the tree — the case that used to
296300
// persist a blob + tree even under dry-run.
297301
mutateBranchCheckpointMetadata(t, repo, cid, func(doc map[string]any) {
298-
doc["checkpoint_version"] = "branch-v1"
302+
doc["checkpoint_version"] = legacyCheckpointVersion
299303
})
300304

301305
before := countObjects(t, repo)
@@ -339,7 +343,7 @@ func TestMigrateBranchToRefs_DryRunRecognizesAlreadyMigrated(t *testing.T) {
339343
cid := id.MustCheckpointID("a1b2c3d4e5f6")
340344
seedBranchCheckpoint(t, branch, cid, "s1")
341345
mutateBranchCheckpointMetadata(t, repo, cid, func(doc map[string]any) {
342-
doc["checkpoint_version"] = "branch-v1"
346+
doc["checkpoint_version"] = legacyCheckpointVersion
343347
})
344348

345349
// Real migration persists the normalized tree.

0 commit comments

Comments
 (0)