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: internal provider comparison causing race conditions in tests #312

Merged
merged 2 commits into from
Jan 21, 2025

Conversation

warber
Copy link
Contributor

@warber warber commented Jan 16, 2025

This PR

This pull request addresses issue #307 by comparing FeatureProvider implementations internally using their pointer addresses. It inspects the FeatureProvider provided by the user and uses the == operator for comparison if dealing with pointers. Otherwise, it utilizes the existing deepEquals comparison.

Related Issues

Fixes #307

Notes

Follow-up Tasks

How to test

@warber warber force-pushed the fix/provider-references branch 2 times, most recently from c372d66 to 99644d2 Compare January 16, 2025 14:24
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.88%. Comparing base (890bfd0) to head (713cf28).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #312      +/-   ##
==========================================
- Coverage   86.91%   86.88%   -0.04%     
==========================================
  Files          12       13       +1     
  Lines        1376     1372       -4     
==========================================
- Hits         1196     1192       -4     
  Misses        156      156              
  Partials       24       24              
Flag Coverage Δ
e2e 86.88% <100.00%> (-0.04%) ⬇️
unit 86.88% <100.00%> (-0.04%) ⬇️

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.

@warber warber force-pushed the fix/provider-references branch 2 times, most recently from e21dc2f to 3a36e19 Compare January 16, 2025 15:01
@toddbaert
Copy link
Member

@warber I think this solution solves the whole issue without putting constraints on the user, yes? IIUC, with this we:

  • can compare providers reliably, whether they are pointers or structs ✔️
  • can avoid locking on the shutdown ✔️
  • don't have any public-facing API changes ✔️

Correct?

Signed-off-by: Bernd Warmuth <bernd.warmuth@dynatrace.com>
@warber warber force-pushed the fix/provider-references branch from 3a36e19 to 1b18376 Compare January 17, 2025 09:50
@warber warber marked this pull request as ready for review January 17, 2025 10:21
@warber warber requested a review from a team as a code owner January 17, 2025 10:21
@beeme1mr
Copy link
Member

Hey @warber, is this still a work-in-progress or can it be reviewed now?

@warber
Copy link
Contributor Author

warber commented Jan 19, 2025

Hey @warber, is this still a work-in-progress or can it be reviewed now?

@beeme1mr it's ready for review

@beeme1mr beeme1mr changed the title feat: compare featureProvider internally by reference (wip) feat: compare featureProvider internally by reference Jan 19, 2025
@toddbaert toddbaert self-requested a review January 21, 2025 17:58
Copy link
Member

@toddbaert toddbaert left a comment

Choose a reason for hiding this comment

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

Looks good. I can confirm I can't reproduce and sort of race with this as well. Thanks a lot @warber and @erka .

I will release this today unless there are objections.

@toddbaert toddbaert changed the title feat: compare featureProvider internally by reference fix: internal provider comparison causing race conditions in tests Jan 21, 2025
@toddbaert toddbaert merged commit 440072f into open-feature:main Jan 21, 2025
9 checks passed
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.

[BUG] Data race if the provider set few times
6 participants