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?
Introduces a new composable --print-graph flag set that supersedes the legacy monolithic flags (--print-effective-graph, --print-effective-graph-with-errors). The old flags remain fully functional during the migration window.
New flags:
Flag
Purpose
--print-graph
Master switch — enables dep-graph output
--effective-graph
Request the pruned/effective dependency graph
--jsonl-output
Emit one JSON object per line (JSONL format)
--print-errors
Include failed-project error entries in the output stream
The core of the change is a new getPrintGraphMode() function that acts as a single source of truth — it reads both new and legacy flags and returns a canonical PrintGraphMode struct. All graph-printing paths across the codebase now derive their behavior from this struct.
Where should the reviewer start?
Start with getPrintGraphMode() and the PrintGraphMode interface in common.ts — everything else follows from there.
How should this be manually tested?
1. Plain graph output (no regression):
snyk test --print-graph
2. Legacy flags still work:
snyk test --print-effective-graph
snyk test --print-effective-graph-with-errors
3. New flags produce equivalent output:
snyk test --print-graph --effective-graph --jsonl-output
snyk test --print-graph --effective-graph --jsonl-output --print-errors
4. Unmanaged ecosystem (C/C++) with JSONL:
snyk test --unmanaged --print-graph --jsonl-output
What's the product update that needs to be communicated to CLI users?
A new composable --print-graph flag family is now available. It replaces --print-effective-graph and --print-effective-graph-with-errors with finer-grained controls (--effective-graph, --jsonl-output, --print-errors). Legacy flags remain supported.
Risk assessment (Low | Medium | High)?
Low. The change is purely additive — no existing flags are removed. Legacy flags continue to work via a backward-compatible shim. Unit tests cover both old and new paths.
Any background context you want to provide?
The legacy flags coupled three orthogonal behaviors (graph mode, output format, error inclusion) into a single switch. CSENG-181 breaks these apart into composable primitives so that the SBOM extension and other consumers can request exactly the output shape they need.
We'll also need to update some of the plugins to reflect the new flags too, so that we return effective graphs in the case of --print-graph --effective-graph. For instance, the Maven plugin here will need updating with something like this
The updated shouldPrintDepGraph logic now explicitly returns false if shouldPrintEffectiveDepGraph(opts) is true. This introduces a mutual exclusivity between the raw graph output and the effective (pruned) graph output. Previously, if a user provided flags that satisfied both, they might have received both outputs; now the raw graph is suppressed whenever an effective graph flag is present.
Requested graph output flags (print-graph or effective graph flags) now automatically trigger enableMavenDverboseExhaustiveDeps. This links output formatting preferences to the internal dependency resolution strategy for Maven. While often desired, this can significantly increase scan times and change the resulting tree structure for Maven projects simply because a user wanted to see the graph.
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?
Introduces a new composable
--print-graphflag set that supersedes the legacy monolithic flags (--print-effective-graph,--print-effective-graph-with-errors). The old flags remain fully functional during the migration window.New flags:
--print-graph--effective-graph--jsonl-output--print-errorsThe core of the change is a new
getPrintGraphMode()function that acts as a single source of truth — it reads both new and legacy flags and returns a canonicalPrintGraphModestruct. All graph-printing paths across the codebase now derive their behavior from this struct.Where should the reviewer start?
Start with
getPrintGraphMode()and thePrintGraphModeinterface incommon.ts— everything else follows from there.How should this be manually tested?
1. Plain graph output (no regression):
snyk test --print-graph2. Legacy flags still work:
3. New flags produce equivalent output:
4. Unmanaged ecosystem (C/C++) with JSONL:
snyk test --unmanaged --print-graph --jsonl-outputWhat's the product update that needs to be communicated to CLI users?
A new composable
--print-graphflag family is now available. It replaces--print-effective-graphand--print-effective-graph-with-errorswith finer-grained controls (--effective-graph,--jsonl-output,--print-errors). Legacy flags remain supported.Risk assessment (Low | Medium | High)?
Low. The change is purely additive — no existing flags are removed. Legacy flags continue to work via a backward-compatible shim. Unit tests cover both old and new paths.
Any background context you want to provide?
The legacy flags coupled three orthogonal behaviors (graph mode, output format, error inclusion) into a single switch. CSENG-181 breaks these apart into composable primitives so that the SBOM extension and other consumers can request exactly the output shape they need.
What are the relevant tickets?
CSENG-181