git-refs: don't mask real errors as not-found; honor checkpoint policy on pre-push

Commit

Soph2mo ago

Addresses the open review threads on the git-refs store.

Error handling (was: any ref-resolution error treated as "missing"):

  • refBase: only a plumbing.ErrReferenceNotFound starts a new orphan checkpoint; a real lookup error (IO/corruption) is surfaced instead of silently overwriting the ref's history.
  • resolveRefMaybeFetch: a failed on-demand fetch (offline, network, ctx cancellation) now returns the real error; only a genuinely absent ref (or a successful fetch that finds nothing) resolves to not-found.
  • checkpointTree / Read: distinguish ErrCheckpointNotFound (→ nil summary) from real commit/tree/fetch errors, which now propagate instead of reading as "checkpoint doesn't exist" (which risked silent data loss).
  • partitionLocalRefs: a transient/IO error looking up a ref keeps it as pushable (retried next pre-push) instead of dropping it from the queue as stale.

Pre-push policy (was: git-refs skipped the check the v1 path runs):

  • prePushCheckpointRefs now calls syncCheckpointPolicyForPrePush first; a diverged or unsupported-format checkpoint policy skips the ref push (leaving refs queued), matching the v1 branch path. Policy governs checkpoint format compatibility, which is independent of the storage backend.

Updates the fetch-failure test to assert the corrected contract (error propagates; genuine absence still reads as not-found).

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

Checkpoints

Build Checkpoints Store Based on Design

Claude CodeOpus 4.8
View session
Checkpoint 1