feat(logging): auth/lock -> AppLog + breadcrumbs (#326) #340

Merged
JMR-dev merged 8 commits from feat-326-logging-authlock into main 2026-07-05 04:16:23 +00:00
JMR-dev commented 2026-07-05 02:27:59 +00:00 (Migrated from github.com)

Summary

  • Migrates AppLockViewModel's 9 raw Log.w sites and AccountSetupViewModel's 1 raw Log.d site onto the AppLog seam (#325), so these diagnostic lines land in the RingLogBuffer and reach a submitted DebugReport instead of only Logcat.
  • Adds 3 new breadcrumbs that were previously silent: AppLockViewModel.onAuthenticated's auth-seal-unlocked success, clearCacheAndRestart's clear+restart trigger (with the disableAppLock flag), and every onForeground LockAction decision. AccountSetupViewModel's success path now also logs "Outlook account added" (no email).
  • No PII: none of these call sites ever carry an email/host/credential; where a throwable is attached, AppLog's StackTraceScrubber redacts it before the buffer records it.
  • Rewrites both ViewModel test suites to install a real RingLogBuffer and assert against it instead of verify { Log... }, including dedicated no-PII assertions (a known test email never appears in a recorded buffer line).

Note for the guard-rule ticket (#331)

Both test files keep a minimal mockkStatic(Log::class) stub in their shared setUp (stubbing every level, unused for verification) — AppLog still forwards to the real android.util.Log internally, which throws "not mocked" in JVM unit tests if left unstubbed. The not-yet-landed "forbid android.util.Log outside AppLog.kt" guard rule will need to reconcile that with test sources that legitimately need to stub Log this way (mirroring how AppLogTest/AppLogUninstalledTest already do it for the facade itself).

Test plan

  • :app:testDebugUnitTest — full suite green (1095 tests, 0 failures/errors), including the rewritten AppLockViewModelTest (25 tests) and AccountSetupViewModelTest (13 tests).
  • :app:compileDebugAndroidTestKotlin — green.
  • :app:ktlintCheck — green.
  • :app:detekt — green (0 findings).

Closes #326
Part of #324

🤖 Generated with Claude Code

## Summary - Migrates `AppLockViewModel`'s 9 raw `Log.w` sites and `AccountSetupViewModel`'s 1 raw `Log.d` site onto the `AppLog` seam (#325), so these diagnostic lines land in the `RingLogBuffer` and reach a submitted `DebugReport` instead of only Logcat. - Adds 3 new breadcrumbs that were previously silent: `AppLockViewModel.onAuthenticated`'s auth-seal-unlocked success, `clearCacheAndRestart`'s clear+restart trigger (with the `disableAppLock` flag), and every `onForeground` `LockAction` decision. `AccountSetupViewModel`'s success path now also logs "Outlook account added" (no email). - No PII: none of these call sites ever carry an email/host/credential; where a throwable is attached, `AppLog`'s `StackTraceScrubber` redacts it before the buffer records it. - Rewrites both ViewModel test suites to install a real `RingLogBuffer` and assert against it instead of `verify { Log... }`, including dedicated no-PII assertions (a known test email never appears in a recorded buffer line). ## Note for the guard-rule ticket (#331) Both test files keep a minimal `mockkStatic(Log::class)` stub in their shared `setUp` (stubbing every level, unused for verification) — `AppLog` still forwards to the real `android.util.Log` internally, which throws "not mocked" in JVM unit tests if left unstubbed. The not-yet-landed "forbid `android.util.Log` outside `AppLog.kt`" guard rule will need to reconcile that with test sources that legitimately need to stub `Log` this way (mirroring how `AppLogTest`/`AppLogUninstalledTest` already do it for the facade itself). ## Test plan - [x] `:app:testDebugUnitTest` — full suite green (1095 tests, 0 failures/errors), including the rewritten `AppLockViewModelTest` (25 tests) and `AccountSetupViewModelTest` (13 tests). - [x] `:app:compileDebugAndroidTestKotlin` — green. - [x] `:app:ktlintCheck` — green. - [x] `:app:detekt` — green (0 findings). Closes #326 Part of #324 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.