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: add or update fields in the existing environment or rulesets #665

Merged
merged 6 commits into from
Aug 20, 2024
Merged

fix: add or update fields in the existing environment or rulesets #665

merged 6 commits into from
Aug 20, 2024

Conversation

luvsaxena1
Copy link
Contributor

This is to fix issue issue. This could potentially fix adding nested object in the rulesets as well.

@luvsaxena1 luvsaxena1 changed the title fix: add or update nested variables in the environment fix: add or update variables in the existing environment Aug 12, 2024
@klutchell
Copy link
Contributor

LGTM, can we get this merged?

@luvsaxena1
Copy link
Contributor Author

@klutchell I have tested this issue on my local version of safe settings and its working as expected.

It not only resolved issue 660 but also solved issue 655

@luvsaxena1 luvsaxena1 changed the title fix: add or update variables in the existing environment fix: add or update fields in the existing environment or rulesets Aug 14, 2024
@klutchell
Copy link
Contributor

WDYT @decyjphr ?

@Brad-Abrams
Copy link
Contributor

Reviewing

@Brad-Abrams
Copy link
Contributor

This is tricky

@luvsaxena1 did you happen to see PR #649 Environments tolerate concise configuration? It combines together other PRs you have commented in, and it also addresses the issue you recently raised in #660. I confirmed this by locally adding a new unit test for the scenario you outlined in 660.

When I made the changes for #649, I was intentionally constraining the area of impact to environments in the hope that this would make the PR easier to review and accept.

That being said, I also like that you have gone after the broader change in mergeDeep

I've brought just the changes from this PR #665 locally, and run the updated unit tests for environments from PR #649. There is certainly an improvement that has come to environments from the mergeDeep changes. However there are still 5/12 unit tests which fail.

image

I'll give this some further thought and update back here

Copy link
Collaborator

@decyjphr decyjphr left a comment

Choose a reason for hiding this comment

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

I know the mergeDeep is not optimal and could be improved. So adding this extract bit to do handle nested objects when adding elements to additions is great. Thanks.

@decyjphr
Copy link
Collaborator

@luvsaxena1 do you want us to take a look at resolving the tests or you are looking at it already? Don't want to muddy the waters...

Copy link
Collaborator

@decyjphr decyjphr left a comment

Choose a reason for hiding this comment

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

LGTM

@decyjphr
Copy link
Collaborator

Tested locally and the tests seem to pass.

@Brad-Abrams
Copy link
Contributor

@luvsaxena1 do you want us to take a look at resolving the tests or you are looking at it already? Don't want to muddy the waters...

@decyjphr, I think that perhaps this question is for me to answer. If #649 is also approved and merged, then I anticipate that it will take care of resolving the tests. I'll confirm and follow up here.

@Brad-Abrams
Copy link
Contributor

@luvsaxena1 do you want us to take a look at resolving the tests or you are looking at it already? Don't want to muddy the waters...

@decyjphr, I think that perhaps this question is for me to answer. If #649 is also approved and merged, then I anticipate that it will take care of resolving the tests. I'll confirm and follow up here.

@decyjphr confirming that this PR and #649 are compatible. Combining the two still results in the expanded set of environments unit tests all passing.

image

@klutchell
Copy link
Contributor

Are we set to merge this next? Now that #649 has merged it would be nice to get the fixes to mergeDeep to catch changes to rulesets and nested objects in general.

@luvsaxena1
Copy link
Contributor Author

@decyjphr Can we merge this PR next ? As I said this also solve problem with nested objects of rulesets and other plugins.

@decyjphr decyjphr merged commit 776b31d into github:main-enterprise Aug 20, 2024
@klutchell
Copy link
Contributor

@decyjphr would it be too much trouble to drop an rc release with this change? ❤️

@decyjphr
Copy link
Collaborator

@klutchell I created 2.1.11-rc.2 hope that helps

@klutchell
Copy link
Contributor

Thanks!

admtorgst pushed a commit to helse-sorost/safe-settings that referenced this pull request Sep 14, 2024
…thub#665)

* feat: initial commit

* fix: merge deep code

* fix: lint

* fix: modification conditions

* fix: simplify conditions

---------

Co-authored-by: ls07667 <saxenaluv@johndeere.com>
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.

4 participants