Skip to content

Transaction context should be merged into the evaluation context of the hooks #521

Closed

Description

@kouk

Hi,
During flag evaluation the transaction context is merged into the evaluation context here:

merged_context = self._before_hooks_and_merge_context(

However the hook_context.evaluation_context is created before this, so it doesn't contain the attributes or targeting key that exists in the propagated transaction context. This is unexpected. I believe that the _before_hooks_and_merge_context should be called inside _establish_hooks_and_provider so that the evaluation_context field in the hook_context can be up to date with all the attributes.

Activity

  1. added
    bug
    on Jul 17, 2025
  2. beeme1mr commented on Jul 17, 2025

    @beeme1mr
    Member

    Hey @kouk, I agree that context should be merged prior to calling the before hook. I checked the JavaScript implementation and it behaves as you described. Would you be willing to make this change?

  3. kouk commented on Jul 18, 2025

    @kouk
    ContributorAuthor

    @beeme1mr sure. I can take a stab at it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions