feat(reporting): purge crash/problem reports older than a month while charging #242

Merged
JMR-dev merged 12 commits from feat-239-purge-old-reports into main 2026-07-03 22:38:27 +00:00
JMR-dev commented 2026-07-03 17:27:29 +00:00 (Migrated from github.com)

Auto-purges locally-stored crash/problem reports older than 1 month, while the device is charging, so debug records don't accumulate on-device (issue #239).

Change

  • ReportPurgeWorker (@HiltWorker) deletes reports older than 30 days via new ReportStore.purgeOlderThan(cutoffMillis). ReportStore is file-backed (no DB) → the worker needs no cache-lock gate.
  • Scheduled as a periodic WorkManager job with setRequiresCharging(true) (SyncScheduler.schedulePeriodicReportPurge, enqueued at startup with sync/backfill/prune). Battery-safe, no network.
  • Disclosure (per request): the problem-reports list and the submission review screen both show "Reports are automatically deleted from this device after 1 month."

Tests

  • ReportStoreTest: purgeOlderThan deletes strictly-older reports, keeps the one exactly at the cutoff.
  • ReportPurgeWorkerTest: computes a ~30-day cutoff; retries on failure.
  • Preflight green (build, unit tests, androidTest compile, lint, ktlint, detekt).

Closes #239

🤖 Generated with Claude Code

Auto-purges locally-stored crash/problem reports older than **1 month**, while the device is **charging**, so debug records don't accumulate on-device (issue #239). ## Change - **`ReportPurgeWorker`** (`@HiltWorker`) deletes reports older than 30 days via new **`ReportStore.purgeOlderThan(cutoffMillis)`**. `ReportStore` is file-backed (no DB) → the worker needs no cache-lock gate. - Scheduled as a **periodic WorkManager job with `setRequiresCharging(true)`** (`SyncScheduler.schedulePeriodicReportPurge`, enqueued at startup with sync/backfill/prune). Battery-safe, no network. - **Disclosure** (per request): the problem-reports **list** and the submission **review** screen both show "Reports are automatically deleted from this device after 1 month." ## Tests - `ReportStoreTest`: `purgeOlderThan` deletes strictly-older reports, keeps the one exactly at the cutoff. - `ReportPurgeWorkerTest`: computes a ~30-day cutoff; retries on failure. - Preflight green (build, unit tests, androidTest compile, lint, ktlint, detekt). Closes #239 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.