open-feature / spec

OpenFeature specification
https://openfeature.dev
Apache License 2.0
597 stars 35 forks source link

Hook context merging w/ api ctx #124

Closed justinabrahms closed 1 year ago

justinabrahms commented 1 year ago

Requirement 4.3.4 says:

When before hooks have finished executing, any resulting evaluation context MUST be merged with the invocation evaluation context with the invocation evaluation context taking precedence in the case of any conflicts.

How does provider and client context fix here?

I think the order that makes sense is (top-most wins):

  1. invocation
  2. before hook
  3. client
  4. api

That sound right?

justinabrahms commented 1 year ago

The above is what I've implemented at https://github.com/open-feature/java-sdk/commit/df1a0833985de33589f230b03de7e377df026f67#diff-e68548048652a4655f9bdf043de6c238360b9f05b9d61267a12423617e377303L51

We should either fix that commit or update 4.3.4 to have the complete correct merge order.

toddbaert commented 1 year ago

This sounds right. We also have 3.2.2. I feel like there's some redundancy here, and I'm not 100% sure how to rectify it.

toddbaert commented 1 year ago

@beeme1mr had a question that gave me pause: https://github.com/open-feature/spec/pull/125#issuecomment-1208472545