feat(history): retain usage and recover Claude records - #97
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (30)
📝 WalkthroughWalkthroughThe change adds durable SQLite usage history, stable event identity, historical daily aggregates, and Claude usage recovery from logs and backups. It adds recovery controls in Settings, a command-line entry point, localized strings, bundled scripts, documentation, and executable test coverage. ChangesUsage history capture and aggregation
Claude usage recovery
Distribution and support
Estimated code review effort: 5 (Critical) | ~90 minutes Sequence Diagram(s)sequenceDiagram
participant Settings
participant ClaudeRecoveryModel
participant ClaudeUsageRecovery
participant UsageLedger
Settings->>ClaudeRecoveryModel: start scan
ClaudeRecoveryModel->>ClaudeUsageRecovery: prepare recovery preview
ClaudeUsageRecovery->>UsageLedger: simulate against saved history
UsageLedger-->>ClaudeUsageRecovery: return preview snapshot
ClaudeUsageRecovery-->>ClaudeRecoveryModel: return preview or error
Settings->>ClaudeRecoveryModel: save preview
ClaudeRecoveryModel->>ClaudeUsageRecovery: apply recovery
ClaudeUsageRecovery->>UsageLedger: create backup and save records
UsageLedger-->>ClaudeRecoveryModel: return outcome
ClaudeRecoveryModel-->>Settings: refresh usage and show result
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Usage captured from local provider logs now remains available after those logs are removed. A local SQLite archive preserves per-day records, deduplicates repeated scans, retains long-term totals, and lets the app rebuild recent usage without depending on the original session files.
Settings now offers Claude usage recovery with a read-only preview, explicit timezone selection for older daily snapshots, and a backup before an atomic import. The same flow is available through the bundled recovery command. Recovery uses saved counters only, excludes unsupported records, and does not access login credentials or message text.
Validation: the full repository test runner passes, including 47 archive checks, 45 recovery checks, and 20 recovery UI-state checks. The production app builds for Intel and Apple Silicon; bundle metadata, Sparkle configuration, and deep code-signature verification pass. The packaged recovery command's help works, and the recovery flow was also exercised in the native Settings UI during development.
GitHub security scan passes. The optional Claude review did not execute because its CI account returned HTTP 403 (
oauth_org_not_allowed); it produced no review findings. Manual source review and the local validation above completed before merge.Summary by CodeRabbit
New Features
Bug Fixes
Documentation