Conversation
Sajjon
commented
Feb 22, 2026
- dont error on missing data, instead hint that you should run klirr data init
- Add Versioning of data, add CTA for when user lack data directory.
There was a problem hiding this comment.
Pull request overview
This PR adds data schema versioning to support future migrations and improves user experience by providing helpful hints when data is missing or needs migration, rather than showing cryptic errors.
Changes:
- Introduced Version enum (V0 for testing, V1 for production) with automatic version tracking in data files
- Added user-friendly error messages that guide users to run
klirr data initwhen setup is missing - Implemented migration guide system with embedded documentation for version transitions
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/migration/v0.md | Documents that V0 is test-only and not used by end users |
| docs/migration/v1.md | Provides migration instructions from V0 to V1 |
| crates/core-invoice/src/models/error.rs | Adds MissingDataVersionFile and DataVersionMismatch error variants with helper functions and tests |
| crates/core-invoice/src/models/data/data.rs | Introduces Version enum with V0 and V1 variants, adds version field to Data struct with validation |
| crates/core-invoice/src/logic/read_write_data/read_data_from_disk.rs | Implements version file persistence, auto-migration for missing version files, and version validation during data loading |
| crates/cli/src/run.rs | Adds migration guide system with embedded documentation, improved error handling with helpful hints for missing setup or version mismatches |
| crates/cli/src/dispatch_command.rs | Updates validate_data command to handle missing data directory gracefully and suppress migration-related error logs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crates/core-invoice/src/logic/read_write_data/read_data_from_disk.rs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ve dead MissingDataVersionFile, require explicit migration Co-authored-by: Sajjon <864410+Sajjon@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #36 +/- ##
==========================================
+ Coverage 95.03% 95.06% +0.02%
==========================================
Files 101 101
Lines 2176 2208 +32
==========================================
+ Hits 2068 2099 +31
- Misses 108 109 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.