Skip to content

Check the review head before printing findings - #1

Open
dboles99 wants to merge 1 commit into
mainfrom
findings-head-check
Open

dboles99 wants to merge 1 commit into
mainfrom
findings-head-check

Conversation

@dboles99

@dboles99 dboles99 commented Dec 6, 2026

Copy link
Copy Markdown
Owner

Mirror of prooflinedev#169, opened in my fork so Proofline can review it. Same commit; discussion stays on the upstream PR.

Fixes prooflinedev#123.

Who it helps

Builds and scripts that know a commit SHA and a Proofline review ID, and
developers who run proofline findings from a checkout.

What changes

--review and --head can now be given together. The CLI reads that
review directly, so it works with no checkout, and checks the head the
console reports against the full SHA before it prints anything.

$ proofline findings --review 0190f3a0-... --head 0123456789abcdef0123456789abcdef01234567
proofline: proofline asked for the review of 0123456789abcdef0123456789abcdef01234567, but the server returned head commit 89abcdef0123456789abcdef0123456789abcdef

The same check applies when the CLI finds a review by --head or by the
checkout's HEAD. The existing departed fixture gave its summary and
its detail different SHAs, which hid the bug; both now use one SHA.

Decisions

  • The check lives in read_review_once, so text, JSON and SARIF are all
    refused before output, and every --wait poll is checked.
  • It reuses the CI wording and comparison through one same_head
    function, so both commands report a bad head the same way.
  • A missing head counts as a mismatch when a head was asked for, but
    --review alone still reads any review, including a patch review
    with no head.
  • --pr still conflicts with --head and --review; a PR number and a
    head stay separate lookup choices. SHAs match in either letter case.

How verified

  • cargo fmt --check: clean.
  • cargo clippy --all-targets --offline -- -D warnings: no findings in
    the changed code. Two errors remain in src/agent/tests.rs (lines 526
    and 745), a file this change does not touch.
  • cargo test --offline --no-fail-fast: 244 passed, 14 failed. Before
    the change: 234 passed, the same 14 failed (on this Windows machine; unrelated).
  • The nine new tests in tests/findings_head.rs and the unit test in
    src/outcome.rs pass. Seven of the nine fail on the old code.

Who: developers and scripts that run `proofline findings` outside CI.
What: `--review` now takes `--head`; a head found by search or from
  the checkout is checked against the review that is read.
Where: src/lib.rs and src/outcome.rs (callers in hooks.rs, scan.rs and
  tools.rs pass None), README.md, tests/findings_head.rs, tests/http.rs.
When: any findings read that names a head, or looks one up.
Why: a summary at commit A and a detail at commit B printed B and
  exited 0. Now it fails with both heads named. Fixes the fixture too.
How verified: cargo fmt --check clean; cargo test --offline passes
  244 (was 234) with the same 14 failures as before.

Fixes prooflinedev#123
Copilot AI balanced review requested due to automatic review settings December 6, 2026 10:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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.

Let findings verify the head commit of a retained review

2 participants