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: MutableContext and ImmutableContext merge are made recursive #280

Merged
merged 11 commits into from
Feb 8, 2023
Merged

Conversation

javicv
Copy link
Contributor

@javicv javicv commented Feb 6, 2023

Signed-off-by: Javier Collado javicv@gmail.com

This PR

  • Makes the evaluation context merge recursive for both MutableContext and ImmutableContext

Related Issues

Fixes #270

Notes

Follow-up Tasks

How to test

  • A new test method mergeShouldRetainItsSubkeysWhenOverridingContextHasTheSameKey in dev.openfeature.sdk.ImmutableContextTest has been added

@javicv javicv changed the title MutableContext and ImmutableContext merge are made recursive fix: MutableContext and ImmutableContext merge are made recursive Feb 6, 2023
@javicv javicv changed the title fix: MutableContext and ImmutableContext merge are made recursive fix: MutableContext and ImmutableContext merge are made recursive Feb 6, 2023
@toddbaert
Copy link
Member

@javicv spotbugs has a few complaints! Please take a look.

@codecov-commenter
Copy link

codecov-commenter commented Feb 6, 2023

Codecov Report

Merging #280 (b810b3a) into main (ed2e963) will increase coverage by 0.29%.
The diff coverage is 88.46%.

@@             Coverage Diff              @@
##               main     #280      +/-   ##
============================================
+ Coverage     91.52%   91.82%   +0.29%     
- Complexity      208      213       +5     
============================================
  Files            23       23              
  Lines           472      489      +17     
  Branches         27       30       +3     
============================================
+ Hits            432      449      +17     
+ Misses           26       24       -2     
- Partials         14       16       +2     
Flag Coverage Δ
unittests 91.82% <88.46%> (+0.29%) ⬆️

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

Impacted Files Coverage Δ
.../main/java/dev/openfeature/sdk/MutableContext.java 72.54% <80.00%> (+4.46%) ⬆️
src/main/java/dev/openfeature/sdk/Structure.java 89.74% <92.30%> (+1.28%) ⬆️
...ain/java/dev/openfeature/sdk/ImmutableContext.java 90.90% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@toddbaert
Copy link
Member

CI is passing now. I'll take a closer look at this today/tomorrow.

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.

Thanks so much @javicv . I think this is good conceptually. See comments in private merge methods.

@toddbaert
Copy link
Member

toddbaert commented Feb 7, 2023

Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.20.0:check (run-pmd) on project sdk: You have 3 PMD violations.

@javicv I will re-review later today, but this looks almost perfect to me! You do have some PMD issues though. Try running mvn verify locally to see them (if you have issues, try using JDK 8).

@toddbaert toddbaert self-requested a review February 8, 2023 15:07
@toddbaert
Copy link
Member

@javicv I pushed some (very) small changes to your second test that I think should resolve the coverage issue.

@toddbaert toddbaert closed this Feb 8, 2023
@toddbaert toddbaert reopened this Feb 8, 2023
@toddbaert toddbaert self-requested a review February 8, 2023 15:56
toddbaert
toddbaert previously approved these changes Feb 8, 2023
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.

I'm a bit confused my codecov isn't seeing that one line covered, but I'm satisfied with the tests, and the delta is very small anyway.

Thanks @javicv for all your efforts! This will be really nice to have. Approved.

javicv and others added 10 commits February 8, 2023 10:59
Signed-off-by: Javier Collado <javicv@gmail.com>
Signed-off-by: Javier Collado <javicv@gmail.com>
Signed-off-by: Javier Collado <javicv@gmail.com>
Signed-off-by: Javier Collado <javicv@gmail.com>
Co-authored-by: Thiyagu GK <thiyagu103@gmail.com>
Signed-off-by: Javier Collado <javicv@gmail.com>
Signed-off-by: Javier Collado <javicv@gmail.com>
Signed-off-by: Javier Collado <javicv@gmail.com>
Signed-off-by: Todd Baert <toddbaert@gmail.com>
Signed-off-by: Todd Baert <toddbaert@gmail.com>
Signed-off-by: Todd Baert <toddbaert@gmail.com>
@toddbaert toddbaert self-requested a review February 8, 2023 16:40
@sonarcloud
Copy link

sonarcloud bot commented Feb 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@beeme1mr beeme1mr self-requested a review February 8, 2023 16:44
@toddbaert toddbaert merged commit bd4e12e into open-feature:main Feb 8, 2023
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.

Evaluation context merge implementations should be recursive
6 participants