Skip to content

checkpoint: split-store foundation (Open factory + Stores facade + reader split)#1480

Merged
Soph merged 7 commits into
mainfrom
feat/checkpoint-store-foundation
Jun 21, 2026
Merged

checkpoint: split-store foundation (Open factory + Stores facade + reader split)#1480
Soph merged 7 commits into
mainfrom
feat/checkpoint-store-foundation

Conversation

@Soph

@Soph Soph commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

https://entire.io/gh/entireio/cli/trails/622

What

Foundation slice of the pluggable checkpoint-store work (#1433). This is the durable base carved out of #1474 — the first 7 commits, unchanged, all authored by @pfleidi:

  • checkpoint.Open(ctx, repo, OpenOptions) factory — single construction site for the store, replacing ~15 scattered NewGitStore calls. Resolves the committed-ref topology and wires the on-demand blob fetcher in one place.
  • checkpoint.Stores facadePrimary (committed store) + Temporary() (git-only shadow-branch capability) + resolved Refs(). attach injects its own instance via OpenOptions{Refs: …} to preserve PrimaryAsRead() pinning.
  • Split reader interfaces + caller migration so call sites no longer type-assert back to *GitStore.
  • getTemporaryStore strategy helper, reader edge-case fixes, attribution-reader narrowing, and the empty-summary lookup fix.

What this intentionally does not include

The committed_domain.go adapter tail from #1474 (the functional-options WriteSession/UpdateSession/UpdateCheckpoint writer surface) is dropped here on purpose. That writer shape is being reconsidered: per the design discussion on #1433, the target is a single unqualified Store.Write(ctx, WriteRequest) command union rather than a bag of functional options spread across session/checkpoint writers. Landing the options surface here and then replacing it would mean reviewing the writer API twice.

Stacked plan

This is PR 1 of 3, each one kind of change:

  1. (this PR) durable foundation — Open factory, Stores facade, reader split, caller migration.
  2. next, stacked — the Store.Write(ctx, WriteRequest) union (WriteSession/BackfillTranscript/BackfillSummary/BackfillAttribution) + the SessionRef-based reader domain. Pure interface+impl redesign, no file moves.
  3. stacked on 2 — detangle agent/session/review/TUI deps from the contract (push TokenUsage/SkillEvent into a leaf types package) and relocate the contract to github.com/entireio/cli/api/checkpoint so the backend can import it.

Supersedes #1474.

Verification

go build ./..., go vet, mise run fmt (clean), mise run lint (0 issues), and unit tests for the touched packages (checkpoint/..., cmd/entire/cli, strategy) all green.


Note

Medium Risk
Touches core checkpoint read/write and manual-commit save/rewind paths across many call sites, but the change is largely interface/factory wiring with added unit tests rather than new storage semantics.

Overview
Introduces checkpoint.Open as the single construction path for checkpoint storage, returning a Stores facade with Primary (CommittedStore) and Temporary() (TemporaryStore), plus resolved ref topology (attach still injects OpenOptions.Refs for read pinning).

Replaces the monolithic Store interface with narrower committed/temporary capability interfaces (CommittedStore, TemporaryStore, AuthorReader, etc.) and updates CLI/strategy call sites to depend on those types instead of *GitStore.

Manual-commit shadow-branch work (SaveStep, rewind, explain temp paths) now goes through getTemporaryStore; committed reads/writes stay on getCheckpointStore. Attribution and resume narrow further via local reader interfaces and shared read helpers; LookupSessionLog routes through ReadRawSessionLogForCheckpoint, with a fix so empty session summaries surface ErrCheckpointNotFound.

Reviewed by Cursor Bugbot for commit f39e8db. Configure here.

pfleidi added 7 commits June 18, 2026 16:27
Replace the combined checkpoint Store interface with committed, temporary, and optional author capabilities.

This keeps the current GitStore implementation while making the committed storage surface independent from shadow-branch operations.

Entire-Checkpoint: b6e36ed89559
Expose committed and temporary checkpoint storage through separate interfaces from the Stores facade.

Call sites now depend on committed readers and writers or temporary shadow-branch storage instead of the concrete GitStore.

Entire-Checkpoint: bb51dce048b6
SaveStep, SaveTaskStep, and GetRewindPoints each repeated the
getCheckpointStores + Temporary() pair. A getTemporaryStore accessor
mirrors getCheckpointStore so each call site is a single line, with
getCheckpointStores remaining the shared open-with-blob-fetcher wrapper.

Entire-Checkpoint: 684fdbdfe046
Keep empty-session checkpoints distinct from missing checkpoints when reading latest session content.

Also narrow resume checkpoint metadata resolution to the methods it actually uses so the split store interfaces stay precise.

Entire-Checkpoint: 8e67ab6c5252
Exercise the concrete GitStore latest-session reader in the redaction failure regression test.

This keeps the test checking that dropped transcripts surface ErrNoTranscript after condensation still writes checkpoint metadata.

Entire-Checkpoint: 02eff406bed3
Keep attribution resolution dependent only on the committed summary and session metadata methods it uses.

Add a focused test with a reader that omits unused session-content methods so the local interface stays precise.

Entire-Checkpoint: 136650505f9c
Return ErrCheckpointNotFound for empty committed summaries in the split reader helper.

This keeps the interface split behavior-neutral and updates the regression test to cover the pre-split contract.

Entire-Checkpoint: b7a703224f22
Copilot AI review requested due to automatic review settings June 19, 2026 13:54
@Soph Soph requested a review from a team as a code owner June 19, 2026 13:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR lays the groundwork for pluggable checkpoint storage by centralizing checkpoint-store construction and splitting the previously “fat” store surface into narrower committed vs temporary (shadow-branch) reader capabilities, then migrating key callers to the new abstractions.

Changes:

  • Introduces checkpoint.Open(ctx, repo, OpenOptions) and a checkpoint.Stores facade to centralize store wiring (refs topology + blob fetcher) and expose Primary (committed) + Temporary() (git-only).
  • Splits committed/temporary reader interfaces and migrates strategy + CLI call sites away from *checkpoint.GitStore where possible.
  • Adds/updates tests to validate the narrowed interfaces and edge-case behavior (including empty-summary not-found handling).

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cmd/entire/cli/strategy/manual_commit.go Adds getCheckpointStores helper and splits strategy access into committed vs temporary store capability.
cmd/entire/cli/strategy/manual_commit_test.go Updates a condensation test to construct a store directly after getCheckpointStore now returns an interface.
cmd/entire/cli/strategy/manual_commit_rewind.go Switches rewind-point discovery to use checkpoint.TemporaryStore.
cmd/entire/cli/strategy/manual_commit_git.go Routes shadow-branch writes through getTemporaryStore (TemporaryStore).
cmd/entire/cli/strategy/manual_commit_condensation.go Updates documentation/comments to reflect committed-store abstraction.
cmd/entire/cli/resume.go Narrows resume’s dependency from *GitStore to a smaller reader interface.
cmd/entire/cli/resume_test.go Adds a stub-based test proving resolveLatestCheckpoint only needs the narrowed reader surface.
cmd/entire/cli/explain.go Moves author lookup behind optional checkpoint.AuthorReader and uses TemporaryStore for temporary explains.
cmd/entire/cli/checkpoint/store.go Updates compile-time interface assertions to the new split interfaces.
cmd/entire/cli/checkpoint/open.go Implements the Stores facade (Primary + Temporary() + resolved Refs()).
cmd/entire/cli/checkpoint/committed.go Switches LookupSessionLog to committed-reader helpers instead of GitStore methods.
cmd/entire/cli/checkpoint/committed_reader_resolve.go Defines new committed-store interfaces and adds reader helper utilities.
cmd/entire/cli/checkpoint/committed_reader_resolve_test.go Adds coverage for the empty-summary not-found behavior in the new helpers.
cmd/entire/cli/checkpoint/checkpoint.go Replaces the old combined Store interface with the git-only TemporaryStore surface.
cmd/entire/cli/attribution.go Introduces a narrowed reader interface for attribution and normalizes nil summary handling.
cmd/entire/cli/attribution_test.go Adds a stub-based test validating attribution’s narrower checkpoint reader dependency.
cmd/entire/cli/attach.go Adjusts attach store opening to return CommittedStore capability (interface) instead of *GitStore.

Comment thread cmd/entire/cli/resume.go
@Soph Soph merged commit f7fe32a into main Jun 21, 2026
36 of 42 checks passed
@Soph Soph deleted the feat/checkpoint-store-foundation branch June 21, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants