Repository navigation
feat(client): add wait_for_reverification to poll until a re-verification finishes - #66
Open
ZaakirHussain5 wants to merge 1 commit into
Open
ZaakirHussain5 wants to merge 1 commit into
ZaakirHussain5 wants to merge 1 commit into
Conversation
Callers can wait on get_reverification with the same backoff as wait_for_review, on both the sync and async clients.
This branch has not been deployed
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.
Summary
Callers who request a re-verification no longer have to write their own polling loop around
client.fixes.get_reverification.ProoflineClient.wait_for_reverificationandAsyncProoflineClient.wait_for_reverificationpoll until the re-verification records a finished outcome.This helps CI jobs and scripts that ask Proofline to re-check a pushed fix and need to block until each finding has an outcome.
Design
wait_for_review, and are registered as hand-written helpers inscripts/contracts.py.request_idis a string, matchingget_reverification.timeoutdefaults to 300 seconds.organization_idis optional and is sent on every read in the wait.wait_for_review: 5 seconds, doubling, capped at 60 seconds, bounded by the same request deadline.KnowledgeResultfromget_reverification. No new status enum was added.LocalReverificationOutcome.PENDINGmeans the review is still running.RESOLVED_VERIFIED,STILL_PRESENT, andNOT_VERIFIEDare finished.NOT_VERIFIEDstops the wait and does not establish a fix. The wait also continues while a finding has no outcome, while an outcome is outside that enum, or while the payloadstatusisPENDING. A non-PENDINGstatus with no outcomes, such asUNAVAILABLE, stops the wait. The OpenAPI document does not describe the MCP payload, so the waiter readsoutcomeon objects that carryfinding_id, a top-leveloutcome, and the payloadstatus, including a{ok: true, data: ...}envelope.isErrorreturns immediately. Any otherProoflineErrorpropagates and is not retried. When the deadline expires first, the call raisesProoflineErrorwith typeurn:proofline:sdk:timeout.Verification
python3 scripts/check.pypassed: generation check, operation contract, ruff, mypy, 224 pytest tests, and wheel and sdist install smoke. New sync and async tests cover a success after pending polls (including a mix ofRESOLVED_VERIFIEDandPENDING), immediateSTILL_PRESENT,NOT_VERIFIED, andUNAVAILABLEreturns, an immediateisErrorreturn, a raised HTTPProoflineError, a zero timeout with no request, and backoff delays[5, 10, 20, 40, 60, 60, 60, 5]under a mocked clock.