Skip to content

Commit fecd9e0

Browse files
committed
fix(flagd): RPC Object resolver tolerates missing value field
MessageToDict drops the value field entirely for DISABLED responses (no value is sent). Fall back to the caller's default_value via .get() instead of raising KeyError; the substitution branch then surfaces the default with reason=DISABLED. Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
1 parent eb41c48 commit fecd9e0

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

  • providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers

providers/openfeature-provider-flagd/src/openfeature/contrib/provider/flagd/resolvers/grpc.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,9 +396,11 @@ def _resolve( # noqa: PLR0915 C901
396396
flag_key=flag_key, context=context
397397
)
398398
response = self.stub.ResolveObject(request, **call_args)
399-
value = MessageToDict(response, preserving_proto_field_name=True)[
400-
"value"
401-
]
399+
# DISABLED responses omit the value field entirely; fall back to default_value
400+
# here so the substitution below (or the caller) gets a sane mapping.
401+
value = MessageToDict(response, preserving_proto_field_name=True).get(
402+
"value", default_value
403+
)
402404
elif flag_type == FlagType.FLOAT:
403405
request = evaluation_pb2.ResolveFloatRequest(
404406
flag_key=flag_key, context=context

0 commit comments

Comments
 (0)