-
Notifications
You must be signed in to change notification settings - Fork 6
feat: sdk consumes context engine #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/evaluation-get-result
Are you sure you want to change the base?
feat: sdk consumes context engine #89
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left three comments.
| # Floats/doubles are not supported by the engine due to ambiguous serialization across supported platforms. (segments/models_spec.rb) | ||
| return false unless trait_value.is_a?(String) || trait_value.is_a?(Integer) | ||
|
|
||
| if @value.is_a?(Array) | ||
| return @value.include?(trait_value.to_s) | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to Flagsmith/engine-test-data#38, we only skip booleans now:
| # Floats/doubles are not supported by the engine due to ambiguous serialization across supported platforms. (segments/models_spec.rb) | |
| return false unless trait_value.is_a?(String) || trait_value.is_a?(Integer) | |
| if @value.is_a?(Array) | |
| return @value.include?(trait_value.to_s) | |
| end | |
| (segments/models_spec.rb) | |
| return false unless ![true, false].include? trait_value | |
| if @value.is_a?(Array) | |
| return @value.include?(trait_value.to_s) | |
| end |
| "This indicates a bug in the SDK, please report it." | ||
| end | ||
|
|
||
| acc[normalize_key(flag_result[:name])] = Flagsmith::Flags::Flag.new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to normalise the feature name?
| # Flags engine methods | ||
| # NOTE: This class is kept for backwards compatibility but no longer contains | ||
| # the old model-based evaluation methods. Use the context-based evaluation | ||
| # via Flagsmith::Engine::Evaluation::Core.get_evaluation_result instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're major-versioning anyway, can we either remove the class altogether, add Flagsmith::Engine::get_evaluation_result interface? I don't see how an empty Engine class helps to maintain backwards compatibility here?
| # frozen_string_literal: true | ||
|
|
||
| require 'json' | ||
| require 'jsonpath' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought JSONPath part was moved to #88? Should this PR get rebased?
Contributes to #81
In this 3/3 PR related to evaluation context in local evaluation mode
In this PR: