Skip to content

fix(startup): wire AppStartupInitializer into onCreate (E01.S07)#9

Open
abdout wants to merge 1 commit into
mainfrom
feat/E01-S07-app-startup-initializer
Open

fix(startup): wire AppStartupInitializer into onCreate (E01.S07)#9
abdout wants to merge 1 commit into
mainfrom
feat/E01-S07-app-startup-initializer

Conversation

@abdout
Copy link
Copy Markdown
Contributor

@abdout abdout commented May 25, 2026

Summary

  • All boot hooks (Timber, StrictMode, WorkManager + Firebase init confirmation) now funnel through AppStartupInitializer.initialize() instead of being scattered in HogwartsApplication.onCreate
  • Adds Timber tree variants per build type — DebugTree in debug, in-file CrashlyticsTree in release that forwards WARN+ to Crashlytics breadcrumbs and ERROR+ as non-fatal exceptions
  • Confirms WorkManager + Firebase at boot (Firebase failure is logged not crashed — graceful coexistence with the pending E01.S01 google-services.json work)
  • Each registration carries a // Why: comment

Story

E01.S07 (Phase 1 Pilot v1, Sprint P1, 2 pts).

Test plan

  • ./gradlew :app:assembleDebug succeeds (validates Hilt graph still composes with the new @Inject field)
  • On a fresh launch, logcat shows AppStartupInitializer complete after Timber planted (debug=true), WorkManager initialized: ..., and either Firebase initialized: project=... or Firebase not initialized: ... (depending on whether E01.S01 has landed)
  • Debug build StrictMode penalty messages appear in logcat when a contrived main-thread disk read is added (smoke-test the policy is alive)
  • No release-build crash from missing google-services.json (Firebase confirmation is try/catch)

Coexistence with sibling PRs

Closes #8

Generated with Claude Code

The startup hooks (Timber tree planting, StrictMode setup) used to live
scattered across `HogwartsApplication.onCreate`, and the empty
`AppStartupInitializer` stub had no callers. WorkManager and Firebase
initialised silently; misconfiguration (e.g. missing
google-services.json from E01.S01) surfaced far from the cause.

Funnels all boot hooks through `AppStartupInitializer.initialize()`:

- Timber tree variants per build type — `DebugTree` in debug,
  `CrashlyticsTree` (private to the file) in release. The release tree
  forwards WARN+ to Crashlytics breadcrumbs and ERROR+ as non-fatal
  exceptions; below WARN is dropped so the breadcrumb retention stays
  focused on actionable signals.
- StrictMode in debug only (thread + VM policies, penaltyLog).
- WorkManager confirmation — calling `getInstance(context)` at boot
  forces lazy init and surfaces HiltWorkerFactory misconfiguration as
  a startup crash instead of a runtime no-op.
- Firebase confirmation — `FirebaseApp.getInstance()` wrapped so a
  missing `google-services.json` (E01.S01 still pending) logs a loud
  warning per launch instead of crashing the app or hiding inside the
  FCM token upload path.

Each registration carries a `// Why:` comment explaining its purpose.

`AppStartupInitializer` is now `@Inject`ed into `HogwartsApplication`
and called first inside `onCreate` (before locale warming + channel
creation) so its log lines bracket the rest of the boot sequence.

Closes #8

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(startup): wire AppStartupInitializer into onCreate (E01.S07)

1 participant