feat(undo): Wire up undo/redo feature for end users#17
feat(undo): Wire up undo/redo feature for end users#17github-actions[bot] merged 1 commit intomainfrom
Conversation
- Replace FileOrganizer with SafeFileOrganizer in AppState - Initialize UndoStack with 100 operation limit - Add canUndoLastMove/canRedoLastMove state tracking - Add undoLastMove() and redoLastMove() async methods - Add undo/redo buttons to footer with keyboard shortcuts (⌘Z, ⇧⌘Z) - All file operations now logged to movement_log database - Operations are undoable and tracked for transparency This wires up the existing SafeFileOrganizer/UndoStack/MovementLog infrastructure to the UI, making undo available to end users. Addresses spec.md sections 1.1, 3, 4.3, 6.3 regarding undo system.
|
Claude finished @gilmanb1's task —— View job PR Review: feat(undo): Wire up undo/redo feature for end usersTodo List
Review SummaryThis PR successfully wires up the existing undo infrastructure to the UI. The implementation is well-architected and follows Swift 6 concurrency best practices. I found no critical issues that would prevent merging. ✅ ApproveKey Strengths🟢 Excellent Swift 6 Concurrency Compliance
🟢 Memory Safety
🟢 Architecture Consistency
🟢 Test Coverage
Minor Suggestions🔵 Suggestion: Consider adding error recovery in func updateUndoState() async {
guard let undoStack = undoStack else {
// Reset state safely
canUndoLastMove = false
canRedoLastMove = false
undoableOperationsCount = 0
return
}
// Add do-catch for robustness
do {
canUndoLastMove = await undoStack.canUndo
canRedoLastMove = await undoStack.canRedo
undoableOperationsCount = await undoStack.undoCount
} catch {
NSLog("⚠️ Failed to update undo state: \(error)")
// Set safe defaults
canUndoLastMove = false
canRedoLastMove = false
undoableOperationsCount = 0
}
}🔵 Suggestion: The keyboard shortcuts (ContentView.swift:325, 336) are properly implemented but could benefit from accessibility labels: .help("Undo last file move (⌘Z)")
.accessibilityLabel("Undo last move")Technical AssessmentSwift 6 Compliance: ✅ Excellent
Memory Management: ✅ Clean
Error Handling: ✅ Robust
Integration: ✅ Seamless
Specification ComplianceThis PR addresses all requirements from
Final Recommendation: This is a clean, well-implemented feature that integrates smoothly with the existing codebase. The code quality is high and follows all established patterns. Ready to merge. |
Summary
Wires up the existing SafeFileOrganizer/UndoStack/MovementLog infrastructure to the UI, making undo available to end users.
Changes
AppState.swift
FileOrganizerwithSafeFileOrganizerfor file organizationUndoStackwith 100 operation limit on app startupcanUndoLastMove/canRedoLastMove/undoableOperationsCountstate trackingundoLastMove()andredoLastMove()async methodsupdateUndoState()helper to sync UI with undo stackContentView.swift
Addresses Spec Requirements
From
spec.md:Testing
Screenshots
N/A - functional UI addition with minimal visual change (small undo/redo icons in footer)
Migration Notes
None - This is an additive change. The
SafeFileOrganizeris now used instead ofFileOrganizer, but the fallback toFileOrganizeris preserved if the safe organizer fails to initialize.