Skip to content

feat: add new consolidated --print-graph flag [CSENG-181]#6706

Open
snyk-abedonik wants to merge 1 commit intofeat/CSENG-173_allow_incomplete_sbomfrom
feat/CSENG-181/add-new-consolidated-print-graph-flag
Open

feat: add new consolidated --print-graph flag [CSENG-181]#6706
snyk-abedonik wants to merge 1 commit intofeat/CSENG-173_allow_incomplete_sbomfrom
feat/CSENG-181/add-new-consolidated-print-graph-flag

Conversation

@snyk-abedonik
Copy link
Copy Markdown

@snyk-abedonik snyk-abedonik commented Apr 6, 2026

Pull Request Submission Checklist

  • Follows CONTRIBUTING guidelines
  • Commit messages
    are release-note ready, emphasizing
    what was changed, not how.
  • Includes detailed description of changes
  • Contains risk assessment (Low | Medium | High)
  • Highlights breaking API changes (if applicable)
  • Links to automated tests covering new functionality
  • Includes manual testing instructions (if necessary)
  • Updates relevant GitBook documentation (PR link: ___)
  • 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.

What are the relevant tickets?

CSENG-181

@snyk-abedonik snyk-abedonik requested review from a team as code owners April 6, 2026 09:27
@snyk-io
Copy link
Copy Markdown

snyk-io bot commented Apr 6, 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-pr-review-bot

This comment has been minimized.

@snyk-abedonik snyk-abedonik force-pushed the feat/CSENG-181/add-new-consolidated-print-graph-flag branch from 5e47b2d to eff54d7 Compare April 6, 2026 09:50
@snyk-pr-review-bot

This comment has been minimized.

@snyk-abedonik snyk-abedonik force-pushed the feat/CSENG-181/add-new-consolidated-print-graph-flag branch from eff54d7 to ac72e3d Compare April 9, 2026 21:36
@snyk-pr-review-bot

This comment has been minimized.

@snyk-abedonik snyk-abedonik force-pushed the feat/CSENG-181/add-new-consolidated-print-graph-flag branch from ac72e3d to 78de39c Compare April 9, 2026 21:37
@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 27 relevant code sections from 9 files (average relevance: 0.92)

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