fix(startup): wire AppStartupInitializer into onCreate (E01.S07)#9
Open
abdout wants to merge 1 commit into
Open
fix(startup): wire AppStartupInitializer into onCreate (E01.S07)#9abdout wants to merge 1 commit into
abdout wants to merge 1 commit into
Conversation
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>
This was referenced May 25, 2026
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
AppStartupInitializer.initialize()instead of being scattered inHogwartsApplication.onCreateDebugTreein debug, in-fileCrashlyticsTreein release that forwards WARN+ to Crashlytics breadcrumbs and ERROR+ as non-fatal exceptions// Why:commentStory
E01.S07 (Phase 1 Pilot v1, Sprint P1, 2 pts).
Test plan
./gradlew :app:assembleDebugsucceeds (validates Hilt graph still composes with the new@Injectfield)AppStartupInitializer completeafterTimber planted (debug=true),WorkManager initialized: ..., and eitherFirebase initialized: project=...orFirebase not initialized: ...(depending on whether E01.S01 has landed)google-services.json(Firebase confirmation is try/catch)Coexistence with sibling PRs
Closes #8
Generated with Claude Code