Repository navigation
fix(hooks): stop a resolved environment finding from blocking a commit - #101
Draft
mrpmohiburrahman wants to merge 1 commit into
Draft
mrpmohiburrahman wants to merge 1 commit into
mrpmohiburrahman wants to merge 1 commit into
Conversation
The hook policy counted every environment finding, whatever its lifecycle. A finding that reached RESOLVED still refused the commit, while `review --fail-on`, `ci review --annotations` and SARIF all skip it. Skip it here too, and keep printing it. Test: a complete review with one resolved environment finding now passes with `mode=block`. It failed on main with exit 1.
This branch has not been deployed
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.
Problem
A hook with
proofline.hook.<hook>.mode=blockrefuses a commit or push while an open finding is at or abovefailOn.reaches_fail_oninsrc/hooks.rscounts every environment finding, whatever itslifecycle_state. So one environment finding that is alreadyRESOLVEDblocks every later commit, andgit commit --no-verifyis the only way through.The other readers of the same policy skip a resolved finding:
outcome::findings_reachskips it forreview --fail-on.outcome::code_reachesskips it in the CODE lane.annotations::writeskips it forci review --annotationsand SARIF.Only the Git hook counts it. The same review passes
review --fail-on seriousand blocksgit commit. That difference is the bug.Reproduction
The new test does this:
COMPLETEDpatch review with one environment assessment and oneSERIOUSfinding whoselifecycle_stateisRESOLVED.proofline.hook.pre-commit.mode=block.proofline hook run pre-commit.On
mainthe command exits 1 withProofline blocked this commit: a finding at or above SERIOUS. With this change it exits 0 and still prints the finding.Change
The environment lane now skips a finding whose
lifecycle_stateisRESOLVED, as the CODE lane already does. The finding still prints, so the developer sees what was fixed.Verification
cargo test --test hookspasses.cargo clippy --all-targets -- -D warningsis clean.mainand passes after the change.Scope
One predicate in
src/hooks.rsand one test intests/hooks.rs.