Centralize type dispatch in ClientEvaluator, fix addApiHook singleton bypass, simplify TestFeatureProvider Hub#109
Merged
Conversation
Base automatically changed from
fix/codebase-review-remaining
to
fix/codebase-review-fixes
May 12, 2026 23:19
f12c9a5 to
8816688
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
ClientEvaluator: centralized type dispatch replaces repetitive string-match arms
evaluateFromClienthad 6 identicalcase "Type" => evaluateViaTypeclass(key, default.asInstanceOf[Type], ...)arms. AddedClientEvaluator.evaluateStandardthat centralizes the type-name → evaluator lookup, reducing the match to a singlecase Some(...)arm. Object and custom type paths remain as special cases.addApiHook / clearApiHooks bypass isolated OpenFeatureAPI instances
These were static companion methods calling
OpenFeatureAPI.getInstance()— the global singleton. WhenFeatureFlagRegistrycreates clients with isolated API instances viaOpenFeatureAPIFactory.create(), hooks added through the companion never reached those clients. Moved toFeatureFlagstrait methods, implemented inFeatureFlagsLiveusing the injectedapiinstance. Companion accessors now delegate through the service.TestFeatureProvider: Ref[Hub] replaced with plain Hub
eventsHubRef: Ref[Hub[ProviderEvent]]was never updated to a new Hub — theRefadded unnecessary indirection on every event publish and stream subscription. Replaced with a directeventsHub: Hub[ProviderEvent]field.Not addressed (cross-compilation constraints)
implicit→given/using: required for Scala 2.13 compatibility in shared sourceCountDownLatch→ ZIOPromise: Java SDK'sinitialize()requires actual thread blocking at the Java/ZIO boundary