feat(logging): sync-engine breadcrumbs via AppLog (#329) #341

Merged
JMR-dev merged 3 commits from feat-329-logging-sync into main 2026-07-05 02:51:26 +00:00
JMR-dev commented 2026-07-05 02:32:08 +00:00 (Migrated from github.com)

Summary

  • Adds net-new AppLog breadcrumbs to the previously-silent sync engine — MailSyncer (sync all/account/folder start, done, failure, per-folder fetch count), MailBackfiller (slice start/done, per-folder page count + completion), MailPruner (removed count), and the SyncWorker/BackfillWorker/PruneWorker cache-locked-deferral and success/retry outcomes (retry now carries the scrubbed failure throwable via the #325 AppLog.w(tag, msg, throwable) overload).
  • Adds a new logSafeFolderLabel() helper (data/sync/SyncLogging.kt) enforcing the ticket's folder-name caveat: only a fixed allowlist of known system folders (INBOX, Sent, Drafts, Trash, Spam/Junk, Archive, and common provider variants) is ever logged by name; every other folder — however nested or named — logs as a fixed placeholder.
  • Account attribution is always accountLogRef(account.id), never the raw id or email.
  • Updates the JVM unit tests exercising these now-logging classes (MailSyncerTest, MailBackfillerTest, MailPrunerTest, SyncWorkerTest, BackfillWorkerTest, PruneWorkerTest, plus MailSyncConcurrencyTest/MailMaintenanceGateTest, which construct real instances) to statically mock android.util.Log, mirroring the existing AppLogTest pattern — required because these classes were silent before, so no test needed the mock until now.
  • New breadcrumb assertions install a real RingLogBuffer and assert both the expected level/message/counts AND that no test fixture's email address or host ever appears in the buffer (the hard PII rule) — plus a dedicated SyncLoggingTest for the folder-label allowlist itself.

Closes #329
Part of #324

Test plan

  • :app:testDebugUnitTest — full suite green, including new/updated tests in data/sync
  • :app:compileDebugAndroidTestKotlin
  • :app:ktlintCheck
  • :app:detekt

🤖 Generated with Claude Code

## Summary - Adds net-new `AppLog` breadcrumbs to the previously-silent sync engine — `MailSyncer` (sync all/account/folder start, done, failure, per-folder fetch count), `MailBackfiller` (slice start/done, per-folder page count + completion), `MailPruner` (removed count), and the `SyncWorker`/`BackfillWorker`/`PruneWorker` cache-locked-deferral and success/retry outcomes (retry now carries the scrubbed failure throwable via the #325 `AppLog.w(tag, msg, throwable)` overload). - Adds a new `logSafeFolderLabel()` helper (`data/sync/SyncLogging.kt`) enforcing the ticket's folder-name caveat: only a fixed allowlist of known system folders (INBOX, Sent, Drafts, Trash, Spam/Junk, Archive, and common provider variants) is ever logged by name; every other folder — however nested or named — logs as a fixed placeholder. - Account attribution is always `accountLogRef(account.id)`, never the raw id or email. - Updates the JVM unit tests exercising these now-logging classes (`MailSyncerTest`, `MailBackfillerTest`, `MailPrunerTest`, `SyncWorkerTest`, `BackfillWorkerTest`, `PruneWorkerTest`, plus `MailSyncConcurrencyTest`/`MailMaintenanceGateTest`, which construct real instances) to statically mock `android.util.Log`, mirroring the existing `AppLogTest` pattern — required because these classes were silent before, so no test needed the mock until now. - New breadcrumb assertions install a real `RingLogBuffer` and assert both the expected level/message/counts AND that no test fixture's email address or host ever appears in the buffer (the hard PII rule) — plus a dedicated `SyncLoggingTest` for the folder-label allowlist itself. Closes #329 Part of #324 ## Test plan - [x] `:app:testDebugUnitTest` — full suite green, including new/updated tests in `data/sync` - [x] `:app:compileDebugAndroidTestKotlin` - [x] `:app:ktlintCheck` - [x] `:app:detekt` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.