Skip to content

Deprecate MergeTransactionContext function #455

Description

@sahidvelji

Related to #454

MergeTransactionContext does a couple of things:

  • Call TransactionContext to extract an EvaluationContext from the given context.Context
  • Merge the given EvaluationContext with the one extracted from the step above
  • Return a new context.Context that contains the merged EvaluationContext from the step above.

I propose that we deprecate this function. I would argue that it's doing too much and naming it more appropriately is not possible without creating a really long name.

Before we attempt to fill the gap, I'd like to establish the usefulness of this function, given that it's not defined in the spec (https://openfeature.dev/specification/sections/evaluation-context). Here I am specifically referring to the ability of merging evaluation contexts, whether directly via a function that takes multiple evaluation contexts, or indirectly by merging the "transaction context" in the "transaction context propagator" with a different evaluation context. We need to determine whether similar behaviour exists in the other languages. If so, we should consider updating the spec if we want this functionality implemented consistently across all languages.

Either way, there are two ways to implement this functionality, if we decide that we need this:

  1. Export (and rename) the existing mergeContexts function to allow users to merge evaluation contexts.
  2. Merge evaluation contexts indirectly as described in the paragraph above (essentially what MergeTransactionContext does), but rename the function. We'll need to come up with a good name in this case.

func mergeContexts(evaluationContexts ...EvaluationContext) EvaluationContext {

I personally prefer the first option, which is a more more modular approach. I think that the existing MergeTransactionContext function does too many things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions