Skip to content

Refactor CheckpointKind API and improve attribution/storage performance#1030

Open
jwiegley wants to merge 2 commits intojohnw/review-harden-daemonfrom
johnw/review-refactor-api
Open

Refactor CheckpointKind API and improve attribution/storage performance#1030
jwiegley wants to merge 2 commits intojohnw/review-harden-daemonfrom
johnw/review-refactor-api

Conversation

@jwiegley
Copy link
Copy Markdown
Collaborator

@jwiegley jwiegley commented Apr 9, 2026

API cleanup:

  • Rename CheckpointKind::to_str() -> as_str() returning &'static str
    instead of allocating a new String on each call
  • Default unknown checkpoint kinds to Human instead of panicking

Performance:

  • Use sweep-line algorithm for attribute_unattributed_ranges: O(n log n)
    sort + O(n) scan instead of O(n*m) per-character coverage check
  • Compute line metadata once and pass through to compute_diffs and
    detect_moves instead of redundant recomputation
  • Use true JSONL append for checkpoints instead of read-modify-write
  • Skip hash migration on already-migrated working logs via marker file
  • Unify canonical_workdir handling across platforms
  • Read checkpoints once to derive both tracked files and
    has_ai_checkpoints flag
  • Use HashSet for O(1) ref-change dedup instead of linear scans
  • Single-scan get_or_create_file in AuthorshipLog
  • Defer args allocation to the error path in exec_git_with_profile

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Copy link
Copy Markdown
Collaborator Author

jwiegley commented Apr 9, 2026

devin-ai-integration[bot]

This comment was marked as resolved.

@jwiegley jwiegley force-pushed the johnw/review-refactor-api branch from 22ea859 to 3ba0e3d Compare April 15, 2026 22:33
@jwiegley jwiegley force-pushed the johnw/review-harden-daemon branch 2 times, most recently from 499b585 to 2925d12 Compare April 16, 2026 06:41
@jwiegley jwiegley force-pushed the johnw/review-refactor-api branch 2 times, most recently from e6fc162 to e70d3b2 Compare April 16, 2026 06:48
After the append_checkpoint change to pure O(1) JSONL append, the
ongoing pruning of char-level attributions was lost — it only ran
during the one-time migration. Add pruning to mutate_all_checkpoints
which already does a full read-modify-write cycle via post-commit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jwiegley jwiegley force-pushed the johnw/review-harden-daemon branch from 5d6eb94 to 474106c Compare April 16, 2026 20:15
@jwiegley jwiegley force-pushed the johnw/review-refactor-api branch from e70d3b2 to 0d06c80 Compare April 16, 2026 20:15
devin-ai-integration[bot]

This comment was marked as resolved.

Remove the accidentally committed lock file containing session-specific
data (session ID, PID, timestamp) and add .claude/*.lock to .gitignore
to prevent future accidental commits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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