fix(review): exit code reflects filtered findings (#312)#318
Merged
Conversation
This was referenced Jun 17, 2026
Previously `cora review` could exit 2 (EXIT_BLOCKED) even when the `--severity` filter removed all blocking findings and the SARIF output contained 0 error-level results. This blocked PR merges in CI when Cora Review was configured as a required status check. Root cause: `should_block` was computed by the engine using `config.hook.min_severity`, but the exit-code logic used the same `should_block` flag without re-checking against the **filtered** issue list (after CLI `--severity` filtering). So a Major finding with `--severity critical` would still cause exit 2 even though the filtered output shown to the user had no findings. Fix: - Recompute `should_block` on `filtered_response` after severity filtering, so exit code matches what the user sees (both in the single-chunk and `--auto-chunk` paths). - Extract exit-code logic into `compute_exit_code()` pure helper with 8 unit tests (gate pass/fail, CI mode, hook block vs non-block). Bump 0.6.0 -> 0.6.1 (patch).
ec5855b to
0939d90
Compare
This was referenced Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #312 —
cora reviewexits code 2 despite valid SARIF and zero blocking findings on larger diffs.Root cause
should_blockwas computed by the engine usingconfig.hook.min_severity. The exit-code logic then used the sameshould_blockflag without re-checking against the filtered issue list (after CLI--severityfiltering).So when a Major finding existed but the user passed
--severity critical, the filtered output shown to the user had 0 findings, yetcora reviewstill exited 2 (EXIT_BLOCKED) becauseshould_blockwas still true. This broke required-status-check CI configs.Changes
src/commands/review.rsshould_blockonfiltered_responseafter severity filtering, in both the single-chunk path and the--auto-chunkpath. Exit code now matches what the user sees.compute_exit_code(gate_status, ci, filtered_response, hook_mode)— no hidden state, easy to test.blockvs non-block, and the core regression (bug:cora reviewexits code 2 despite valid SARIF and zero blocking findings (larger diffs) #312) where filtered issues are empty.Tests
src/commands/review.rs.cargo test commands::review— 8/8 pass.cargo clippy -- -D warningsclean,cargo fmtapplied.Versioning
Patch bump
0.6.0→0.6.1(shares the release with #316 and #313).Cargo.tomlwill conflict with #317 (scan fix) and the upcoming #313 PR. Suggested merge order: #317 → this PR → #313. The conflicts are confined to the## [0.6.1]block ofCHANGELOG.mdand the version line inCargo.toml/Cargo.lock.Checklist
cargo testpassescargo clippy -- -D warningscleancargo fmtapplied## [0.6.1]→### Fixed — ReviewCargo.toml+Cargo.lock