Skip to content

chore: fix transitive dependencies being marked as directly upgradable#582

Open
CatalinSnyk wants to merge 2 commits intomainfrom
chore/CLI-1375_ufm_remediation_for_direct_dependencies
Open

chore: fix transitive dependencies being marked as directly upgradable#582
CatalinSnyk wants to merge 2 commits intomainfrom
chore/CLI-1375_ufm_remediation_for_direct_dependencies

Conversation

@CatalinSnyk
Copy link
Copy Markdown
Contributor

@CatalinSnyk CatalinSnyk commented Apr 8, 2026

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.json to the newer TestAPI structure in order to add it as a test case for the human readable output.

Checklist

  • Tests added and all succeed (make test)
  • Regenerated mocks, etc. (make generate)
  • Linted (make lint)
  • Test your changes work for the CLI

@snyk-io
Copy link
Copy Markdown

snyk-io bot commented Apr 8, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@snyk-io
Copy link
Copy Markdown

snyk-io bot commented Apr 8, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@CatalinSnyk CatalinSnyk force-pushed the chore/CLI-1375_ufm_remediation_for_direct_dependencies branch from 7675487 to 91c0e0c Compare April 9, 2026 09:54
@CatalinSnyk CatalinSnyk changed the title chore: ensure transitive dependencies are not presented as directly upgradable in the remediation summary chore: ensure transitive dependencies are not directly upgradable in the remediation summary Apr 9, 2026
@CatalinSnyk CatalinSnyk changed the title chore: ensure transitive dependencies are not directly upgradable in the remediation summary chore: fix transitive dependencies being marked as directly upgradable Apr 9, 2026
matchedPaths++
fromPkg := depPath[1]
toPkg := upgradePath.DependencyPath[1]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the main fix to ensure transitive dependency upgrades are not reported as directly upgradable.

@CatalinSnyk CatalinSnyk marked this pull request as ready for review April 9, 2026 12:45
@CatalinSnyk CatalinSnyk requested review from a team as code owners April 9, 2026 12:45
@snyk-pr-review-bot
Copy link
Copy Markdown

PR Reviewer Guide 🔍

🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected
📚 Repository Context Analyzed

This review considered 9 relevant code sections from 6 files (average relevance: 0.99)

}

// Filter out unresolved issues that are already covered by a pin.
summary.Unresolved = filterUnresolvedCoveredByPins(summary.Unresolved, summary.Pins)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

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.

1 participant