feat!: fractional bucketing improvements#1740
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>
|
@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. - `fractional` now supports up to max-int32 total weight and 1/max-int32 resolution as described in the [high-precision fractional bucketing ADR](https://flagd.dev/architecture-decisions/high-precision-fractional-bucketing) - `fractional` now supports computed (nested JSONLogic) variants and weights as described in the [fractional ADR](https://flagd.dev/architecture-decisions/fractional) - Includes e2e tests from the [flagd-testbed v3.1.0...v3.4.0](open-feature/flagd-testbed@v3.1.0...v3.4.0) to validate consistent fractional bucketing across all provider implementations -⚠️ Pseudorandom hash assignments will change with this release due to changes in the hashing algorithm; update flagd and your providers to ensure fractional assignment is consistent across all workloads ### Related PRs | Component | PR | |---|---| | flagd | #1909 | | java-sdk-contrib | open-feature/java-sdk-contrib#1740 | | js-sdk-contrib | open-feature/js-sdk-contrib#1501 | | python-sdk-contrib | open-feature/python-sdk-contrib#373 | | dotnet-sdk-contrib | open-feature/dotnet-sdk-contrib#622 | | flagd-schemas | open-feature/flagd-schemas#207 | > **Warning** > @toddbaert will coordinate the release across flagd and all providers. Do not merge without coordination. > @toddbaert will update the RPC mode tests accordingly once the associated flagd PR is merged and an up-to-date flagd-testbed image is available. --------- 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