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:
- Per session it replays the transcript (regenerating the compact transcript.jsonl), prompts, and metadata through Write, so the tree is rooted at the checkpoint (no shard folders) and SessionFilePaths/CompactTranscriptStart are correct by construction. Per-session summaries and combined attribution are replayed; a tasks/ subtree is grafted in unchanged.
- The checkpoint id is preserved, and each commit keeps the original author —read from the v1-branch commit that wrote the session (metadata carries no author), falling back to the repo git author.
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
cmd/entire/cli
checkpoint
Arewrite.go+287
Arewrite_test.go+165
Mdoctor.go+1
Adoctor_rewrite.go+74
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.