Skip to content

fix(scan): serialize status and reason in JSON and YAML scan output - #2385

Merged
dan-petty merged 1 commit into
mainfrom
fix/2107-scan-output-status
Oct 27, 2026
Merged

dan-petty merged 1 commit into
mainfrom
fix/2107-scan-output-status

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Summary

devops scan trivy|sast|secrets with --format json or yaml printed only the findings list. A scan that gave no result (not installed, failed, not_applicable) printed []. The empty list read as a clean scan.

What changes:

  • devops scan trivy, devops scan secrets, devops scan sast, and devops scan iac serialize a mapping with status, reason, and findings for JSON and YAML formats.
  • A scan that gave no result prints the status and the reason next to an empty findings list, never only [].
  • tests/test_scan.py tests JSON and YAML output formats for unrun, failed, clean, and positive scanner runs.
  • tests/test_security_semgrep.py asserts against the serialized dictionary output.

Evidence:

  • uv run devops ci fail-to-pass --base origin/main reports 19 failures on base and 0 on this branch.
  • uv run pytest tests/test_scan.py tests/test_security_semgrep.py tests/test_security_gitleaks.py passes (86 tests).

Item

Closes #2107

Change:
openspec/changes/archive/2026-10-27-2107-scan-output-status/

## Summary

devops scan trivy|sast|secrets with --format json or yaml printed
only the findings list. A scan that gave no result (not installed,
failed, not_applicable) printed []. The empty list read as a clean
scan.

What changes:

- devops scan trivy, devops scan secrets, devops scan sast, and
devops scan iac serialize a mapping with status, reason, and
findings for JSON and YAML formats.
- A scan that gave no result prints the status and the reason next to
an empty findings list, never only [].
- tests/test_scan.py tests JSON and YAML output formats for unrun,
failed, clean, and positive scanner runs.
- tests/test_security_semgrep.py asserts against the serialized
dictionary output.

Evidence:

- uv run devops ci fail-to-pass --base origin/main reports 19 failures
on base and 0 on this branch.
- uv run pytest tests/test_scan.py tests/test_security_semgrep.py
tests/test_security_gitleaks.py passes (86 tests).

## Item

Closes #2107

Change:
openspec/changes/archive/2026-10-27-2107-scan-output-status/
@dan-petty
dan-petty marked this pull request as ready for review October 27, 2026 21:10
@dan-petty
dan-petty merged commit d594b55 into main Oct 27, 2026
16 checks passed
@dan-petty
dan-petty deleted the fix/2107-scan-output-status branch October 27, 2026 21:10
dan-petty pushed a commit that referenced this pull request Oct 27, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.8.0](v0.7.4...v0.8.0)
(2026-10-27)


### Features

* **github:** devops gh issues view shows one issue
([#2374](#2374))
([63be7ed](63be7ed)),
closes [#2361](#2361)
* **repos:** make devops repos worktrees add remove merged worktrees
first ([#2351](#2351))
([6d3a18a](6d3a18a)),
closes [#2338](#2338)


### Bug Fixes

* **k8s:** devops k8s configure-urls saves a run that changes only the
task gateway urls
([#2384](#2384))
([1a7e7c7](1a7e7c7))
* **k8s:** exit non-zero when kube-linter is unavailable or reports
findings ([#2386](#2386))
([31c5a0b](31c5a0b)),
closes [#2095](#2095)
* **scan:** serialize status and reason in JSON and YAML scan output
([#2385](#2385))
([d594b55](d594b55))

---
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(scan): the json and yaml output of devops scan holds the status and the reason of the scan, so a scan with no result does not read as clean

1 participant