Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove virtual GetEventChannel from FeatureProvider #401

Merged
merged 2 commits into from
Mar 18, 2025

Conversation

askpt
Copy link
Member

@askpt askpt commented Mar 13, 2025

This PR

This pull request includes changes to the EventChannel handling in the OpenFeature library to improve code consistency and reliability.

Improvements to EventChannel handling:

Related Issues

Related to #358

@askpt askpt requested a review from a team as a code owner March 13, 2025 18:00
@askpt askpt changed the title tests: Correct event channel completion logic and enhance test setup test: Correct event channel completion logic and enhance test setup Mar 13, 2025
Copy link

codecov bot commented Mar 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.71%. Comparing base (46274a2) to head (8a016f3).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #401      +/-   ##
==========================================
- Coverage   85.90%   85.71%   -0.19%     
==========================================
  Files          39       39              
  Lines        1603     1603              
  Branches      172      171       -1     
==========================================
- Hits         1377     1374       -3     
- Misses        189      191       +2     
- Partials       37       38       +1     

☔ 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.

@askpt askpt force-pushed the askpt/fix-unit-test branch from 655abbf to a98c8c1 Compare March 13, 2025 18:46
Copy link

@Copilot 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

This PR improves event channel handling in the OpenFeature library by ensuring proper shutdown of unused providers and updating test setups for channel operations.

  • Corrects event channel completion logic by removing an unnecessary null-conditional operator.
  • Updates the event channel API in FeatureProvider by removing the virtual modifier.
  • Enhances test setup by adding necessary imports to support channel operations.

Reviewed Changes

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

File Description
src/OpenFeature/EventExecutor.cs Removes the null-conditional operator when completing the event channel writer to ensure proper shutdown of unused providers.
src/OpenFeature/FeatureProvider.cs Removes the virtual modifier on GetEventChannel, potentially affecting subclass overrides.
Comments suppressed due to low confidence (2)

src/OpenFeature/EventExecutor.cs:150

  • Removing the null-conditional operator requires that GetEventChannel() is guaranteed to return a non-null channel. Please double-check that no null value is possible to avoid a potential NullReferenceException.
oldProvider.GetEventChannel().Writer.Complete();

src/OpenFeature/FeatureProvider.cs:143

  • Removing the virtual keyword on GetEventChannel() may affect subclass implementations that override this behavior. Verify that this change is intentional and that no subclass relies on overriding this method.
public Channel<object> GetEventChannel() => this.EventChannel;

@askpt askpt changed the title test: Correct event channel completion logic and enhance test setup reactor!: Remove virtual GetEventChannel from FeatureProvider Mar 13, 2025
@askpt askpt changed the title reactor!: Remove virtual GetEventChannel from FeatureProvider refactor!: Remove virtual GetEventChannel from FeatureProvider Mar 13, 2025
@toddbaert toddbaert changed the title refactor!: Remove virtual GetEventChannel from FeatureProvider fix: Remove virtual GetEventChannel from FeatureProvider Mar 13, 2025
@askpt askpt added this pull request to the merge queue Mar 18, 2025
Merged via the queue into main with commit 00a4e4a Mar 18, 2025
18 of 19 checks passed
@beeme1mr beeme1mr deleted the askpt/fix-unit-test branch March 18, 2025 12:16
github-merge-queue bot pushed a commit that referenced this pull request Mar 27, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.3.2](v2.3.1...v2.3.2)
(2025-03-24)


### 🐛 Bug Fixes

* Address issue with newline characters when running Logging Hook Unit
Tests on linux
([#374](#374))
([a98334e](a98334e))
* Remove virtual GetEventChannel from FeatureProvider
([#401](#401))
([00a4e4a](00a4e4a))
* Update project name in solution file
([#380](#380))
([1f13258](1f13258))


### 🧹 Chore

* Correct LoggingHookTest timestamp handling.
([#386](#386))
([c69a6e5](c69a6e5))
* **deps:** update actions/setup-dotnet digest to 67a3573
([#402](#402))
([2e2c489](2e2c489))
* **deps:** update actions/upload-artifact action to v4.6.1
([#385](#385))
([accf571](accf571))
* **deps:** update actions/upload-artifact action to v4.6.2
([#406](#406))
([16c92b7](16c92b7))
* **deps:** update codecov/codecov-action action to v5.4.0
([#392](#392))
([06e4e3a](06e4e3a))
* **deps:** update dependency dotnet-sdk to v9.0.202
([#405](#405))
([a4beaae](a4beaae))
* **deps:** update dependency microsoft.net.test.sdk to 17.13.0
([#375](#375))
([7a735f8](7a735f8))
* **deps:** update dependency reqnroll.xunit to 2.3.0
([#378](#378))
([96ba568](96ba568))
* **deps:** update dependency reqnroll.xunit to 2.4.0
([#396](#396))
([b30350b](b30350b))
* **deps:** update dependency system.valuetuple to 4.6.0
([#403](#403))
([75468d2](75468d2))
* **deps:** update dotnet monorepo
([#379](#379))
([53ced91](53ced91))
* **deps:** update dotnet monorepo to 9.0.2
([#377](#377))
([3bdc79b](3bdc79b))
* **deps:** update github/codeql-action digest to 1b549b9
([#407](#407))
([ae9fc79](ae9fc79))
* **deps:** update github/codeql-action digest to 5f8171a
([#404](#404))
([73a5040](73a5040))
* **deps:** update github/codeql-action digest to 6bb031a
([#398](#398))
([9b6feab](9b6feab))
* **deps:** update github/codeql-action digest to 9e8d078
([#371](#371))
([e74e8e7](e74e8e7))
* **deps:** update github/codeql-action digest to b56ba49
([#384](#384))
([cc2990f](cc2990f))
* **deps:** update spec digest to 0cd553d
([#389](#389))
([85075ac](85075ac))
* **deps:** update spec digest to 54952f3
([#373](#373))
([1e8b230](1e8b230))
* **deps:** update spec digest to a69f748
([#382](#382))
([4977542](4977542))
* remove FluentAssertions
([#361](#361))
([4ecfd24](4ecfd24))
* Replace SpecFlow with Reqnroll for testing framework
([#368](#368))
([ed6ee2c](ed6ee2c)),
closes [#354](#354)
* update release please repo, specify action permissions
([#369](#369))
([63846ad](63846ad))


### 🔄 Refactoring

* Improve EventExecutor
([#393](#393))
([46274a2](46274a2))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Signed-off-by: OpenFeature Bot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants