Add commit_tree_hash to checkpoint metadata #319
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