Add logging and tracking for application password login#22709
Add logging and tracking for application password login#22709adalpari merged 18 commits intorelease/26.7from
Conversation
Add detailed field-level diagnostics to all error paths in the application password login flow so developers can identify the root cause from logs alone. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Log only the response class name instead of the full object, since WpRequestResult variants could contain sensitive API response data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The createApplicationPassword function exceeded the 60-line limit after adding detailed error logging. Extract a logCreationError helper to keep the method concise. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The new logging in the "site not found" branch reads siteStore.sites a second time to log available URLs. Update the test verification to expect two calls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fire APPLICATION_PASSWORD_STORING_FAILED Tracks event and a Sentry report whenever the credential storing flow fails, so we can monitor failure rates and reasons in production. Also replace available site URL logging with just a count to avoid PII exposure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… failures" This reverts commit 90319f7.
Replace the full list of available site URLs with just a count in the "site not found" error log, since site URLs may reveal personal domains or business names. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Surface detailed error messages when application password login fails, instead of showing a generic toast or silently crashing. Catches exceptions in SiteStore encryption/decryption paths and threads error details through to the UI toast. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Every error path in the login flow now sends a crash report via CrashLogging so we get visibility into failures in the wild. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…lures Re-applies the reverted changes from #22694 that add trackStoringFailed() calls with specific reason codes (empty_raw_data, empty_fetch_params, fetch_sites_exception, site_changed_failed, bad_data, site_not_found) and CrashLogging reports for better debugging. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…sertion, add tests - Show only user-friendly message in toast, keep detailed errors in logs/crash reports - Replace site!! with safe ?: return@launch - Fix import ordering (com.* before org.*) - Add TODO comments on broad catch blocks to narrow once root cause identified - Add CrashLogging mock and 5 new tests for error branches (SiteStore error, no rows affected, bad credentials, DB exception, crash report verification) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Split onSiteChanged into smaller focused methods to stay under the 60-line detekt limit: handleSiteChangedError, handleSiteChangedSuccess, validateSiteChanged, and logAndEmitSiteChangedError. Also remove TODO comments from SiteStore catch blocks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nd error message leaks - Remove crashLogging from ApplicationPasswordLoginHelper.trackStoringFailed so only the ViewModel's emitError sends Sentry reports with full context - Add trackStoringFailed and crashLogging.sendReportWithTag to the storeCredentials catch block so KeyStore failures are tracked - Replace technical error messages in NavigationActionData.errorMessage with opaque error codes (e.g. site_store_error, no_rows_affected) - Use e.message ?: e.javaClass.simpleName in SiteStore catch blocks as fallback for exceptions without a message Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add crashLogging.sendReportWithTag calls in storeApplicationPasswordCredentialsFrom for the bad_data and site_not_found paths, which return false without throwing. These are not duplicates of the ViewModel's emitError reports — they cover failures where execution continues to fetchSites and the ViewModel never calls emitError. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
TODO: Remove before merging. Uncomment the throw line to verify that the storeCredentials error path sends analytics and Sentry reports. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract logAndReportBadData and logAndReportSiteNotFound from storeApplicationPasswordCredentialsFrom to bring it under the 60-line detekt limit. Also extract reportStoringFailedToSentry to deduplicate Sentry exception construction. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Generated by 🚫 Danger |
|
|
|
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release/26.7 #22709 +/- ##
================================================
+ Coverage 37.74% 37.78% +0.03%
================================================
Files 2268 2268
Lines 117578 117681 +103
Branches 16281 16298 +17
================================================
+ Hits 44376 44461 +85
- Misses 69565 69574 +9
- Partials 3637 3646 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@adalpari I don't know if this indicates a problem, but logging into my self-hosted test site caused this to appear in logcat: Login worked fine, though. |
|
@adalpari I simulated a login failure and logcat showed this: This is great, but the error message didn't say anything about the cause of the problem:
I'm not sure we can do much about this but wanted to raise the issue. |
nbradbury
left a comment
There was a problem hiding this comment.
This looks good! I left one comment which you may or may not want to address, but either way I'll approve it ![]()
Well, I think it actually says something: the site has not been saved to the DB in the previous step. so It's "not found". |






Description
Cherry-picks from #22694 and #22702 into
release/26.7.Adds comprehensive logging, analytics tracking, and crash reporting for the
application password login flow:
storing, avoiding PII exposure (site URLs) and full response object leaks
failures with error context
false-return paths
non-null assertions fixed
detekt LongMethod violations
Files changed
ApplicationPasswordLoginViewModel.kt— error handling, Sentry/Tracksintegration, refactored
onSiteChangedApplicationPasswordLoginHelper.kt— Sentry reports on storeCredentialsfailures, refactored for detekt
ApplicationPasswordAutoAuthDialogViewModel.kt— PII-safe loggingSiteStore.kt— logging improvementsTesting instructions
NOTE: MORE IMPORTANT THAN THE LOGS IS THE LOGIN FLOW IS NOT BROKEN, SO PLEASE PAY ATTENTION TO THAT
Application password login success:
Application password login failure: