feat!: fractional bucketing improvements#1740
feat!: fractional bucketing improvements#1740chrfwow wants to merge 30 commits intoopen-feature:mainfrom
Conversation
Signed-off-by: christian.lutnik <christian.lutnik@dynatrace.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
tools/flagd-core/src/test/resources/fractional/selfContainedFractionalB.json
Show resolved
Hide resolved
|
Do we want more tests for this? I stuck to the current test suite |
There was a problem hiding this comment.
Code Review
The pull request refactors the fractional targeting logic to support various input types (numbers, booleans) for bucketing by converting them to byte arrays and introduces a new numberToByteArray helper. The core bucketing algorithm was also revised to use an integer-based bit shift operation. Review comments highlight two key areas for improvement: the numberToByteArray method has a potential precision loss issue for BigDecimal and could be made more concise using ByteBuffer, and the bucketing logic has a subtle bug related to handling signed vs. unsigned integers from the MurmurHash3 function, which requires a bitmask for correct range mapping.
.../flagd-core/src/main/java/dev/openfeature/contrib/tools/flagd/core/targeting/Fractional.java
Outdated
Show resolved
Hide resolved
.../flagd-core/src/main/java/dev/openfeature/contrib/tools/flagd/core/targeting/Fractional.java
Outdated
Show resolved
Hide resolved
Signed-off-by: christian.lutnik <christian.lutnik@dynatrace.com>
Signed-off-by: christian.lutnik <christian.lutnik@dynatrace.com>
Signed-off-by: christian.lutnik <christian.lutnik@dynatrace.com>
Signed-off-by: christian.lutnik <christian.lutnik@dynatrace.com>
Signed-off-by: christian.lutnik <christian.lutnik@dynatrace.com>
|
Idk why there are PMD errors, but I think they are unrelated and false positives |
Signed-off-by: christian.lutnik <christian.lutnik@dynatrace.com>
Signed-off-by: christian.lutnik <christian.lutnik@dynatrace.com>
...gd-core/src/test/java/dev/openfeature/contrib/tools/flagd/core/targeting/FractionalTest.java
Outdated
Show resolved
Hide resolved
...gd-core/src/test/java/dev/openfeature/contrib/tools/flagd/core/targeting/FractionalTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: christian.lutnik <christian.lutnik@dynatrace.com>
Signed-off-by: christian.lutnik <christian.lutnik@dynatrace.com>
Signed-off-by: christian.lutnik <christian.lutnik@dynatrace.com>
Signed-off-by: christian.lutnik <christian.lutnik@dynatrace.com>
.../flagd-core/src/main/java/dev/openfeature/contrib/tools/flagd/core/targeting/Fractional.java
Outdated
Show resolved
Hide resolved
Signed-off-by: christian.lutnik <christian.lutnik@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
|
@chrfwow there was some e2e test failures but I fixed them by updating to the latest git submodule in the testkit module, and adding the v1 exclusion to the file mode suite, and excluding v2 in the RPC suite (since flagd doesn't support this yet). I will coordinate the release of flagd, then update the RPC suite here and release everything simultaneously. |
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
|
Here's the flagd implementation: open-feature/flagd#1909 @chrfwow Up to you if you want to create a new PR based on this branch, but it's probably easier to do this and this in one go, as I did above. |
|
@toddbaert I will implement the nested fractional evaluation in a different PR |
providers/flagd/src/test/java/dev/openfeature/contrib/providers/flagd/e2e/RunRpcTest.java
Outdated
Show resolved
Hide resolved
toddbaert
left a comment
There was a problem hiding this comment.
This PR looks good. Leaving this unresolved conversation to block for now though until implementations are consistent: https://github.com/open-feature/java-sdk-contrib/pull/1740/changes#r2974095951
@chrfwow related:
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
04b75d9 to
3ff2e73
Compare
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
3ff2e73 to
3114c91
Compare
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
High-precision and nested fractional
This is a coordinated feature across flagd and all flagd providers.
fractionalnow supports up to max-int32 total weight and 1/max-int32 resolution as described in the high-precision fractional bucketing ADRfractionalnow supports computed (nested JSONLogic) variants and weights as described in the fractional ADRRelated PRs
Original PR description
Adds high resolution fractional support
Related Issues
Fixes #1738