Repository navigation
Add request_and_wait_for_review to sync and async clients - #50
Closed
EyerusalemGebremedhin wants to merge 3 commits into
Closed
EyerusalemGebremedhin wants to merge 3 commits into
EyerusalemGebremedhin wants to merge 3 commits into
Conversation
Member
|
Codex Closing as out of scope. We’re keeping the SDK focused on the existing API and small, necessary client helpers. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
To get a finished review, SDK users have to call
request_review(), take the review ID from the response, and pass it towait_for_review(). This contribution adds a single method that does both steps.Solution
Adds
request_and_wait_for_review()toProoflineClientandAsyncProoflineClientinproofline/client.py. It calls the existingrequest_review(), then the existingwait_for_review()with the returned review ID, and returns aReviewOutcome. A refused request raisesProoflineError, and a timeout returnsTIMED_OUT, as withwait_for_review(). The README gets a short usage example.Invalid timeout fix
Proofline's review of my own copy of this branch flagged that a negative or non-finite timeout was only rejected after a review had already been requested (eyerusalem-sdk-lab#1). I reproduced it: with the fix removed, the new tests fail because the fake server receives an unexpected POST to the reviews path. The timeout is now validated before request_review() is called, in both the sync and async helpers, using the same check and message as wait_for_review(). Proofline marked that finding fixed.
Tests
10 test cases in
tests/test_http.py, each running sync and async:test_request_and_wait_for_review_returns_completed_outcome: POST to the reviews endpoint, then GET poll, returns aCOMPLETEDoutcome with the review URLtest_request_and_wait_for_review_propagates_refusal: a refused request raisesProoflineErrorwith status 409, and no GET poll is attemptedtest_request_and_wait_for_review_timeout: the review never completes, returnsTIMED_OUTwith the last recorded reviewtest_request_and_wait_for_review_bad_timeout_raises_before_request:timeout=-1raisesValueError, and no HTTP request is sent to the servertest_request_and_wait_for_review_bad_timeout_infinite_raises_before_request:timeout=float("inf")raisesValueError, and no HTTP request is sent to the serverVerification:
uv run -m pytest -q -k request_and_wait_for_review→ 10 passed. Full suite, Ruff lint, Ruff format check, and mypy all clean.How to reproduce
feature/add-request-and-wait-for-review.python -m pytest tests/test_http.py -k request_and_wait_for_review -vUsage example
AI disclosure
I used an AI coding tool during this contribution. I asked it to suggest several different problems in this SDK and decided which one to take on: a single call that requests a review and waits for its result. I directed the implementation, reviewed the diff, and ran the tests myself. The timeout issue Proofline flagged was confirmed by reading the code with the tool's help, and I reviewed and accepted the fix. I can explain every change and I'm responsible for them.
The prompts I submitted during the coding session are in the hidden HTML comment at the end of this description.