Conversation
1cd8040 to
4f02169
Compare
4f02169 to
a53abd3
Compare
| @@ -26,10 +28,10 @@ byte[] getContentHash() { | |||
| } | |||
|
|
|||
| ProviderEvaluation<Boolean> evaluate(String slug, Boolean defaultValue, EvaluationContext evaluationContext) { | |||
There was a problem hiding this comment.
This method mostly matches the .NET equivalent logically, though with a different shape. I propose that we align them further prior to the next piece of work in this area.
| if (rolloutPercentage < 100) { | ||
| return ProviderEvaluation.<Boolean>builder() | ||
| .value(false) | ||
| .reason(Reason.TARGETING_MATCH.toString()) |
There was a problem hiding this comment.
There was a problem hiding this comment.
| return null; | ||
| } | ||
| List<FeatureToggleEvaluation> evaluations = OctopusObjectMapper.INSTANCE.readValue(httpResponse.body(), new TypeReference<>(){}); | ||
| var evaluations = OctopusObjectMapper.INSTANCE.readValue(httpResponse.body(), new TypeReference<List<FeatureToggleEvaluation>>(){}); |
There was a problem hiding this comment.
I lied in my last PR. Well, not that I lied, but I did think we were on Java 8 rather than 11.
There was a problem hiding this comment.
Pull request overview
Adds client-side fractional (percentage) rollout evaluation to the Java OpenFeature provider, aligning behavior with the .NET provider and re-enabling the spec fixture suite.
Changes:
- Introduced MurmurHash3-based bucketing (evaluationKey + targetingKey) to support percentage rollouts.
- Updated evaluation flow in
OctopusContextto incorporate rollout checks before segment matching. - Reworked/expanded tests (including re-enabling spec fixture tests) to validate cross-SDK-consistent bucketing and evaluation behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/main/java/com/octopus/openfeature/provider/OctopusContext.java |
Implements normalized bucketing via MurmurHash3 and integrates rollout gating into flag evaluation flow. |
src/test/java/com/octopus/openfeature/provider/OctopusContextTests.java |
Replaces prior tests with extensive rollout + segment evaluation cases and cross-SDK bucketing vectors. |
src/test/java/com/octopus/openfeature/provider/SpecificationTests.java |
Re-enables parameterized specification fixture tests. |
src/test/java/com/octopus/openfeature/provider/FeatureToggleEvaluationDeserializationTests.java |
Tightens TypeReference typing for toggle list deserialization. |
src/main/java/com/octopus/openfeature/provider/OctopusClient.java |
Tightens TypeReference typing when deserializing toggle evaluations. |
pom.xml |
Adds Apache Commons Codec dependency for MurmurHash3. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Background
We are implementing client-side percentage rollout evaluation to our three OpenFeature provider libraries.
The .NET provider had this added in OctopusDeploy/openfeature-provider-dotnet#45.
This PR adds this to the Java library.
Resolves https://linear.app/octopus/issue/DEVEX-82/add-fractional-evaluation-support-to-java-client-library
Changes
OctopusContextto have the same logical flow as the .NET equivalent, including implementinggetNormalizeNumberto hash theevaluationKey+targetingKeyfor percentage rollout.OctopusContextTestsreplace existing tests and these now align with the .NET equivalents to ensure consistent evaluation.Notes for review
Reasonoptions chosen. It may be good to talk these through. Or perhaps ignore them until we do reasons properly and across our feature toggles ecosystem.