Add commit_tree_hash to checkpoint metadata#319
Open
arosenfeld2003 wants to merge 1 commit intoentireio:mainfrom
Open
Add commit_tree_hash to checkpoint metadata#319arosenfeld2003 wants to merge 1 commit intoentireio:mainfrom
arosenfeld2003 wants to merge 1 commit intoentireio:mainfrom
Conversation
Store the git tree hash of HEAD at condensation time in checkpoint metadata. This provides a content-addressable anchor that survives history rewrites (rebase, squash, force-push) — a rebased commit has a different SHA but the same tree hash when file content is unchanged. A future `entire repair` command can use this field to re-link orphaned checkpoints by scanning the current branch for commits whose tree hash matches a checkpoint's stored value. Changes: - Add CommitTreeHash field to WriteCommittedOptions, CommittedMetadata, and CheckpointSummary structs (omitempty for backward compat) - Add GetHeadTreeHash() helper in strategy/common.go - Wire into manual-commit condensation and auto-commit metadata (both session and task checkpoint paths) - Add round-trip test for the checkpoint package - Add end-to-end condensation test for manual-commit strategy Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: d008cfcd3b30
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.
Summary
commit_tree_hashfield)entire repaircommand can use this field to re-link orphaned checkpoints by scanning the current branch for commits whose tree hash matchesCloses #321
Changes
checkpoint/checkpoint.go— AddCommitTreeHash stringfield toWriteCommittedOptions,CommittedMetadata(json:"commit_tree_hash,omitempty"), andCheckpointSummary(json:"commit_tree_hash,omitempty")checkpoint/committed.go— PassCommitTreeHashthrough inwriteSessionToSubdirectory()andwriteCheckpointSummary()strategy/common.go— AddGetHeadTreeHash()helper (same pattern asGetCurrentBranchName)strategy/manual_commit_condensation.go— Call helper and pass toWriteCommittedOptionsstrategy/auto_commit.go— Call helper and pass to options in bothcommitMetadataToMetadataBranch()andcommitTaskMetadataToMetadataBranch()checkpoint/checkpoint_test.go— Round-trip test: write with tree hash and verify in both metadata levels; write without and verifyomitemptyomits the keystrategy/manual_commit_test.go— End-to-end condensation test: SaveChanges → user commit → CondenseSession → verifycommit_tree_hashmatches HEAD's tree hashWhat is NOT changed
omitemptymeans old checkpoints deserialize cleanlyTest plan
go test ./cmd/entire/cli/checkpoint/ -run TestWriteCommitted_CommitTreeHashField -vgo test ./cmd/entire/cli/strategy/ -run TestCondenseSession_IncludesCommitTreeHash -vgofmt -s -w .— no formatting issuesgolangci-lint run— 0 issuesgo test -tags=integration -race ./...— all tests pass🤖 Generated with Claude Code