checkpoint: centralize store construction behind Open (Phase 0)

main

Commit

Soph3mo ago

Replace the scattered NewGitStore(repo, ResolveCommittedRefs(ctx)) construction across cli, strategy, dispatch, and the in-package LookupSessionLog with a single seam: checkpoint.Open(ctx, repo, OpenOptions) (*Stores, error).

This lands the final facade signature now (issue #1433 Phase 0) so call sites migrate only once: Stores.Primary holds the concrete *GitStore today and the same instance backs Temporary(); later phases narrow Primary to a pluggable committed-store interface and add independent-backend mirrors without further call-site churn. The facade exposes Temporary()/Refs()/Repository() so callers no longer reach for the concrete type, and OpenOptions carries the CLI-level BlobFetcher plus explicit Settings/Refs overrides (attach keeps its injected-settings / PrimaryAsRead topology).

Pure mechanical, no behavior change.

Notes:

  • getCheckpointStore now returns (*GitStore, error) (propagated through its callers); the old withBlobFetcher folds into OpenOptions.BlobFetcher.
  • generateCheckpointSummary takes the facade since it needs both the committed writer and Repository(); its mirror still resolves refs from settings (ResolveCommittedRefs) to preserve exact behavior.
  • Type is checkpoint.Stores (not CheckpointStores) to avoid the revive stutter; Open's always-nil error is the forward-looking facade contract.
  • benchutil and test files keep using NewGitStore, which Open wraps.

Refs #1433

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

Checkpoints

Debug Repo Mirror Issue with Store Refactoring

Claude CodeOpus 4.8[1m]
View session
Checkpoint 1

Isolate Token Store in CLI Tests

Claude CodeOpus 4.8[1m]
View session
Checkpoint 1