Repository navigation
Description
Friction
The SARIF export of a review (#1983) carries each ToolRun in the run's property bag, but it writes no invocations for a run. SARIF 2.1.0 says an invocation SHALL hold executionSuccessful (section 3.20.14), and the exit code alone does not tell success. A ToolRun holds neither the exit code nor the success of the run.
What should happen
- A
ToolRunholds its exit code and the success of the run as its scanner decides it (a scanner decides from the exit code and the parsed output together,security/base.py_handle_json_output). - The SARIF export writes one invocation for each record, with
executionSuccessful,exitCodeand acommandLine. The argv placeholders{targets},{config}and{ruleset}go inrun.redactionTokens(sections 3.5.2 and 3.14.28).
Evidence
- OASIS SARIF 2.1.0 Errata 01, sections 3.20.14, 3.5.2 and 3.14.28.
src/devops_cli/security/tool_executor.py:ToolRunhas no exit code field.- Acceptance criterion 1 of feat(review): the SARIF export of a review carries the ToolRun of each scan under its SARIF 2.1.0 names #1983 ("A ToolRun holds the exit code"), which the feat(review): the SARIF export of a review carries the ToolRun of each scan under its SARIF 2.1.0 names #1983 pull request does not deliver.
Order
After #1982, because the change adds a field that tests/support/fakes/tool_executor.py must record.
Source: #1983
Proposed design
Problem statement
The SARIF export of a review carries each ToolRun in the run property bag but writes no invocations. SARIF 2.1.0 requires an invocation to hold executionSuccessful (section 3.20.14). A ToolRun holds neither the exit code nor the success of the run. This issue adds both to the record and makes the SARIF export write one invocation per run with executionSuccessful, exitCode, commandLine, and redactionTokens for the argv placeholders.
Acceptance criteria
- Criterion 1: ToolRun holds an exit_code field and a success field set by the scanner.
Verification: A unit test constructs a ToolRun with exit_code and success set and asserts both fields are present on the object. - Criterion 2: The SARIF export writes one invocation per ToolRun record with executionSuccessful, exitCode, and commandLine.
Verification: A test runs to_sarif on a review with at least one tool run and asserts the output JSON contains an invocations array with the three fields for each record. - Criterion 3: The placeholders {targets}, {config}, and {ruleset} in commandLine appear in run.redactionTokens.
Verification: A test asserts the SARIF output run.redactionTokens array contains the strings {targets}, {config}, and {ruleset}. - Criterion 4: ToolExecutorFake records the new exit_code and success fields on each ToolRun it builds.
Verification: A test scripts a ToolAnswer, calls run, and asserts the returned ToolRun has exit_code and success set to the scripted values.
Key questions
- Where do exit_code and success live: on ToolRun or on ToolResult?: On ToolRun, as the issue body states. ToolRun is currently frozen and built before the run, so the implementation must allow the fields to be set after the run completes. The scanner sets success; the executor sets exit_code. (proposed) [sources: src/devops_cli/security/tool_executor.py]
- Who decides the success of a run?: The scanner decides success from the exit code and the parsed output together, in _handle_json_output in security/base.py. The exit code alone does not tell success because tools such as Gitleaks and Semgrep exit with 1 when they find a result. [sources: src/devops_cli/security/base.py:457, openspec/changes/archive/2026-10-24-1983-sarif-carries-tool-runs/design.md]
- What is the commandLine of the invocation?: The argv_template of the ToolRun, which is the command with a placeholder for each path argument that names a target, a config file, or a ruleset file. [sources: src/devops_cli/security/tool_executor.py]
- What strings go in run.redactionTokens?: The three placeholder strings: {targets}, {config}, and {ruleset}. SARIF section 3.14.28 requires redactionTokens when a redactable property such as commandLine has been redacted, and section 3.5.2 defines what is redactable. [sources: openspec/changes/archive/2026-10-24-1983-sarif-carries-tool-runs/design.md]
- How is ToolRun updated after the run given it is currently frozen?: The implementation removes the frozen constraint from ToolRun or builds the final ToolRun after the run completes. The executor sets exit_code after _start returns, and the scanner sets success after _handle_json_output decides it. RecordingToolExecutor stores the completed ToolRun. (proposed) [sources: src/devops_cli/security/tool_executor.py]
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
- StatusShow more project fieldsNew
Activity
dan-petty commentedon Oct 24, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.
The candidate adds new functionality to record exit codes and success in ToolRun.The change improves correctness of SARIF export but does not block other work.The failed run 1983 does not set P0: the author has no write access, and no caller attached it as evidence. A person can set P0 on the board.The change helps tools that use SARIF export by providing correct execution status.Requires modifying ToolRun and SARIF export logic, plus updating tests.feat(review): the SARIF export of a review carries the ToolRun of eac…
dan-petty commentedon Oct 28, 2026
Status set to Ready at bb46660 (see proposed design in issue body).
feat(review): the SARIF export writes how each tool run ended (#2620)
chore(main): release 0.15.0 (#2623)