fix: skip empty v1 orphan seed under git-refs backend#1819
Merged
Conversation
`entire enable` selecting the git-refs checkpoint backend still created an empty `entire/checkpoints/v1` branch. The enable-time seed step (EnsureSetup -> EnsurePrimaryRef) resolves the target ref via the hardcoded checkpoint.ResolveRefs (always v1) and never consults the configured backend, so on a freshly git-init'd folder with no origin it unconditionally created a vestigial empty orphan v1 that git-refs never writes to. Gate the empty-orphan fallback in EnsurePrimaryRef on the primary backend: under git-refs, skip creating the orphan. Adoption of real existing v1 data from origin or a checkpoint_remote is preserved so legacy checkpoints stay readable. Resolution is fail-soft — a config-load error keeps the legacy git-branch seeding behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Entire-Checkpoint: 01KY223K2WZPQN3GGTQK15MJX8
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an enable-time behavior where selecting the git-refs checkpoint backend still seeded an empty entire/checkpoints/v1 metadata branch. Since git-refs stores checkpoints in per-checkpoint refs and does not write to the v1 branch, the change prevents creation of a vestigial empty v1 branch while still preserving adoption of existing v1 data from origin or a configured checkpoint_remote.
Changes:
- Add a fail-soft config check to detect when the primary checkpoint backend is
git-refs. - Update
EnsurePrimaryRefto skip the “create empty orphan v1” fallback when the primary backend isgit-refs(but still bootstrap/adopt real v1 data when present). - Add a regression test covering the git-refs primary case to assert no v1 branch is created.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/entire/cli/strategy/common.go | Gates empty-orphan v1 seeding in EnsurePrimaryRef when primary backend is git-refs, while keeping existing remote adoption behavior. |
| cmd/entire/cli/strategy/common_test.go | Adds a subtest ensuring EnsurePrimaryRef does not create entire/checkpoints/v1 when the repo’s primary backend is configured as git-refs. |
pjbgf
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://entire.io/gh/entireio/cli/trails/910
Problem
Running
entire enableand selecting the git-refs checkpoint backend still created an emptyentire/checkpoints/v1branch — surprising, since git-refs writes checkpoints to per-checkpoint refs and never touches v1.Root cause
The enable-time seed step
EnsureSetup→EnsurePrimaryRef(cmd/entire/cli/strategy/common.go) is backend-agnostic: it resolves the target ref via the hardcodedcheckpoint.ResolveRefs(alwaysentire/checkpoints/v1) and never consultscheckpoints.primary. On a freshlygit init'd folder with no origin and nocheckpoint_remote, it falls through tocreateOrphanMetadataRef, unconditionally creating a vestigial empty orphan v1 that git-refs never writes to.The git-refs backend selection is persisted correctly to
settings.jsonbefore this runs — it's not a timing/ordering bug. The seed simply ignores the setting.Fix
Gate the empty-orphan fallback in
EnsurePrimaryRefon the primary backend. Under git-refs, skip the orphan seed. Scope kept minimal:checkpoint_remoteis preserved, so legacy checkpoints stay readable.checkpoint.PrimaryIsRefspredicate.Test
New subtest
TestEnsurePrimaryRef/skips_empty_orphan_when_primary_is_git-refs: writes a repo-localsettings.jsonwith git-refs primary, runsEnsurePrimaryRef, asserts no v1 branch is created. Red before the fix, green after.Verification
go test ./cmd/entire/cli/strategy/— passmise run fmt— applied🤖 Generated with Claude Code
Note
Low Risk
Localized setup-path change in
EnsurePrimaryRefwith fail-soft config handling and a focused regression test; no auth or data-migration logic.Overview
EnsurePrimaryRefno longer seeds an emptyentire/checkpoints/v1orphan when checkpoints primary is git-refs, fixingentire enablecreating a vestigial v1 branch even though that backend only uses per-checkpoint refs.A new
primaryIsGitRefshelper reads repo-local checkpoints config (fail-soft: load errors keep legacy git-branch behavior) and gates only the empty-orphan fallbacks—after a failed/missing checkpoint_remote bootstrap and when there is no local or origin ref. Adopting existing v1 data from origin or checkpoint_remote is unchanged so legacy checkpoints stay readable.A
TestEnsurePrimaryRefsubtest asserts that with{"checkpoints":{"primary":{"type":"git-refs"}}}in.entire/settings.json, no v1 branch is created on a fresh repo.Reviewed by Cursor Bugbot for commit bbc8a77. Configure here.