Skip to content

feat(client): add wait_for_reverification to poll until a re-verification finishes - #66

Open
ZaakirHussain5 wants to merge 1 commit into
prooflinedev:mainfrom
ZaakirHussain5:feat/wait-for-reverification
Open

ZaakirHussain5 wants to merge 1 commit into
prooflinedev:mainfrom
ZaakirHussain5:feat/wait-for-reverification

Conversation

@ZaakirHussain5

Copy link
Copy Markdown

Summary

Callers who request a re-verification no longer have to write their own polling loop around client.fixes.get_reverification. ProoflineClient.wait_for_reverification and AsyncProoflineClient.wait_for_reverification poll 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

  • The methods sit on both clients, next to wait_for_review, and are registered as hand-written helpers in scripts/contracts.py.
  • request_id is a string, matching get_reverification. timeout defaults to 300 seconds. organization_id is optional and is sent on every read in the wait.
  • Backoff matches wait_for_review: 5 seconds, doubling, capped at 60 seconds, bounded by the same request deadline.
  • The return type is the KnowledgeResult from get_reverification. No new status enum was added.
  • Terminal states come from LocalReverificationOutcome. PENDING means the review is still running. RESOLVED_VERIFIED, STILL_PRESENT, and NOT_VERIFIED are finished. NOT_VERIFIED stops 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 payload status is PENDING. A non-PENDING status with no outcomes, such as UNAVAILABLE, stops the wait. The OpenAPI document does not describe the MCP payload, so the waiter reads outcome on objects that carry finding_id, a top-level outcome, and the payload status, including a {ok: true, data: ...} envelope.
  • A result with isError returns immediately. Any other ProoflineError propagates and is not retried. When the deadline expires first, the call raises ProoflineError with type urn:proofline:sdk:timeout.

Verification

python3 scripts/check.py passed: 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 of RESOLVED_VERIFIED and PENDING), immediate STILL_PRESENT, NOT_VERIFIED, and UNAVAILABLE returns, an immediate isError return, a raised HTTP ProoflineError, a zero timeout with no request, and backoff delays [5, 10, 20, 40, 60, 60, 60, 5] under a mocked clock.

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

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