Repository navigation
Description
Split from #5072.
Problem
ADR 0005 counts a tool's findings only when its output on a canary matches the recorded expected output. CONST_CANARY_TOOLS in src/devops_cli/config/constants.py:5611 lists semgrep, ruff, bandit, mypy, kube-linter and pluto, and tests/fixtures/review_canary/recorded_outputs.json holds no golangci-lint entry, so a Go review's golangci-lint findings do not pass the gate.
The original issue asks that a golangci-lint 2.15.0 scan of a Go tree give the same findings as the 1.64.8 scan of the same tree. The devtools image ships only 2.15.0, and the repository holds no recorded 1.64.8 output, so that comparison cannot run.
Why this part is deferred
The v2 flag and config move in #5072 does not depend on the canary. The canary needs its own Go fixture, a build_canary_request entry, a SARIF parser for evaluate_canary_gate and a recorded output, so it is a separate change.
Acceptance criteria
CONST_CANARY_TOOLSnames golangci-lint, andbuild_canary_request("golangci-lint", workdir)builds a run on a Go fixture tree.tests/fixtures/review_canary/recorded_outputs.jsonholds the SARIF output of golangci-lint 2.15.0 on that fixture.evaluate_canary_gate("golangci-lint", recorded_output)passes, and a change to a flag, the config or the tool version makes it fail.
Proposed design
Problem statement
A Go review uses golangci-lint, but the review gate has no recorded golangci-lint canary output. The gate does not count golangci-lint findings. The change adds a Go fixture, a golangci-lint 2.15.0 SARIF record and a gate comparison. The 1.64.8 comparison stays out because no 1.64.8 output exists.
Acceptance criteria
Requirement: Canary tool list includes golangci-lint
The canary tool list SHALL include golangci-lint.
Scenario: List membership
- WHEN a test reads
CONST_CANARY_TOOLS - THEN the tuple contains
golangci-lint.
Requirement: Canary request scans the Go fixture
build_canary_request SHALL build a golangci-lint command that scans the Go fixture tree and writes SARIF output.
Scenario: Build request for golangci-lint
- WHEN a test calls
build_canary_request("golangci-lint", workdir) - THEN the returned command includes
workdirand--output.sarif.path.
Requirement: Recorded golangci-lint SARIF
The recorded canary outputs SHALL hold the SARIF output of golangci-lint 2.15.0 on the Go fixture.
Scenario: Recorded entry
- WHEN a test loads
recorded_outputs.jsonforgolangci-lint - THEN the entry has version
2.15.0and SARIF with at least one result atcanary.go.
Requirement: Canary gate accepts recorded output
evaluate_canary_gate SHALL pass the recorded golangci-lint SARIF output.
Scenario: Recorded output passes
- WHEN a test calls
evaluate_canary_gate("golangci-lint", recorded_output) - THEN the gate reports a pass.
Requirement: Canary gate rejects drift
evaluate_canary_gate SHALL fail when a flag, the config or the tool version changes the golangci-lint SARIF.
Scenario: Output drift
- WHEN a test changes the tool version or a result in the recorded SARIF
- THEN the gate reports a failure.
Existing Tool Considered
No alternatives check has run. golangci-lint 2.15.0 is the open, maintained tool that covers the Go scan and its SARIF output. It lacks the project canary fixture, the CONST_CANARY_TOOLS entry and the SARIF normalizer. The proposal builds a small normalizer and fixture. The cost is about 2,000 tokens to build, 500 to keep and 1,000 to fix, and about 3 hours.
Key questions
- Which output format should the golangci-lint canary record?: Record SARIF. The gate needs structured findings. The existing canary fixture already stores SARIF for ruff. SARIF gives the tool version, rule and location for drift. (best practice) [sources: tests/fixtures/review_canary/recorded_outputs.json, src/devops_cli/review/canary.py:613]
- Chosen: SARIF. It carries the tool version, rule and location fields that the gate compares.
- Rejected: golangci-lint JSON. It has no SARIF tool metadata and no stable rule location block.
- Rejected: Plain text output. It changes with formatting and is hard to compare by rule and location.
- Which Go fixture and config should the canary use?: Add
tests/fixtures/review_canary/go/withgo.mod, a v2.golangci.ymlthat enables onlygovet, andcanary.gowith afmt.Printfformat mismatch. The fixture gives one deterministic finding and needs no network. (best practice) [sources: src/devops_cli/review/canary.py:570, tests/security/test_review_canary.py:175, tests/fixtures/review_canary/recorded_outputs.json]- Chosen: Minimal govet printf fixture. It compiles, needs no network and gives one stable finding.
- Rejected: Unused function fixture. It depends on the unused linter and whole-program analysis.
- Rejected: Real Go project fixture. It is large and its findings change with dependencies.
- How should
evaluate_canary_gatecompare golangci-lint SARIF?: Normalize SARIF to the tool version and a sorted list of result ruleId, level, message text, file basename and region. Compare that canonical form to the recorded form. (best practice) [sources: src/devops_cli/review/canary.py:613, tests/fixtures/review_canary/recorded_outputs.json]- Chosen: Canonical SARIF. It ignores volatile schema, URI prefix and ordering while it keeps version, rule and location.
- Rejected: Raw JSON equality. It fails on absolute paths, schema URLs and result order.
- Rejected: Text diff. It hides the rule and version fields that prove drift.
- Should the gate use a SARIF library or a project normalizer?: Use a project normalizer. The gate needs a few fields from one SARIF producer. The existing gate already compares recorded JSON. A library adds a dependency for a small comparison. (best practice) [sources: src/devops_cli/review/canary.py:613, tests/fixtures/review_canary/recorded_outputs.json]
- Chosen: Project normalizer. It uses the standard JSON parser and only the fields that the gate needs.
- Rejected:
sarif-omlibrary. It only parses SARIF; the gate still needs the canonical comparison. - Rejected: Raw JSON equality. It is unstable across paths and result order.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
devops-cli-service commentedon Nov 25, 2026
Both work on golangci-lint v2, but #5072 moves the flags and config while this item records a canary fixture and SARIF output for the gate.devops-cli-service commentedon Nov 25, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.
devops-cli-service commentedon Nov 29, 2026
Released in v0.251.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.251.0
devops-cli-service commentedon Nov 29, 2026
Live since 2026-11-29 18:59 UTC