Skip to content

fix(scan): keep scan progress off stdout when the output format is json - #2331

Merged
dan-petty merged 1 commit into
mainfrom
fix/2216-scan-json-stdout
Oct 27, 2026
Merged

dan-petty merged 1 commit into
mainfrom
fix/2216-scan-json-stdout

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Issue #2216: scan commands write progress lines to stdout before the JSON payload. A parser on stdout fails on the mixed stream.

Gate each progress print on the resolved output format. Progress appears only in table mode:

  • trivy, secrets, sast, iac, complexity, workflows
  • aibom (table mode, only when no output file is set; aibom has no --json option)
    injection and sbom already gate correctly.

New tests assert stdout is valid JSON for --json and --format json on every scan subcommand.

Fail-to-pass: 12 failed on base, 0 failed after the fix (tests/test_scan.py).
Closes #2216
Change: 2026-10-27-2216-scan-json-stdout

Issue #2216: scan commands write progress lines to stdout before the
JSON payload. A consumer that parses stdout fails on the mixed stream.

Gate each progress print on the resolved output format:
- trivy, secrets, sast, iac, complexity, workflows print progress
  only in table mode
- aibom prints progress only in table mode and only when no output
  file is set; aibom has no --json option
- injection and sbom already gate correctly

Add tests that assert stdout is valid JSON for --json and
--format json on every scan subcommand.

Closes #2216
Change: 2026-10-27-2216-scan-json-stdout
@dan-petty
dan-petty marked this pull request as ready for review October 27, 2026 03:54
@dan-petty
dan-petty merged commit 1b17048 into main Oct 27, 2026
16 checks passed
@dan-petty
dan-petty deleted the fix/2216-scan-json-stdout branch October 27, 2026 03:55
dan-petty pushed a commit that referenced this pull request Oct 27, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.7.0](v0.6.5...v0.7.0)
(2026-10-27)


### Features

* **ci:** limit how many CPU-heavy gates run at once on one host
([#2339](#2339))
([115d1c1](115d1c1)),
closes [#2336](#2336)
* **ci:** make devops ci wait for a gate slot before a CPU-heavy check
([#2343](#2343))
([518db63](518db63)),
closes [#2336](#2336)
* **devcontainer:** onboard Kilo Code with a kilo.jsonc that exposes the
devops-cli MCP server
([#2332](#2332))
([3a6189e](3a6189e))
* **openspec:** commit the OpenSpec skills for Kilo Code
([#2334](#2334))
([9b4a824](9b4a824)),
closes [#2333](#2333)
* **repos:** add devops repos worktrees add that refuses a held issue
([#2348](#2348))
([a3b164d](a3b164d)),
closes [#2337](#2337)


### Bug Fixes

* **deps:** upgrade dnspython to fix GHSA-45c3-73f7-pv4m
([#2350](#2350))
([f50459d](f50459d))
* **k8s:** k8s apply renders the preview under --dry-run and starts no
child process
([#2328](#2328))
([16e26b0](16e26b0)),
closes [#2312](#2312)
* **k8s:** name the keyring entry when the Grafana admin password is
missing ([#2335](#2335))
([f9dcc79](f9dcc79))
* **repos:** worktrees prune removes only worktrees of merged pull
requests ([#2342](#2342))
([23d864d](23d864d)),
closes [#2341](#2341)
* **scan:** keep scan progress off stdout when the output format is json
([#2331](#2331))
([1b17048](1b17048)),
closes [#2216](#2216)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
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.

fix(cli): devops scan commands print their progress line on stdout before the JSON, so --json output does not parse

1 participant