launchdarkly / erlang-server-sdk

LaunchDarkly Server-Side SDK for Erlang/Elixir
Other
33 stars 37 forks source link

Don't crash when parsing flag attributes with default values #9

Closed unix1 closed 4 years ago

unix1 commented 5 years ago

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

Expected 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

zurab-darkly commented 4 years ago

This was fixed in the 1.0.0-beta1 release.