Add Go v2 checkpoint migration tool#1270
Conversation
Entire-Checkpoint: c9bc625237a6
Entire-Checkpoint: e25de9aab773
Entire-Checkpoint: 0951efc5bce0
Entire-Checkpoint: 80c40cdeb702
Entire-Checkpoint: 2134122b88bc
Entire-Checkpoint: c006f720c485
Entire-Checkpoint: d4f6517be448
Entire-Checkpoint: 7d613a7f649a
Entire-Checkpoint: 6e2dd4694dd4
Entire-Checkpoint: ae815b84d867
Entire-Checkpoint: f5e4e2ae22f3
…tmp-migrate-v2-script-go
Entire-Checkpoint: 0fc8bb5eb2ef
There was a problem hiding this comment.
Pull request overview
Adds a standalone Go migration binary (cmd/migrate-v2-checkpoints) that discovers Entire-Checkpoint trailers in git history and restores v2-only checkpoint/session data back into the production v1 checkpoint store, including preserving historical commit timestamps when writing to the v1 metadata branch.
Changes:
- Introduces
migrate-v2-checkpointswith list/plan/dry-run/apply modes, repo opening, checkpoint discovery, and migration reporting. - Implements checkpoint discovery by scanning git history tips for
Entire-Checkpointtrailers and associating checkpoint IDs with commits. - Extends v1 committed checkpoint writes with optional
CommitTime, wiring it through commit creation and adding focused tests.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| cmd/migrate-v2-checkpoints/main.go | Adds CLI entrypoint, flag parsing, repo opening, and mode dispatch for migration. |
| cmd/migrate-v2-checkpoints/history.go | Implements checkpoint trailer discovery by scanning reachable commits from selected history tips. |
| cmd/migrate-v2-checkpoints/migration.go | Implements v2→v1 migration logic and prints a summary report. |
| cmd/migrate-v2-checkpoints/main_test.go | Adds end-to-end tests for discovery, dry-run, apply, idempotency, and missing-data handling. |
| cmd/entire/cli/checkpoint/checkpoint.go | Extends WriteCommittedOptions with CommitTime. |
| cmd/entire/cli/checkpoint/committed.go | Uses CommitTime (or now) when creating metadata-branch commits; factors commit creation into a helper. |
| cmd/entire/cli/checkpoint/temporary.go | Routes commit creation through the new commit-time-aware helper. |
| cmd/entire/cli/checkpoint/committed_commit_time_test.go | Adds tests validating commit timestamp preservation vs “use current time” behavior. |
|
Bugbot run |
Entire-Checkpoint: ec521d6d285c
Entire-Checkpoint: 592345236abe
Entire-Checkpoint: 962df06c99d3
|
Bugbot run |
Entire-Checkpoint: d4f016669f04
Open the migration tool's repository via gitrepo.OpenPath so shared clones with object alternates resolve correctly instead of silently downgrading to PlainOpen. Inline single-call forwarders in migration.go and drop the redundant second hasRequiredV2Metadata check — both v2 session reads parse the same metadata.json. Inline stringly-typed flag-name constants in the migrate tests, and collapse refHeadCommit into its sole caller. Entire-Checkpoint: 1a30a6f9fdcd
Entire-Checkpoint: b01e75e8d461
|
Bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit f5ef3ca. Configure here.
Entire-Checkpoint: a458a0437dc3
Entire-Checkpoint: 93e1fd5362dc
Entire-Checkpoint: e699268f21c8
Entire-Checkpoint: 3b731107bd53
Entire-Checkpoint: 0b3b7a44bfd6
Entire-Checkpoint: 1db8610b3316
Entire-Checkpoint: 238dcfa519fc
Entire-Checkpoint: 1d716c292e2f
Entire-Checkpoint: 3141746402c0
Entire-Checkpoint: 5b8d4688d945
…li into tmp-migrate-v2-script-go
Entire-Checkpoint: b13ed8c7932b
Entire-Checkpoint: 54aa5a6f6fb1
Entire-Checkpoint: 912a3eb7de7e
Entire-Checkpoint: 70b0acc0e628
Entire-Checkpoint: eedb9b4ae0cc
Entire-Checkpoint: 13bdc2a14cbd
Entire-Checkpoint: c58d83f4bb9a
Entire-Checkpoint: 77778444950d

What
Adds a Go-based migration binary under
cmd/migrate-v2-checkpointsto restore useful v2-only checkpoint data into v1 storage. It reuses the existing checkpoint stores instead of line-for-line porting the shell script.How
GitStorepath.Notes
The migration intentionally skips transcript data that lacks usable v2 metadata, since that data is not useful for v1 restoration by itself.
Verification
mise run lintgo build -ldflags "-X github.com/entireio/cli/cmd/entire/cli/versioninfo.Version=v0.0.0-dev-9df43932c -X github.com/entireio/cli/cmd/entire/cli/versioninfo.Commit=9df43932c" -o /private/tmp/entire-pr-check ./cmd/entirego build -o /private/tmp/migrate-v2-checkpoints-pr-check ./cmd/migrate-v2-checkpointsgo test ./cmd/entire/cli/checkpoint ./cmd/migrate-v2-checkpoints -count=1Note
Medium Risk
Apply mode rewrites the v1 metadata branch from discovered v2 data; mistakes could affect checkpoint history, though dry-run and skip-existing-session behavior limit exposure.
Overview
Adds a
migrate-v2-checkpointsCLI that discovers checkpoints fromEntire-Checkpointtrailers in normal branch history (with--since,--head, list / dry-run / apply) and restores eligible v2 sessions into v1 via the existingGitStore/V2GitStorepaths, skipping sessions already on v1 and reporting missing v2 metadata or raw transcripts.Committed checkpoint writes gain optional
CommitTimeso metadata-branch commits can keep historical author/committer times during migration (zero still means “now”;CreatedAtis not reused as the git timestamp). Checkpoint pushes now use an explicitrefs/heads/…:refs/heads/…refspec so stalerefs/entire/checkpoints/v1refs cannot make the source branch ambiguous.Reviewed by Cursor Bugbot for commit f5ef3ca. Configure here.