-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: issue-5850 - Settle override conflicts between edges and propagate changes #7025
base: latest
Are you sure you want to change the base?
Conversation
This is going to need tests |
The edge's |
There are several bugs in the mechanism, and this is just the first fix. |
@wraithgar |
@wraithgar Anything else we need to do to merge this? |
@AlonNavon This looks awesome, really looking forward to having overrides work more the way you'd expect. With this change, will running |
@sgarfinkel The major bugs:
|
Just patience. Holidays are over and we got a lot of PRs. This PR is on the work board it's not been forgotten. |
Why was this closed? |
The PR wasn't made from the OP's fork, but presumably from their company's (which means that maintainers can't push to the PR branch, btw - always only make PRs from your own personal forks), and presumably someone at their company deleted the fork. |
Yeah, this was a mistake on our end. Our devops deleted the repo by accident. |
workspaces/arborist/lib/edge.js
Outdated
return depValid(node, this.spec, this.#accept, this.#from) | ||
|
||
// If there's no override we just use the spec. | ||
if (!this.overridden) { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
workspaces/arborist/lib/node.js
Outdated
} | ||
} | ||
|
||
static findSpecificOverrideSet (first, second) { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to just move it override-set.js
, since it fundamentally compares two override sets as is.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
workspaces/arborist/lib/node.js
Outdated
return first | ||
} | ||
} | ||
log.silly('Conflicting override sets', this, first, second) |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
workspaces/arborist/lib/edge.js
Outdated
return depValid(node, this.spec, this.#accept, this.#from) | ||
|
||
// If there's no override we just use the spec. | ||
if (!this.overrides) { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -142,6 +181,24 @@ class OverrideSet { | |||
|
|||
return ruleset | |||
} | |||
|
|||
static findSpecificOverrideSet (first, second) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdalton I moved the functions here, because fundamentally they are about comparing override sets, so this is the most natural location for them I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there anything else, or do you approve the PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlonNavon
I think it looks great. Could you add code comments inline explaining the cases when the .silly is called (the one you changed from throwing to .silly). This will help folks if they see the logging know why.
Then the only other thing is adding any unit tests to cover some of the things you discovered and tweaked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @wraithgar, can you run the tests? To make sure nothing got accidentally broken with all the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdalton For the override set functions I created unit tests. I'm not sure how to translate the test cases that I'm running to unit tests.
This is the package.json of the simplest case:
{ "name": "test", "version": "1.0.0", "engines": { "npm": ">=8.3.0" }, "dependencies": { "json-server": "0.17.0" }, "overrides": { "json-server": { "package-json": "7.0.0" } } }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. @wraithgar I think this is where we'll need your help to push it over the line. (one last test case and a review). 🎉
log.silly('Conflicting override sets', first, second) | ||
} | ||
|
||
static doOverrideSetsConflict (first, second) { | ||
// If override sets contain one another then we can try to use the more specific one. | ||
// This is imperfect, since we may lose some of the context of the less specific override | ||
// set. But the more specific override set is more important to propagate, so we go with it. |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
A first step in fixing the overrides feature. In this PR I'm aiming to fix 3 bugs:
So if we have dependency chains A->B->C and A->C, and we override C under B, then C will be overridden.
References
Fixes some of the override issues.