Skip to content

Add iter_pull_request_reviews to the sync and async clients - #158

Open
Sarthzk wants to merge 8 commits into
prooflinedev:mainfrom
Sarthzk:add-iter-pull-request-reviews
Open

Sarthzk wants to merge 8 commits into
prooflinedev:mainfrom
Sarthzk:add-iter-pull-request-reviews

Conversation

@Sarthzk

@Sarthzk Sarthzk commented Dec 3, 2026 •

Copy link
Copy Markdown

Add iter_pull_request_reviews to the sync and async clients

list_pull_request_reviews returns a paginated ReviewPage (cursor + limit), but only list_reviews has an iterator (iter_reviews). Callers who want every review of one pull request have to hand-write the cursor loop, including the cycle and bound checks.

What changed

  • ProoflineClient.iter_pull_request_reviews and AsyncProoflineClient.iter_pull_request_reviews mirror iter_reviews: same page_size / max_pages / max_items bounds and the same refusals (cursor cycles, missing continuation cursor, bound exceeded). They take the same filters as list_pull_request_reviews.
  • The iterator setup (bound validation, private copy of the filters, seeding the seen-cursor set) moves into one shared helper, _iter_start, used by both iter_reviews and the new iterator, in both clients.
  • _page_limits now requires real ints for page_size, max_pages and max_items. Before, max_items=1.5 passed validation and the item cap could never trigger, and max_pages=2.5 passed validation and then failed with a TypeError inside range(). Now both raise the existing ValueError. This also applies to iter_reviews.
  • README: documents the new iterator and the bounds.
  • No changes under proofline/_generated/.

Tests

Sync and async tests in tests/test_http.py cover:

  • following cursors across pages with a distinct review per page, asserting the ordered result
  • the caller's filters dict not being modified (full-dict comparison)
  • refusing a repeated cursor (exactly two requests), a missing cursor (exactly one), and a cursor equal to the caller's starting cursor
  • the exact max_pages and max_items caps
  • non-int and bool bounds for both iterators

Full suite passes locally (262). ruff check, ruff format --check and mypy proofline/client.py are clean.

Review

I ran Proofline on this change in a separate test org (sarthak-proofline-test/sdk-test#1). Run 2 flagged the README overstating "reads every review", fractional max_items, fractional max_pages, and three weak test assertions. All were valid, and the fixes above come from them. Later runs narrowed to two README wording issues and finally no findings.

Sarthzk and others added 8 commits December 3, 2026 15:21
…ated

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
bool and float values such as max_items=1.5 passed _page_limits or failed
later inside range(). Reject them with the same ValueError.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…t reviews

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

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