You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Includes product update to be announced in the next stable release notes
What does this PR do?
When --print-effective-graph-with-errors is set, the legacy CLI can fail on individual projects during a multi-project scan. These changes catch those project failures and return them as failedResults instead of throwing, so downstream consumers can include them to annotate sboms. Changes made to both the single and multi plugin route and is robust against full and partial failure of manifest file/'s.
Where should the reviewer start?
get-deps-from-plugin.ts --> Wrap the plugin around a try/catch to ensure we always return something.
get-multi-plugin-result.ts --> We make sure to return failedResults to later parse into scanError.
What's the product update that needs to be communicated to CLI users?
Any background context you want to provide?
This is for the JPMC "fail-fast initative" --> the idea is to annotate sbom's with failures rather than print to stdout.
I've reviewed this and there is no data loss. In an event where there is a partial result, allResults.length is truthy, so the return block between lines 213-219 still gives us results for the extension-sbom to consume.
The failedResults containing project scan errors are only returned if the scan fails for all projects (where allResults.length is zero). In an 'incomplete SBOM' scenario where some projects succeed and others fail, the if (!allResults.length) block is bypassed. The TODO on line 171 confirms that these failures are not currently propagated back in the main return path. This means downstream consumers will not see failure annotations unless the entire scan fails.
if(!allResults.length){// When allow-incomplete-sbom is active, return instead of throwing// so the caller can print per-project JSONL error entriesif(options['print-effective-graph-with-errors']){return{plugin: {name: 'custom-auto-detect',},scannedProjects: allResults,
failedResults,};}
📚 Repository Context Analyzed
This review considered 6 relevant code sections from 6 files (average relevance: 1.05)
When print-effective-graph-with-errors is enabled and a single plugin scan fails, getDepsFromPlugin returns a MultiProjectResultCustom with an empty scannedProjects list. In src/lib/snyk-test/run-test.ts, the logic for generating payloads iterates over deps.scannedProjects. If this list is empty, no payloads are created, and assembleLocalPayloads returns an empty array. This can lead to the CLI exiting with a success code (0) even if the only project failed to scan, which contradicts expected behavior for a 'fail' scenario unless explicitly handled at the entry point.
In getMultiPluginResult, if allResults.length is 0 and the error flag is set, the function returns early. This bypasses the FailedToRunTestError throw and the errorMessageWithRetry logic. If downstream consumers do not specifically check failedResults and instead only check for the presence of scannedProjects, the system treats a total failure as an empty success. This may break CI/CD pipelines that rely on the CLI to fail when no valid manifests are found.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Submission Checklist
are release-note ready, emphasizing
what was changed, not how.
What does this PR do?
When --print-effective-graph-with-errors is set, the legacy CLI can fail on individual projects during a multi-project scan. These changes catch those project failures and return them as failedResults instead of throwing, so downstream consumers can include them to annotate sboms. Changes made to both the single and multi plugin route and is robust against full and partial failure of manifest file/'s.
Where should the reviewer start?
get-deps-from-plugin.ts --> Wrap the plugin around a try/catch to ensure we always return something.
get-multi-plugin-result.ts --> We make sure to return failedResults to later parse into scanError.
What's the product update that needs to be communicated to CLI users?
Any background context you want to provide?
This is for the JPMC "fail-fast initative" --> the idea is to annotate sbom's with failures rather than print to stdout.