Skip to content

Name the review a hook could not read - #157

Open
ammartahamohamedy wants to merge 1 commit into
prooflinedev:mainfrom
ammar-taha-dev:fix/hook-keeps-review-id
Open

ammartahamohamedy wants to merge 1 commit into
prooflinedev:mainfrom
ammar-taha-dev:fix/hook-keeps-review-id

Conversation

@ammartahamohamedy

Copy link
Copy Markdown

Fixes #156

Problem

hooks::request turned every failure into Report::Unreviewed, including a failed read after the server had accepted the patch. One 502, 500 or dropped connection while the hook waited, or the timeout cutting off the first read, printed could not review <label> with no ID or link, though the review was running.

Fix

  • hooks::request uploads first, then reads. A failure before the upload is Unreviewed as before.
  • After the upload, a failed or cut-off read is a new Report::Unread, printed with the review's URL and findings --review <id>, worded like the hook's message for a review still running at its last read:
    Proofline could not read the review of the staged changes: … returned HTTP 502: bad gateway. It continues at <url>; read it later with `proofline findings --review <id>`.
    
  • It is still a gap, so onIncomplete decides the exit as before. The upload stays outside the deadline: cancelling a POST the server accepted would lose the ID the same way.
  • Unread keeps its URL as a String, so Report stays under clippy's result_large_err size.

Tests (written first; failed before the change)

Test What it checks
a_review_the_hook_could_not_read_is_still_named (new, tests/hooks.rs) Pre-commit against a stand-in that accepts the patch, then (1) answers the first read with a 502 or (2) stalls it past the timeout. Each case names the review's URL and findings --review, no longer says "could not review", and still proceeds as an incomplete review

The stand-in (serve_reads) gains one step: a null script entry answers 502.

Mutation checks: losing the ID on a read error, losing it at the deadline, or not counting Unread as a gap each fails the test.

Checks

  • cargo fmt --check: ✅
  • cargo clippy --locked -- -D warnings: clean on the lib, the bins and the integration tests. --all-targets stops at the 2 errors main already has on Windows (src/agent/tests.rs).
  • cargo test --locked: the new test passes. Otherwise, the same 12 Windows failures as on main (tests/mcp.rs ×7, agent_install ×2, update, local_patch, hooks on a Windows push URL), none of them in this change.
  • cargo deny check: no dependency changes.
  • Fork CI: ✅ check and windows pass on ammar-taha-dev/proofline-cli#7.

Proofline review log

Fork review PR: ammar-taha-dev/proofline-cli#7. Rounds capped at 2.

Round Finding What I made of it Outcome
1 None — Clean on the first round

The prompts below are the ones that drove this implementation; the investigation, reproduction and fix scope were done before them and aren't included.

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.

A Git hook drops the ID of a review the server accepted when it can't read it

1 participant