feat: implement optimized Undo for delete and move actions

- Added UndoService with 10-action history stack.
- Integrated Undo Snackbar into EmailListScreen and EmailDetailScreen.
- Added EmailRepository.cancelPendingChange to optimize undo by removing
  unsynced local mutations.
- Fixed sorting bug in compareMailboxes for unknown roles.
- Increased unit coverage to 83% with new model and utility tests.
- Verified with full test suite (task check).
This commit is contained in:
Thomas Güttler
2026-05-08 11:14:54 +02:00
parent 1a4571f016
commit 43e1744614
25 changed files with 1487 additions and 21 deletions
+49 -6
View File
@@ -20,11 +20,54 @@ Then push
## Tasks
### 1. Implement Undo for Delete and Move actions
### 1. Infrastructure Hardening and Code Quality
Provide a way for users to undo accidental deletions or moves, improving the safety of the application.
Continue the momentum from the safety hardening and infrastructure work.
The focus is on making the app ready for real-world use with robust error
handling and performance optimizations.
- **Infrastructure**: Implement a `ChangeLog` or similar mechanism to track the last N destructive actions.
- **UI**: Display a snackbar with an "Undo" button after a delete or move action.
- **Logic**: Implement the reverse operation (moving back from Trash or to the source folder) when Undo is pressed.
- **Sync**: Ensure that undo operations correctly interact with the `pending_changes` queue.
- **Sync Reliability**: Implement a "Sync reliability" check that compares local
counts with server counts periodically.
- **Search Optimization**: Add a "Recent Searches" history and optimize local search
indexing for large accounts.
- **UI Polishing**: Ensure consistent spacing and theming across all screens.
- **Error Boundaries**: Add more granular error boundaries to prevent the entire
app from crashing if a single widget fails.
### 2. Unified Attachment Handling and Improved Previews
Refactor attachment logic to be more consistent and provide better user feedback.
- **Previews**: Implement thumbnail generation for image attachments.
- **Progress**: Show download progress in the UI when fetching attachments.
- **Caching**: Implement a more robust caching mechanism with expiry.
### 3. Sync Reliability and Conflict Resolution
- **Reliability**: Implement a "Reliability Runner" that periodically verifies local state against the server.
- **Conflicts**: Improve handling of concurrent changes (e.g., mail moved on server while local move is pending).
### 4. Advanced Search and Performance
- **Indexing**: Optimize database indexes for search performance.
- **UI**: Add advanced search filters (date range, attachment size, etc.).
### 5. Multi-account Sync and Reliability Runner
Implement a robust verification system to ensure the local database accurately
reflects the server state across multiple accounts and protocols.
- **Reliability Runner**: A background service that periodically fetches a "ground truth"
snapshot (UIDs/IDs only) for all folders and identifies discrepancies.
- **Sync Reliability UI**: Add a "Sync health" indicator in settings showing when each
account was last verified 100%.
- **Network Resilience**: Improve backoff and retry logic for intermittent connections,
especially for mobile.
- **Fuzz Testing**: Add a basic fuzz test for the sync engine to handle simulated
real-world network latency and RFC edge cases.
### 6. Coverage Gate Maintenance
Reduce the `_excluded` list in `scripts/check_coverage.dart`.
Add a test to ensure the exclusion list doesn't contain files that no longer
exist ("ghost paths").