Skip to content

feat(review): the SARIF export writes how each tool run ended - #2620

Merged
dan-petty merged 2 commits into
mainfrom
feat/2100-toolrun-exit-code-sarif-invocation
Oct 29, 2026
Merged

dan-petty merged 2 commits into
mainfrom
feat/2100-toolrun-exit-code-sarif-invocation

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

A ToolRun now holds exit_code and success. The code that runs a tool decides success from the exit code and the output together, and settles the run with ToolExecutor.settle. RecordingToolExecutor keeps the settled record in the place of the run, and refuses a second settle. The scanner base, the Trivy SBOM, mypy and the canary settle their runs. A run that timed out or that a signal ended holds no exit code (SARIF 2.1.0, 3.20.9).

The SARIF export of a review writes one invocation for each settled record, with executionSuccessful, exitCode and commandLine. The placeholders {targets}, {config} and {ruleset} that the command lines hold go in run.redactionTokens (3.5.2, 3.14.28). Each tool that has a record now gets a run: it has empty results when every run succeeded, and no results otherwise (3.14.23). The Tool Runs table of review.md shows the exit code and the success.

versionControlProvenance stays with #2101.

Closes #2100

A ToolRun now holds exit_code and success. The code that runs a tool
decides success from the exit code and the output, and settles the run
with ToolExecutor.settle. RecordingToolExecutor keeps the settled record
in the place of the run. The scanner base, the Trivy SBOM, mypy and the
canary settle their runs.

The SARIF export writes one invocation for each settled record, with
executionSuccessful, exitCode and commandLine. The placeholders of the
command lines are the redaction tokens of the run. Each tool that has a
record gets a run. The Tool Runs table shows the exit code and success.

Refs #2100
@dan-petty

Copy link
Copy Markdown
Owner Author

Test results for #2100.

Fail first (on the code before the change): 25 new or changed tests failed in tests/test_review_tool_runs.py, tests/security/test_sarif_emission.py and tests/test_tool_executor_contract.py. ToolRun had no exit_code, and no executor had settle. The golangci-lint test that moved from a MagicMock for _run_tool to the scanner fake passed before and after.

Pass after the change:

  • Focused suites (test_review_tool_runs, test_sarif_emission, test_tool_executor_contract with the bubblewrap cases, test_golangci_lint_scanner, test_sbom): 206 passed, after the rebase onto 38a0a44.
  • Wider run of the scanner, review and security suites: 12,661 passed in 11 m 54 s on a loaded host.
  • test_a_review_profile_holds_one_row_per_tool_run_with_every_field now also checks that each review scan settles its run: a record with no exit_code or success is an empty field there.
  • Each emitted document in the new tests validates against the vendored SARIF 2.1.0 schema.
  • ruff check, ruff format, mypy on the 7 changed source files, devops docs check and devops openspec check passed.

Premise: SARIF 2.1.0 Errata 01, sections 3.5.2, 3.14.11, 3.14.23, 3.14.28, 3.20.2, 3.20.3, 3.20.9 and 3.20.14, read on 2026-10-29. The proposal quotes them.

@dan-petty
dan-petty marked this pull request as ready for review October 29, 2026 04:03
@dan-petty
dan-petty merged commit 8f8ef44 into main Oct 29, 2026
17 checks passed
@dan-petty
dan-petty deleted the feat/2100-toolrun-exit-code-sarif-invocation branch October 29, 2026 04:17
dan-petty pushed a commit that referenced this pull request Oct 29, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.15.0](v0.14.0...v0.15.0)
(2026-10-29)


### Features

* **k8s:** derived push entries, Secret types, one stack list
([#2618](#2618))
([3634c6f](3634c6f)),
closes [#2008](#2008)
* **k8s:** image-pins refuses an image on the latest tag
([#2617](#2617))
([548b3ba](548b3ba)),
closes [#2093](#2093)
* **monitoring:** alert when a noeviction Valkey nears its bound
([#2615](#2615))
([f452644](f452644)),
closes [#2094](#2094)
* **review:** golangci-lint runs offline in the review sandbox
([#2622](#2622))
([20915ce](20915ce)),
closes [#2129](#2129)
* **review:** the SARIF export writes how each tool run ended
([#2620](#2620))
([8f8ef44](8f8ef44)),
closes [#2100](#2100)


### Bug Fixes

* **release:** parse release pull request number safely in urgent merge
([#2621](#2621))
([262244d](262244d))

---
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.

feat(review): a tool run records its exit code and its success, and the SARIF export writes one invocation for each run

1 participant