Skip to content

Commit 91ee54e

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 f1a5d1d commit 91ee54e

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
@@ -409,9 +409,11 @@ def _resolve( # noqa: PLR0915 C901
409409
flag_key=flag_key, context=context
410410
)
411411
response = self.stub.ResolveObject(request, **call_args)
412-
value = MessageToDict(response, preserving_proto_field_name=True)[
413-
"value"
414-
]
412+
# DISABLED responses omit the value field entirely; fall back to default_value
413+
# here so the substitution below (or the caller) gets a sane mapping.
414+
value = MessageToDict(response, preserving_proto_field_name=True).get(
415+
"value", default_value
416+
)
415417
elif flag_type == FlagType.FLOAT:
416418
request = evaluation_pb2.ResolveFloatRequest(
417419
flag_key=flag_key, context=context

0 commit comments

Comments
 (0)