Skip to content

Verify the requested head before printing findings - #124

Open
Celestial-0 wants to merge 1 commit into
prooflinedev:mainfrom
Celestial-0:feat/findings-verify-head
Open

Celestial-0 wants to merge 1 commit into
prooflinedev:mainfrom
Celestial-0:feat/findings-verify-head

Conversation

@Celestial-0

Copy link
Copy Markdown

Summary

A build that saves a Proofline review ID can now read it at the commit it tested. The command needs one review GET and works outside a Git checkout.

proofline findings --review "$REVIEW_ID" --head "$TESTED_SHA" --json

The head check also fixes the existing commit search. Previously, findings --head matched the SHA on the list item, fetched its detail, and could print a completed review for a different commit. The CLI now checks the detail before emitting text, JSON or SARIF. If a running review reports a different head, the wait stops on that read.

Evidence

The real binary read a loopback console whose summary and detail named the same review ID. The summary named commit A and the detail named commit B.

Command Before After
findings --head A --json Exit 0, printed COMPLETED for B Exit 1, empty stdout, stderr names A and B
findings --review ID --head A --json Usage error Exit 1, empty stdout, stderr names A and B
findings --review ID --json Exit 0, returned B Exit 0, returned B

Run cargo test --locked --test http findings_by_head_refuses_a_detail_for_another_commit to exercise the original failure. A matching retained review produced schema-valid SARIF with one GET. A real temporary Git checkout exercised implicit HEAD, and a two-read wait accepted a running review without a head once its completed detail named the requested commit.

  • cargo fmt --check and cargo clippy --locked --all-targets -- -D warnings passed.
  • cargo test --locked -- --include-ignored passed all 162 tests on Linux, including the official pre-commit framework test.
  • cargo deny check passed with three duplicate-dependency warnings in the existing lockfile.

The console responses were synthetic. The hosted service and GitHub code-scanning upload were outside this verification.

Merge risk

A script using a head selector may now exit 1 if its review detail omits or contradicts that head. ID-only reads keep their previous behavior. This is a reversible CLI change with no hosted schema, credential, or stored-data migration.

Allow findings --review ID --head SHA to read a known review outside a
checkout. Apply the same head check to lookups by explicit SHA and the
checkout HEAD, and reject a missing or different head before emitting
text, JSON or SARIF. SHA comparison is case-insensitive. Add regression
tests for a detail from another commit, implicit HEAD and SARIF output.
@Celestial-0
Celestial-0 force-pushed the feat/findings-verify-head branch from b88a140 to 26c1816 Compare November 30, 2026 09:20

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