Skip to content

Add --fail-on to proofline rerun - #134

Open
kilazi wants to merge 1 commit into
prooflinedev:mainfrom
kilazi:rerun-fail-on
Open

kilazi wants to merge 1 commit into
prooflinedev:mainfrom
kilazi:rerun-fail-on

Conversation

@kilazi

@kilazi kilazi commented Nov 30, 2026

Copy link
Copy Markdown

Who it helps

A rerun creates a new run of the review's original immutable subject, so it answers "what does Proofline say about this exact head now?". Scripts ask that when:

  • the repository's review guidance or policy changed and the team wants the open pull request re-reviewed under it;
  • the last run ended incomplete or unavailable, and they retry it;
  • a release job re-checks the pull request's head right before tagging.

Today review, ci review and the Git hooks can fail on findings, but proofline rerun REVIEW_ID exits 0 on any completed rerun. A script has to parse --json itself to tell a clean rerun from one with a serious finding.

Change

proofline rerun REVIEW_ID --fail-on <warning|serious> exits 3 when the completed rerun has an open finding at or above the threshold. The server only reruns pull-request reviews, so the server's open_items counts always decide, as for review --pr: dismissed and accepted findings don't count. It reuses review_verdict through show.

  • Without --fail-on, nothing changes.
  • An incomplete rerun still exits 2.
  • With --fail-on, a completed rerun whose open_items is missing exits 4, as review --fail-on does. Without the flag, that rerun exits 0 as before.
  • --fail-on conflicts with --no-wait. clap refuses the combination before any request, so nothing is rerun.

Same-subject check. With --fail-on, the command first reads the original review and records its head commit and repository. Then, before grading the new run, it passes the run's detail through confirm_ci_subject (from #34): the run must be PULL_REQUEST, at the same head and in the same repository. If the server reports anything else, nothing is printed to stdout, stderr names the mismatch, and the command exits 4. A review of the wrong subject can never read as a clean rerun. An original that is not a pull-request review, or that names no head or repository, is refused with exit 1 before the rerun is requested, so it costs no run.

show keeps its signature for its existing callers and delegates to a new show_subject, which takes the optional subject.

This is the sibling of #114 (findings --fail-on). Both add a command to the same --fail-on matrix line in tests/http.rs, so whichever lands second needs a trivial rebase.

Verification

  • tests/http.rs: ci_console now serves two earlier pull-request reviews and their reruns, which both answer with CI_REVIEW at CI_HEAD. rerun joins ci review and review --pr in the --fail-on matrix, so it is checked against every case there, each without the flag and with warning and serious: dismissed, open WARNING/SERIOUS, missing open_items, incomplete, CODE-only, partial CODE and another CODE head. The JSON result keeps its shape.
  • A rerun of an original at another head exits 4 with empty stdout. Stderr names the returned head, and the original is read once before the single rerun request.
  • rerun --no-wait --fail-on serious exits 1 with the conflict and sends no request.
  • cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings and cargo test --locked pass on Linux with toolchain 1.100.0. cargo deny check was not run locally; this change adds no dependencies.
  • Reverting the one-line threshold wiring in rerun makes the matrix test fail, and removing the subject check makes the mismatch assertion fail.
$ proofline rerun --help
...
      --no-wait              Return the new review acknowledgment without polling
      --fail-on <SEVERITY>   Exit 3 when the completed rerun has an open finding at or above this severity, as `review --fail-on` does. The rerun is measured only when it is of the original review's pull request head and repository [possible values: warning, serious]
...
$ proofline rerun 0190f3a0-0000-7000-8000-0000000000f6 --no-wait --fail-on serious
error: the argument '--no-wait' cannot be used with '--fail-on <SEVERITY>'

Usage: proofline rerun --no-wait <REVIEW_ID>

For more information, try '--help'.
$ echo $?
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