chore: fix transitive dependencies being marked as directly upgradable#582
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
7675487 to
91c0e0c
Compare
| matchedPaths++ | ||
| fromPkg := depPath[1] | ||
| toPkg := upgradePath.DependencyPath[1] | ||
|
|
There was a problem hiding this comment.
This is the main fix to ensure transitive dependency upgrades are not reported as directly upgradable.
This comment has been minimized.
This comment has been minimized.
| } | ||
|
|
||
| // Filter out unresolved issues that are already covered by a pin. | ||
| summary.Unresolved = filterUnresolvedCoveredByPins(summary.Unresolved, summary.Pins) |
There was a problem hiding this comment.
Added this to match the logic in the legacy implementation. I didn't add another fixture file in this PR, but I left an action items for adding a Python project one in CLI-1349, and settled for just a unit test case for now.
91c0e0c to
b713ca0
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| if pinnedIssueIDs[issue.GetID()] { | ||
| continue | ||
| } | ||
| filtered = append(filtered, issue) |
There was a problem hiding this comment.
Suggestion: It seems that none of the test cases covers the case that something isn't filtered. Let's add this, maybe to one of the existing cases.
PR Reviewer Guide 🔍
|
Description
In certain cases the Remediation Summary would count transitive dependency upgrades as directly upgradable. This would results in incorrect upgrade advice (e.g.
Upgrade from x@1.2.3 to x@1.2.3- since the actual upgrade would be inside for a nested dependency).The changes should allign the remediation summary building with the legacy implementation that can be found here. In terms of tests, I added a few more cases to the remedation testing logic to get the coverage to 85%, but I also slightly updated the
testresults_cli.jsonto the newer TestAPI structure in order to add it as a test case for the human readable output.Checklist
make test)make generate)make lint)