Skip to content

fix(hooks): stop a resolved environment finding from blocking a commit - #101

Draft
mrpmohiburrahman wants to merge 1 commit into
prooflinedev:mainfrom
mrpmohiburrahman:fix/hook-resolved-environment-finding
Draft

mrpmohiburrahman wants to merge 1 commit into
prooflinedev:mainfrom
mrpmohiburrahman:fix/hook-resolved-environment-finding

Conversation

@mrpmohiburrahman

Copy link
Copy Markdown

Problem

A hook with proofline.hook.<hook>.mode=block refuses a commit or push while an open finding is at or above failOn.

reaches_fail_on in src/hooks.rs counts every environment finding, whatever its lifecycle_state. So one environment finding that is already RESOLVED blocks every later commit, and git commit --no-verify is the only way through.

The other readers of the same policy skip a resolved finding:

  • outcome::findings_reach skips it for review --fail-on.
  • outcome::code_reaches skips it in the CODE lane.
  • annotations::write skips it for ci review --annotations and SARIF.

Only the Git hook counts it. The same review passes review --fail-on serious and blocks git commit. That difference is the bug.

Reproduction

The new test does this:

  1. It serves a COMPLETED patch review with one environment assessment and one SERIOUS finding whose lifecycle_state is RESOLVED.
  2. It sets proofline.hook.pre-commit.mode=block.
  3. It runs proofline hook run pre-commit.

On main the command exits 1 with Proofline 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_state is RESOLVED, as the CODE lane already does. The finding still prints, so the developer sees what was fixed.

Verification

  • cargo test --test hooks passes.
  • cargo clippy --all-targets -- -D warnings is clean.
  • The new test fails on main and passes after the change.

Scope

One predicate in src/hooks.rs and one test in tests/hooks.rs.

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

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

1 participant