Skip to content

Implement InitializableConfigValueProvider on Firebase provider#287

Merged
kirich1409 merged 1 commit into
developfrom
feature/163-firebase-initializable-provider
Jun 13, 2026
Merged

Implement InitializableConfigValueProvider on Firebase provider#287
kirich1409 merged 1 commit into
developfrom
feature/163-firebase-initializable-provider

Conversation

@kirich1409

@kirich1409 kirich1409 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements InitializableConfigValueProvider on FirebaseConfigValueProvider (closes #163). This was deferred from v1.0.0 pending the API-design decision on initialize() semantics.

initialize() calls FirebaseRemoteConfig.ensureInitialized().await(), which warms Firebase's on-disk caches (activated / fetched / defaults) into memory without a network fetch. After it, ConfigValues.get() reads the persisted values synchronously from memory (Source.REMOTE), enabling instant flag values at app start before the first fetch().

Design decision

ensureInitialized() only — confirmed with the maintainer. Rejected + activate(): activate() would auto-promote config that was deliberately fetched-but-not-activated via fetch(activate = false), changing initialize()'s semantics from "warm the cache" to "warm + auto-activate" — a footgun. ensureInitialized() is the literal match of the interface contract ("load previously cached values, MUST NOT fetch") and does not mutate state.

Error handling mirrors the existing fetch(): CancellationException is re-thrown unwrapped; other exceptions are wrapped in FetchException with the original cause preserved.

Tests

4 unit tests (mockk + runTest):

  • ensureInitialized() called exactly once
  • fetch() / fetchAndActivate() NOT called (no network)
  • task failure wrapped in FetchException with cause preserved
  • CancellationException re-thrown without wrapping

:providers:firebase:testDebugUnitTest — 26/26 green; compileDebugKotlin green; spotless clean.

Note: the firebase module's kover threshold is intentionally 0 (#45) — runtime verification against a real Firebase backend is out of scope; the contract is covered by mockk unit tests.

Follow-up (out of scope)

FetchException is fetch-oriented in name but reused for initialize() errors. Consider renaming to a neutral ProviderException in a separate PR.

🤖 Generated with Claude Code

Review in cubic

@kirich1409 kirich1409 marked this pull request as ready for review June 13, 2026 05:58
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

@kirich1409 kirich1409 force-pushed the feature/163-firebase-initializable-provider branch 2 times, most recently from be8cb78 to bb7f899 Compare June 13, 2026 06:25
initialize() calls FirebaseRemoteConfig.ensureInitialized() to warm the
on-disk cache into memory without a network fetch, mirroring fetch()'s
CancellationException-preserving + FetchException-wrapping pattern.

Closes #163
@kirich1409 kirich1409 force-pushed the feature/163-firebase-initializable-provider branch from bb7f899 to 1bee76f Compare June 13, 2026 06:43
@kirich1409 kirich1409 merged commit 43cbb5c into develop Jun 13, 2026
8 checks passed
@kirich1409 kirich1409 deleted the feature/163-firebase-initializable-provider branch June 13, 2026 06:54
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.

1 participant