Skip to content

fix(firebase): gate google-services.json behind committed template (E01.S01)#11

Open
abdout wants to merge 1 commit into
mainfrom
feat/E01-S01-google-services-gate
Open

fix(firebase): gate google-services.json behind committed template (E01.S01)#11
abdout wants to merge 1 commit into
mainfrom
feat/E01-S01-google-services-gate

Conversation

@abdout
Copy link
Copy Markdown
Contributor

@abdout abdout commented May 25, 2026

Summary

  • Commits app/google-services.json.template with structurally valid stub values that pass AGP's parser; real Firebase config stays gitignored
  • Adds a configuration-time hook in app/build.gradle.kts that materialises app/google-services.json from either -Pfirebase.config.path=/abs/path or the template
  • README documents both supply paths under "Firebase setup"

Story

E01.S01 (Phase 1 Pilot v1, Sprint P1, 2 pts) — clears blocker #5 from epic-prod-overview.md's "10 silent stubs" list.

Test plan

  • Fresh checkout (no app/google-services.json present) → ./gradlew :app:processDebugGoogleServices succeeds; logger.warn prints the template-fallback message
  • Drop a real app/google-services.json → the hook no-ops and uses your file
  • ./gradlew :app:processDebugGoogleServices -Pfirebase.config.path=/tmp/fake.json fails with a clear "does not exist" error
  • git check-ignore app/google-services.json returns the rule on line 70; git check-ignore app/google-services.json.template returns nothing
  • Runtime: FirebaseApp.getInstance() succeeds (passes the stub parser); FCM token rotation calls fail with a recognisable error and log via the gracefully-handled path in AppStartupInitializer.confirmFirebase (E01.S07)

Deferred (out of P1 scope)

"Staging and release flavors point to separate Firebase projects" — needs a staging productFlavor that doesn't exist today. Adding flavors is larger than 2 pts and folds into E27 release-pipeline work.

Coexistence

Stacks cleanly on top of PRs #5/#7/#9 — touches app/build.gradle.kts only in a new top-level configuration block (not the productFlavors / buildTypes that PR #7 edited).

Closes #10

Generated with Claude Code

…01.S01)

`app/google-services.json` is gitignored (real Firebase config never
enters version control), so fresh checkouts fail AGP's
`:app:processDebugGoogleServices` task — silent stub #5 from
epic-prod-overview.

Implements the AC's escape hatch (gate behind Gradle property + ship a
template):

- Commits `app/google-services.json.template` with stub but structurally
  valid values: `project_id=hogwarts-android-stub`, all-zero
  `mobilesdk_app_id`s, dummy API key. Client entries cover both
  `org.hogwarts.android` (release) and `org.hogwarts.android.debug`
  (the .debug applicationIdSuffix variant).

- Adds a configuration-time hook in `app/build.gradle.kts` that
  materialises `app/google-services.json` before AGP needs it:

    1. If the real file already exists, no-op.
    2. Else if `-Pfirebase.config.path=/abs/path` is passed, copy from
       there (validates path exists).
    3. Else copy the template with a `logger.warn` so devs know they're
       running on stub config.
    4. Else hard-fail with an actionable message pointing at the README.

  The materialised file stays gitignored — copy happens on every fresh
  checkout, real Firebase calls fail loud via
  AppStartupInitializer.confirmFirebase (E01.S07) instead of silently
  no-op'ing.

- README gets a "Firebase setup" section under Getting Started showing
  both supply paths (drop file directly vs `-Pfirebase.config.path`).

Deferred from this PR: "staging and release flavors point to separate
Firebase projects" — there's no staging productFlavor today; adding
flavors is larger than 2 pts and folds into E27 release pipeline work.

Closes #10

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(firebase): gate google-services.json with committed template (E01.S01)

1 participant