open-feature / flagd

A feature flag daemon with a Unix philosophy
https://openfeature.dev
Apache License 2.0
564 stars 67 forks source link

feat!: DISABLED flags signal return grpc precondition_failed #1348

Closed toddbaert closed 4 months ago

toddbaert commented 4 months ago

DISABLED flags now return gRPC error code precondition_failed instead of not_found.

Relates to: https://github.com/open-feature/flagd/issues/1345

This will allow us to specially catch this error in providers and return the default instead of throwing. precondition_failed seems like an appropriate error code:

The operation was rejected because the system is not in a state required for the operation's execution. For example, the directory to be deleted is non-empty, an rmdir operation is applied to a non-directory, etc. Service implementors can use the following guidelines to decide between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: (a) Use UNAVAILABLE if the client can retry just the failing call. (b) Use ABORTED if the client should retry at a higher level (e.g., when a client-specified test-and-set fails, indicating the client should restart a read-modify-write sequence). (c) Use FAILED_PRECONDITION if the client should not retry until the system state has been explicitly fixed. E.g., if an "rmdir" fails because the directory is non-empty, FAILED_PRECONDITION should be returned since the client should not retry unless the files are deleted from the directory.

https://grpc.github.io/grpc/core/md_doc_statuscodes.html

netlify[bot] commented 4 months ago

Deploy Preview for polite-licorice-3db33c canceled.

Name Link
Latest commit 259d379cafa8042be152aa6b53e9969c797c8665
Latest deploy log https://app.netlify.com/sites/polite-licorice-3db33c/deploys/66853163dbf842000805cb6a
netlify[bot] commented 4 months ago

Deploy Preview for polite-licorice-3db33c canceled.

Name Link
Latest commit 66379a50526046679a5bbcb498d404cf22124440
Latest deploy log https://app.netlify.com/sites/polite-licorice-3db33c/deploys/6685316feb7e340008c90d6f