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
The existing --print-effective-graph and --print-effective-graph-with-errors flags were designed as monolithic toggles that each bundled output format and content concerns together. This made it difficult to extend or compose behaviour without introducing yet more flag combinations.
This PR introduces a new consolidated --print-graph flag as the single entry point for requesting dependency graph output, with orthogonal toggles controlling independent axes of behaviour:
--jsonl-output — emit the graph as JSONL instead of plain text
--effective-graph — return the pruned/effective graph
--print-errors — include resolution errors in the output
The legacy flags (--print-effective-graph, --print-effective-graph-with-errors) are preserved and handled via a compatibility path in chooseGraphArgument, so existing callers are not broken.
The SBOM resolution path (sbom_resolution.go) has been migrated to use the new consolidated flags (--print-graph + --jsonl-output + --print-errors), replacing the previous direct use of --print-effective-graph-with-errors.
The executeLegacyWorkflow function unsets FlagPrintEffectiveGraph and FlagPrintEffectiveGraphWithErrors without setting FlagPrintEffectiveGraph back to true in the new configuration. In the legacy implementation (see old hunk), it requested a pruned/effective graph. In the new implementation, because FlagPrintEffectiveGraph is missing, prepareLegacyFlags in legacy_resolution.go will not append the --effective-graph modifier. This causes the fallback resolution to return a full dependency graph instead of a pruned one, which likely breaks downstream logic expecting a resolved/effective graph.
In chooseGraphArgument, when FlagPrintGraph is enabled, the parser defaults to PlainText unless FlagJSONLOutput is explicitly set. If a user provides FlagPrintEffectiveGraph (via --effective-graph) but omits the JSONL toggle, the system will use a PlainText parser. However, evidence from the legacy paths (lines 50, 53, 56) shows that effective graphs are always returned in JSONL format. Attempting to parse JSONL output with a PlainText parser will result in a failure to extract the graph or any errors associated with it.
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.
What this does
The existing
--print-effective-graphand--print-effective-graph-with-errorsflags were designed as monolithic toggles that each bundled output format and content concerns together. This made it difficult to extend or compose behaviour without introducing yet more flag combinations.This PR introduces a new consolidated
--print-graphflag as the single entry point for requesting dependency graph output, with orthogonal toggles controlling independent axes of behaviour:--jsonl-output— emit the graph as JSONL instead of plain text--effective-graph— return the pruned/effective graph--print-errors— include resolution errors in the outputThe legacy flags (
--print-effective-graph,--print-effective-graph-with-errors) are preserved and handled via a compatibility path inchooseGraphArgument, so existing callers are not broken.The SBOM resolution path (
sbom_resolution.go) has been migrated to use the new consolidated flags (--print-graph+--jsonl-output+--print-errors), replacing the previous direct use of--print-effective-graph-with-errors.