chore(tracker): log WorkManager stop reasons and persistence errors#224
Draft
adsamcik wants to merge 1 commit into
Draft
chore(tracker): log WorkManager stop reasons and persistence errors#224adsamcik wants to merge 1 commit into
adsamcik wants to merge 1 commit into
Conversation
- DailySummaryMaterializationWorker: log getStopReason() on cancellation so Android 16 job-quota throttling (jobs now count against quota even while an FGS runs) and other system stops are diagnosable; cancellation still propagates so WorkManager can reschedule. - PersistenceProcessor: route DB flush failures to the redacting crash Reporter in addition to logcat. The structured errorCollector flow is exposed via the controller but currently observed only by optional UI, so failures were not reaching diagnostics. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Observability follow-ups from the tracking-architecture review (P1/P3). Two small, additive, low-risk changes in
:tracker:engine.1. WorkManager stop-reason logging (Android 16 quota)
DailySummaryMaterializationWorker.doWork()now catchesCancellationExceptionand logsgetStopReason()before re-throwing. Android 16 (API 36) made JobScheduler/WorkManager jobs count against the app's standby-bucket quota even while a foreground service is running, so this worker can now be throttled. Logging the stop reason makes quota-related stops diagnosable (STOP_REASON_QUOTA,STOP_REASON_CONSTRAINT_*, etc.). Cancellation still propagates so WorkManager reschedules as before — success/failure semantics are unchanged.2. Route persistence errors to the crash reporter
PersistenceProcessor.flushTable()already logged DB flush failures to logcat (Log.w) and to a structuredPersistenceErrorCollectorflow — but that flow is exposed via the controller and consumed by no production code (only tests). It now also callsReporter.report(e), so persistence failures reach the redacting crash reporter and become visible in diagnostics.Verification
./gradlew :tracker:engine:compileDebugKotlin— BUILD SUCCESSFUL.Reporteris safe to call before init (no-ops), so existing unit tests are unaffected.2.11.1supportsgetStopReason()(added 2.9.0).Notes
Draft — opened for review. Broader
getStopReason()logging in the other app workers (DatabaseMaintenanceWorker,GoalNotificationWorker, retention) is intentionally out of scope to keep this PR within one module.