Skip to content

fix(multi): forward ConfigurationChanged events from child providers#480

Merged
sahidvelji merged 1 commit intomainfrom
fix/multiprovider-config-change-events
Mar 8, 2026
Merged

fix(multi): forward ConfigurationChanged events from child providers#480
sahidvelji merged 1 commit intomainfrom
fix/multiprovider-config-change-events

Conversation

@jonathannorris
Copy link
Member

Summary

  • Fix ConfigurationChanged events being silently dropped by the multi-provider's event forwarding pipeline
  • Fix child provider tracked state being corrupted to an empty string after emitting a ConfigurationChanged event

Closes #479

Problem

The multi-provider's forwardProviderEvents only forwarded events to the outbound channel when updateProviderStateFromEvent returned true (i.e., when the aggregate state changed). Since ConfigurationChanged was mapped to an empty-string pseudo-state with weight -1, it could never change the aggregate — so these events were always dropped.

As a side effect, the emitting provider's tracked state was set to "", making it invisible to future evaluateState calls until it emitted another real state event.

Fix

ConfigurationChanged events are now forwarded directly as a pass-through in forwardProviderEvents, bypassing the state update logic entirely. This matches the JS SDK reference implementation where ConfigurationChanged is re-emitted on the multi-provider's event emitter without going through status change logic.

The now-dead empty-string state mapping ("": -1 in stateValues, ProviderConfigChange: "" in eventTypeToState) has been removed.

@jonathannorris jonathannorris requested review from a team as code owners March 5, 2026 23:08
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses critical issues within the multi-provider's event handling mechanism, specifically concerning ConfigurationChanged events. It ensures that these events are correctly forwarded to the outbound channel and prevents unintended corruption of child provider states. The changes streamline event processing by bypassing state update logic for configuration changes, leading to more robust and predictable behavior.

Highlights

  • ConfigurationChanged Event Forwarding: Ensured ConfigurationChanged events from child providers are no longer silently dropped by the multi-provider's event forwarding pipeline, aligning with the JS SDK reference implementation.
  • Child Provider State Integrity: Prevented child provider tracked state from being corrupted to an empty string after emitting a ConfigurationChanged event, ensuring accurate state tracking.
  • Removed Obsolete State Mapping: Eliminated the now-dead empty-string pseudo-state mapping ("": -1" in stateValues and "ProviderConfigChange: """" in eventTypeToState) as it is no longer needed.
Changelog
  • openfeature/multi/multiprovider.go
    • Removed the "" entry from stateValues map.
    • Removed the of.ProviderConfigChange entry from eventTypeToState map.
    • Introduced a direct pass-through mechanism for of.ProviderConfigChange events in forwardProviderEvents.
    • Removed the conditional logging for of.ProviderConfigChange within updateProviderStateFromEvent.
  • openfeature/multi/multiprovider_test.go
    • Added TestMultiProvider_ConfigurationChangedEventForwarding test suite.
    • Included a test case to verify ConfigurationChanged events are always forwarded.
    • Added a test case to confirm ConfigurationChanged events do not corrupt provider tracked state.
    • Included a test case to ensure ConfigurationChanged events do not affect aggregate state evaluation.
Activity
  • No human activity (comments, reviews, etc.) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@jonathannorris jonathannorris force-pushed the fix/multiprovider-config-change-events branch 2 times, most recently from bc4c1ef to 18ff714 Compare March 5, 2026 23:09
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly fixes an issue where ConfigurationChanged events were being dropped and causing state corruption in the multi-provider. The approach of treating these events as a direct pass-through is sound and aligns with implementations in other OpenFeature SDKs. The code changes are clean and the removals of the old logic are appropriate. However, the new tests introduced to verify this fix have some flaws in their asynchronous event handling. They don't reliably account for events generated during initialization, which can lead to incorrect or flaky test results. I've added specific comments with suggestions to make the tests more robust.

@jonathannorris jonathannorris force-pushed the fix/multiprovider-config-change-events branch from 18ff714 to 84a7193 Compare March 5, 2026 23:12
@jonathannorris jonathannorris requested a review from Copilot March 5, 2026 23:14
@jonathannorris jonathannorris force-pushed the fix/multiprovider-config-change-events branch from 84a7193 to a0d5782 Compare March 5, 2026 23:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes multi-provider event forwarding so ConfigurationChanged (ProviderConfigChange) events are no longer dropped and no longer corrupt child provider tracked state.

Changes:

  • Forward ProviderConfigChange events as pass-throughs (bypassing aggregate-state update logic).
  • Remove the dead pseudo-state mapping used for config-change events.
  • Add tests validating forwarding behavior and ensuring provider/aggregate state is unaffected.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
openfeature/multi/multiprovider.go Forwards config-change events directly and removes config-change state mapping.
openfeature/multi/multiprovider_test.go Adds regression tests for config-change forwarding and state integrity.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@erka erka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you @jonathannorris

Signed-off-by: Norris <jonathan.norris@dynatrace.com>
@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.45%. Comparing base (3bfdb3e) to head (52e174e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #480      +/-   ##
==========================================
+ Coverage   83.21%   83.45%   +0.23%     
==========================================
  Files          27       27              
  Lines        2109     2109              
==========================================
+ Hits         1755     1760       +5     
+ Misses        305      301       -4     
+ Partials       49       48       -1     
Flag Coverage Δ
e2e 83.45% <100.00%> (+0.23%) ⬆️
unit 83.45% <100.00%> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@erka erka added bug Something isn't working v1 multi-provider labels Mar 6, 2026
@sahidvelji sahidvelji merged commit 20c5cb9 into main Mar 8, 2026
10 checks passed
@sahidvelji sahidvelji deleted the fix/multiprovider-config-change-events branch March 8, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working multi-provider v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Multi-provider] ConfigurationChanged events not always forwarded

4 participants