Observe the path configuration loading state#195
Merged
Conversation
…ust the data is observed
… available or can't parse
…equality can be determined
…evious behavior doesn't change.
jhutarek
reviewed
Mar 26, 2026
…id exposing the internal rules
…hing the remote configuration is cancellable
…tside of the global instance is an error
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.
This introduces a
StateFlow-based loading mechanism for path configuration so apps can observe when the configuration loads and from which source.Key Changes
PathConfigurationData— New class containing only the serializable configuration data (rules, settings). Extracted fromPathConfigurationso theStateFlowemits lightweight data objects rather than the fullPathConfigurationinstance. Implementsequals()/hashCode()soStateFlowproperly deduplicates identical emissions.PathConfigurationLoadState— New sealed class hierarchy:Idlefor the initial state, andLoadedwith three subclasses (BundledAssetLoaded,CachedRemoteLoaded,RemoteLoaded). Apps can checkis Loadedfor any successful load, or match on the specific subclass when the source matters.PathConfigurationLoader— Refactored to return load states directly. Smarter loading order: prefers the cached remote config over the bundled asset. Falls back to bundled only when no cache exists or the cache fails to parse. Remote fetch runs onDispatchers.IO.PathConfiguration— ExposesloadState: StateFlow<PathConfigurationLoadState>for app observation. The bundled/cached config loads synchronously (to maintain backwards compatibility) inload()so it's available immediately. The remote fetch runs asynchronously on IO. All state mutations aresynchronizedfor thread safety between the IO loading scope and main-thread reads. Ifload()is called multiple times, the previous job is cancelled before fetching the configuration again.Example Usage