Update task task-38
This commit is contained in:
@@ -28,3 +28,35 @@ Move the complex blob_file:migrate_blob_entries rake task logic into a proper Ru
|
||||
## Implementation Plan
|
||||
|
||||
1. Analyze differences between existing migrate_blob_entries rake task and parallel version\n2. Create new BlobFileMigrator class under app/lib/domain/blob_file/\n3. Extract inline methods from rake task into properly typed class methods\n4. Add dependency injection for testing (database models, file operations, logging)\n5. Implement progress tracking and profiling capabilities\n6. Add comprehensive error handling and logging\n7. Write thorough specs covering all scenarios\n8. Update rake task to use new class while maintaining CLI interface\n9. Ensure performance characteristics are maintained or improved
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
Successfully refactored the blob_file:migrate_blob_entries rake task into a properly typed Tasks::BlobFileMigrationTask class.
|
||||
|
||||
**Implementation Approach:**
|
||||
- Created Tasks::BlobFileMigrationTask class under lib/tasks/ with full Sorbet type annotations
|
||||
- Extracted all inline methods from the original rake task into class methods
|
||||
- Added dependency injection for log_sink, profiler, file_utils, and number_helper for testability
|
||||
- Maintained all original functionality including profiling, progress logging, and error handling
|
||||
- Updated rake task to use the new class while preserving the same CLI interface
|
||||
|
||||
**Features Implemented:**
|
||||
- Complete migration logic with batch processing
|
||||
- Progress tracking with formatted output
|
||||
- Error handling for individual blob file saves and transaction failures
|
||||
- Profiling support with multiple output formats (txt, html, rubyprof)
|
||||
- Thread support for parallel processing
|
||||
- Resumable migration from specific SHA256 start points
|
||||
|
||||
**Technical Decisions:**
|
||||
- Used T.untyped for last_sha256 parameter to work around Sorbet type inference issues
|
||||
- Removed HexUtil injection in favor of direct class usage for simplicity
|
||||
- Preserved all original CLI environment variables (batch_size, profile, start_at, num_threads)
|
||||
- Added comprehensive specs covering all scenarios including edge cases and error handling
|
||||
|
||||
**Files Modified:**
|
||||
- lib/tasks/blob_file_migration_task.rb (new class)
|
||||
- spec/lib/tasks/blob_file_migration_task_spec.rb (comprehensive specs)
|
||||
- rake/blob_file.rake (updated to use new class)
|
||||
|
||||
The refactoring significantly improves code maintainability by moving complex logic into a testable class structure while maintaining backward compatibility with existing usage patterns.
|
||||
|
||||
Reference in New Issue
Block a user