Add hidden `entire doctor rewrite-checkpoints` test tooling (git-branch → git-refs) · Entire

Add hidden entire doctor rewrite-checkpoints test tooling (git-branch → git-refs)

07aac08·

Test tooling for evaluating the git-refs store against real branch data. It re-materializes every checkpoint on the entire/checkpoints/v1 branch as a per-checkpoint ref by re-driving the git-refs store's write path:

The command is hidden and writes refs locally without pushing (test tooling for now). Idempotent: existing refs are skipped unless --force; --dry-run reports without writing.

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

Sessions

b33b68817ca3View transcript

Changes

4

package checkpoint

import (
    "context"
    "errors"
    "fmt"
    "log/slog"

git "github.com/go-git/go-git/v6"
    "github.com/go-git/go-git/v6/plumbing"
    "github.com/go-git/go-git/v6/plumbing/filemode"
    "github.com/go-git/go-git/v6/plumbing/object"

"github.com/entireio/cli/cmd/entire/cli/checkpoint/id"
    "github.com/entireio/cli/cmd/entire/cli/logging"
    "github.com/entireio/cli/cmd/entire/cli/trailers"
    "github.com/entireio/cli/redact"
)

// RewriteResult summarizes a git-branch → git-refs checkpoint rewrite.
type RewriteResult struct {
    // Total is the number of checkpoints found on the v1 branch.
    Total int
    // Rewritten lists the checkpoints re-materialized as refs.
    Rewritten []id.CheckpointID
    // Skipped counts checkpoints left alone because their ref already exists.
    Skipped int
}

// ... (more logic and method definitions)

In the above code, several functions and methods describe how the rewrite operation is performed, including how checkpoints are rewritten and how checks are executed for existing refs. The operations are designed to ensure the integrity and history of the git repository are maintained throughout the process. The summary of the context includes detailed steps on what happens during the rewrite process.