# Plan Log

## 2026-05-10
- Improved Undo Log (Issue #7): Added support for undoing any action from history.
- Refactored `UndoService.undo()` to support targeted rollbacks by action ID.
- Removed "latest only" restriction from `UndoLogScreen`.
- Successfully deployed release APK to distribution server via `task deploy-android`.
- Verified system integrity with unit, widget, and E2E integration tests.

## 2026-05-10
- Implemented global Undo Log with persistent history.
- Refactored `UndoService` to store a list of recent actions instead of just the latest one.
- Added `UndoLogScreen` to view and interact with undo history.
- Added "History" icon to account list for better discoverability.
- Updated `.gitignore` to better handle Dart/Flutter and Android tool artifacts.
- Verified all changes with fast check suite (analyze + unit + widget tests).

## 2026-05-09
- Fixed Crash Page (Issue 3): Added Codeberg reporting button.
- Fixed Show Mail Headers (Issue 1): Added raw header storage and UI display.
- Fixed Exception on Undo of delete (Issue 2): Added serialization to EmailAddress.
- Updated Taskfile with Nix experimental features check.
- Pushed all changes to branch `fix-issues`.

## 2026-05-09
- Fixed Undo feature for IMAP accounts.
- Identified that IMAP moveEmail hard-deletes local rows, making Undo impossible without data.
- Added `originalEmails` to `UndoAction` and `restoreEmails` to `EmailRepository`.
- Updated UI to fetch email data before move/delete to support restoration.
- Fixed `UndoService` to restore rows and be more robust with pending change cancellation.
- Verified with `test/unit/undo_reproduction_test.dart` and updated unit tests.
- Successfully deployed to Android.

## 2026-05-09
- Implemented Network Resilience (Task 1/4 from next.md).
- Added exponential backoff logic (5s to 15m) to IMAP and JMAP sync loops.
- Added permanent error detection (auth/credentials) to stop sync loops gracefully.
- Improved "Pull to Refresh" in email list to trigger full account sync and bypass backoff.
- Verified with integration tests.

- Started work on Sync Reliability (Task 1/5 from next.md).
- Added `verifySyncReliability` to `EmailRepository` interface and models.
- Implemented `verifySyncReliability` in `EmailRepositoryImpl` for IMAP and JMAP.
- Added `SyncHealth` table to database (Schema v19).
- Created `ReliabilityRunner` for periodic verification.
- Integrated sync health indicators in `AccountListScreen` UI.
- Added manual "Verify sync health" action.
- Verified with new integration tests in `test/integration/sync_reliability_test.dart`.
- All integration tests (IMAP and JMAP) passing.
- Fixed several compilation and analysis issues.
