mirror of
https://github.com/beshu-tech/deltaglider.git
synced 2026-03-18 15:33:42 +01:00
This commit addresses the issue where reference.bin files were left orphaned in S3 buckets after recursive deletions. The fix ensures proper cleanup while preventing deletion of references that are still needed by other delta files. ## Changes **Core Service Layer (core/service.py)**: - Enhanced delete_recursive() method with intelligent reference dependency checking - Added discovery of affected deltaspaces when deleting delta files - Implemented smart reference cleanup that only deletes references when safe - Added comprehensive error handling and detailed result reporting **CLI Layer (app/cli/main.py)**: - Updated recursive delete to use the core service delete_recursive() method - Improved error reporting and user feedback for reference file decisions - Maintained existing dryrun functionality while delegating to core service **Testing**: - Added comprehensive test suite covering edge cases and error scenarios - Tests validate reference cleanup intelligence and error resilience - Verified both CLI and programmatic API functionality ## Key Features - **Intelligent Reference Management**: Only deletes reference.bin files when no other delta files depend on them - **Cross-Scope Protection**: Prevents deletion of references needed by files outside the deletion scope - **Comprehensive Reporting**: Returns structured results with detailed categorization and warnings - **Error Resilience**: Individual deletion failures don't break the entire operation - **Backward Compatibility**: Maintains all existing CLI behavior and API contracts ## Fixes - Resolves orphaned reference.bin files after 'deltaglider rm -r' operations - Works for both CLI usage and programmatic SDK API calls - Handles complex deltaspace hierarchies and shared references correctly 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>