CLI Commands for State Management (#573)#577
CLI Commands for State Management (#573)#577anjor wants to merge 21 commits intodata-preservation-programs:developfrom
Conversation
…ion-programs#572 Enhanced DealTracker and StateTracker integration with comprehensive on-chain event handling: **StateTracker Enhancements:** - Added enhanced metadata tracking with error categorization - Improved error handling with specific error categories (network, provider, client, chain, etc.) - Extended metadata fields for comprehensive deal tracking - Added helper functions for error categorization and metadata creation - Implemented TrackStateChangeWithError for better error tracking **DealTracker Enhancements:** - Enhanced state change tracking with detailed metadata for all deal transitions - Added special handling for critical deal events (slashed, expired, activated) - Improved logging for deal state transitions with contextual information - Enhanced expiration handling for both active deals and proposals - Better tracking of external deal discovery with comprehensive metadata **Special Handling for Critical Events:** - Deal slashing: Enhanced logging and metadata with slashing epoch details - Deal expiration: Detailed tracking of natural expiration with epoch information - Proposal expiration: Comprehensive handling of unactivated proposals - Deal activation: Proper tracking with sector start epoch information **Comprehensive Testing:** - Added 296+ lines of new unit and integration tests - Enhanced test coverage for error categorization and metadata creation - Integration tests for slashed deal detection and handling - Tests for external deal discovery with enhanced metadata - Comprehensive expiration testing for deals and proposals **Key Features:** - Error categorization system for better analytics and debugging - Enhanced metadata collection including piece size, verified status, pricing - Improved recovery mechanisms for missing state changes - Better performance monitoring and error tracking - Comprehensive logging for all deal lifecycle events All tests pass and the implementation maintains backward compatibility while significantly enhancing the deal tracking capabilities.
- Add comprehensive CLI commands: singularity state list/get/stats/repair - Implement CSV/JSON export functionality with timestamps - Add manual recovery/repair operations with dry-run mode - Support filtering by deal ID, state, provider, client, and time range - Add comprehensive unit and integration tests - Include complete documentation and user guide - Implement safety features with audit logging for all operations Addresses data-preservation-programs#573
- Resolved conflict in service/statetracker/statetracker.go by keeping the cleaned up struct definition with basic fields properly organized under their respective comment sections - Removed the PieceCID mapping logic to match develop branch - Maintained the proper struct organization without duplicate fields
…larity into feature/cli-state-management
The mapping logic from PieceCID to ProposalID was lost during the recent merge with origin/develop. This fixes the TestCreateErrorMetadata test failure by restoring the compatibility mapping that was implemented in commit b640cb2. - Add mapping from PieceCID to ProposalID when ProposalID is empty - Add mapping from PieceCID to PublishCID for test compatibility - Fixes TestCreateErrorMetadata test failure
|
@anjor — I'll review it first thing in the morning. I got sidetracked with some UI deployment work. |
Sankara-Jefferson
left a comment
There was a problem hiding this comment.
Can we consider moving the state command (and its subcommands) under the existing deal command group?
singularity deal state list
singularity deal state get <deal-id>
singularity deal state repair ...
|
@Sankara-Jefferson is this what you had in mind? |
|
I can no longer see it: |
|
@Sankara-Jefferson it's under deal now as you suggested. |
|
@anjor yes, that works for me. It looks better. Thei is ready for merging, @ianconsolata. |
ianconsolata
left a comment
There was a problem hiding this comment.
LGTM, only one minor change, and some questions. @lanzafame Can you do another review and let us know if @anjor has addressed all your concerns?
|
@ianconsolata please let me know if you want me to rebase this on main, I would probably actually still close this and redo in smaller chunks |
Summary
singularity state list/get/stats/repairChanges
singularity stateTest Plan
Resolves #573