Description
When a flag is served by LaunchDarkly streaming service with default value in fallthrough attribute - "fallthrough":{} the SDK stores the flag in storage as expected. However, when evaluating, it crashes when parsing that attribute with function_clause in eld_flag:parse_variation_or_rollout/1. This is because it expects to see either variation or rollout definition in the fallthrough attribute and doesn't handle the case when there are none.
This case shouldn't happen during normal operation; but in case it does, the SDK shouldn't crash. We should also check to make sure other flag attributes are able to handle default values as well and validate with tests.
To reproduce
Induce SDK (use a test case) to add flag JSON that contains "fallthrough":{} attribute
Description When a flag is served by LaunchDarkly streaming service with default value in
fallthrough
attribute -"fallthrough":{}
the SDK stores the flag in storage as expected. However, when evaluating, it crashes when parsing that attribute withfunction_clause
ineld_flag:parse_variation_or_rollout/1
. This is because it expects to see either variation or rollout definition in thefallthrough
attribute and doesn't handle the case when there are none.This case shouldn't happen during normal operation; but in case it does, the SDK shouldn't crash. We should also check to make sure other flag attributes are able to handle default values as well and validate with tests.
To reproduce
"fallthrough":{}
attributeExpected behavior There shouldn't be a crash.
SDK version 1.0.0-alpha2 and master
Language version, developer tools Erlang/OTP 22
OS/platform All