checkpoint: route callers through domain stores · Entire

checkpoint: route callers through domain stores

887b239·

pfleidi·4w ago·25 files·+164 added/-200 removed

Move committed checkpoint callers to the split checkpoint and session store surface.

GitStore keeps the low-level v1 methods internally, but production callers now depend on ReadCheckpoint, ReadSession, WriteSession, UpdateSession, and UpdateCheckpoint.

Sessions

7319e37bab43View transcript

Changes

25

`` 336 unmodified lines

337 338 339 340 340 341 342 343 26 unmodified lines

370 371 372 373 373 374 375 376 377 378 379 377 378 379 380 381 381 382 383 384 385 385 386 387 388 389 84 unmodified lines

474 475 476 476 477 478 479 480 481 482 483 484

336 unmodified lines

writeOpts.HasReview = true }

if err := store.WriteCommitted(ctx, writeOpts); err != nil { if err := store.WriteSession(ctx, cpkg.SessionIDRef(checkpointID, sessionID), writeOpts); err != nil { return fmt.Errorf("failed to write checkpoint: %w", err) } }

26 unmodified lines

if err != nil { return false, err } summary, err := store.ReadCommitted(ctx, checkpointID) summary, err := store.ReadCheckpoint(ctx, checkpointID) if err != nil { if errors.Is(err, cpkg.ErrCheckpointNotFound) { return false, nil } return false, fmt.Errorf("read checkpoint summary: %w", err) } if summary == nil { return false, nil } for i := range summary.Sessions { metadata, err := store.ReadSessionMetadata(ctx, checkpointID, i) content, err := store.ReadSession(ctx, cpkg.SessionIndexRef(checkpointID, i), cpkg.WithSessionMetadataOnly()) if err != nil { return false, fmt.Errorf("read session %d metadata: %w", i, err) } if metadata != nil && metadata.SessionID == sessionID { metadata := content.Metadata if metadata.SessionID == sessionID { return true, nil } } } 84 unmodified lines

if err != nil { return false, err } summary, err := store.ReadCommitted(ctx, checkpointID) summary, err := store.ReadCheckpoint(ctx, checkpointID) if err != nil { if errors.Is(err, cpkg.ErrCheckpointNotFound) { return false, nil } return false, err //nolint:wrapcheck // Caller wraps with checkpoint ID context } return summary != nil, nil ``