Skip to content

Add iter_pull_request_reviews to stream a pull request's review runs - #148

Closed
bobby-nandigam wants to merge 1 commit into
prooflinedev:mainfrom
bobby-nandigam:iter-pull-request-reviews
Closed

bobby-nandigam wants to merge 1 commit into
prooflinedev:mainfrom
bobby-nandigam:iter-pull-request-reviews

Conversation

@bobby-nandigam

Copy link
Copy Markdown

What this adds

iter_pull_request_reviews on both ProoflineClient and AsyncProoflineClient: a lazy iterator that streams every recorded review run of a single pull request across pages.

Who it helps

A pull request accumulates a new review run on each push, rerun, and re-trigger, so inspecting its full history means walking several pages. list_reviews already pairs with iter_reviews for exactly this, but list_pull_request_reviews had no equivalent — callers had to drive truncated/next_cursor by hand and re-implement cursor-cycle and traversal-bound protection. This closes that asymmetry with a method that reads like the one engineers already know.

Decisions

  • Mirrors iter_reviews one-to-one and reuses the existing _page_limits, _next_cursor, and _pagination_limit helpers rather than duplicating pagination logic.
  • Keeps the same keyword surface and defaults (page_size, max_pages, max_items, filters), the same filter passthrough, and the same urn:proofline:sdk:invalid-pagination / urn:proofline:sdk:pagination-limit error types, so a partial traversal can never look complete.
  • Touches only the hand-written client — no change to proofline/_generated/ or the OpenAPI contract — in line with the contribution boundary stated in the README.

Verification

  • ruff check, ruff format --check, and mypy are all clean.
  • Added one parametrized sync + async test covering filter preservation, cursor-cycle refusal, the page bound, and the item bound.
  • Full suite: 236 passed.

list_pull_request_reviews returns a single page, so reading every review
run of a pull request meant driving continuation cursors by hand, even
though list_reviews already has iter_reviews for exactly this.

Add iter_pull_request_reviews to the sync and async clients, mirroring
iter_reviews: it reuses the shared page-bound, cursor-cycle, and item-bound
helpers, preserves the organization, repository, pull request, and filters
on every request, and raises the same invalid-pagination and
pagination-limit errors so a partial traversal never looks complete.

Cover both clients with a parametrized test and document the method in the
README.
@bobby-nandigam

Copy link
Copy Markdown
Author

Closing in favor of #149 (wait_for_merge_gate), which I'm leading with.

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