Implement InitializableConfigValueProvider on Firebase provider#287
Merged
Merged
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
be8cb78 to
bb7f899
Compare
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
bb7f899 to
1bee76f
Compare
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
Implements
InitializableConfigValueProvideronFirebaseConfigValueProvider(closes #163). This was deferred from v1.0.0 pending the API-design decision oninitialize()semantics.initialize()callsFirebaseRemoteConfig.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 firstfetch().Design decision
ensureInitialized()only — confirmed with the maintainer. Rejected+ activate():activate()would auto-promote config that was deliberately fetched-but-not-activated viafetch(activate = false), changinginitialize()'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():CancellationExceptionis re-thrown unwrapped; other exceptions are wrapped inFetchExceptionwith the originalcausepreserved.Tests
4 unit tests (mockk +
runTest):ensureInitialized()called exactly oncefetch()/fetchAndActivate()NOT called (no network)FetchExceptionwithcausepreservedCancellationExceptionre-thrown without wrapping:providers:firebase:testDebugUnitTest— 26/26 green;compileDebugKotlingreen; spotless clean.Follow-up (out of scope)
FetchExceptionis fetch-oriented in name but reused forinitialize()errors. Consider renaming to a neutralProviderExceptionin a separate PR.🤖 Generated with Claude Code