Skip to content

feat: Persistent checkpoint & session history (Issue #72)#95

Merged
hellodk merged 2 commits into
masterfrom
feat/issue-72-persistent-checkpoints
Jul 16, 2026
Merged

feat: Persistent checkpoint & session history (Issue #72)#95
hellodk merged 2 commits into
masterfrom
feat/issue-72-persistent-checkpoints

Conversation

@hellodk

@hellodk hellodk commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

Implements persistent checkpoint and session history restoration across extension restarts.

  • Checkpoints are now serialized to disk under .champ/checkpoints/
  • Checkpoints are automatically loaded from disk on extension initialization
  • Checkpoint state survives extension restarts
  • All file snapshots (including binary files) are persisted as base64-encoded JSON
  • Corrupted checkpoint files are gracefully skipped

Implementation Details

New Files

  • src/checkpoints/checkpoint-store.ts: Filesystem persistence layer for checkpoints
  • test/unit/checkpoints/checkpoint-store.test.ts: Comprehensive tests for checkpoint storage

Modified Files

  • src/checkpoints/checkpoint-manager.ts: Added persistence integration

    • Constructor accepts optional storagePath parameter
    • Async loadFromDisk() on initialization
    • Auto-save on checkpoint creation
    • Auto-delete when restoring to earlier checkpoint
    • Public waitForLoad() method for testing/synchronization
  • src/extension.ts: Initialize CheckpointManager with storage path

  • test/unit/checkpoints/checkpoint-manager.test.ts: Added 6 persistence tests

Test Results

  • ✅ All 18 checkpoint tests pass (9 store + 6 manager + 3 new manager)
  • ✅ Full test suite: 1283 tests pass (154 test files)
  • ✅ No breaking changes to existing functionality
  • ✅ Backward compatible: storage is optional

Acceptance Criteria

  • Checkpoints persist to disk under .champ/checkpoints/
  • Checkpoints are loaded on extension initialization
  • Checkpoint restoration works after restart
  • Corrupted files are handled gracefully
  • Binary files (Uint8Array) are properly serialized/deserialized
  • No breaking changes to CheckpointManager API
  • Full test coverage for persistence

Testing

Run checkpoint tests:

npm test -- checkpoint

Run full test suite:

npm test

🤖 Generated with Claude Code

https://claude.ai/code/session_01DLSvxucbfqMjup96KyKVyE

hellodk and others added 2 commits July 17, 2026 00:03
Serialize checkpoints to disk and restore on extension restart.

### Changes
- Add CheckpointStore class: filesystem persistence for checkpoints
  - Saves checkpoints as JSON files under .champ/checkpoints/
  - Loads checkpoints on manager initialization
  - Handles Uint8Array serialization via base64 encoding
  - Gracefully skips corrupted files

- Update CheckpointManager with persistence:
  - Constructor accepts optional storagePath parameter
  - Load checkpoints from disk on initialization via async loadFromDisk()
  - Save checkpoints to disk when created
  - Delete checkpoints from disk when restored or cleared
  - Maintain backward compatibility: clear() remains synchronous

- Update extension.ts:
  - Initialize CheckpointManager with .champ/checkpoints storage path

### Testing
- TDD: 9 new tests for CheckpointStore persistence
- TDD: 6 new tests for CheckpointManager persistence
- All 1283 tests pass (including new tests)
- No breaking changes to existing functionality

### Acceptance Criteria
- Checkpoints persist across extension restarts ✓
- Checkpoint state is restored from disk on initialization ✓
- Checkpoints are serialized to human-readable JSON files ✓
- Corrupted checkpoint files are skipped gracefully ✓
- Storage path is configurable (defaults to .champ/checkpoints) ✓

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DLSvxucbfqMjup96KyKVyE
Resolves TypeScript noUnusedLocals error in PR #95 (Issue #64).
The 'path' module was imported but never used.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DLSvxucbfqMjup96KyKVyE
@hellodk
hellodk force-pushed the feat/issue-72-persistent-checkpoints branch from 49fe915 to eada476 Compare July 16, 2026 18:34
@hellodk
hellodk merged commit d444378 into master Jul 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant