Repository navigation
Conversation
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.
Who this helps
ProoflineClientorAsyncProoflineClientwho want idiomaticfor/async forlazy iteration and bounded eager collection without writing manualnext_cursorloops.Before (Manual Cursor Tracking) vs. After (Auto-Pagination)
Before — manual
whilecursor loop withtruncated, cycle, and bound handling:After — lazy auto-pagination with early
break, eager bounded collection, and genericpaginate():Design & Edge-Case Trade-offs
proofline/pagination.py): AddedPageResponse[T],paginate,async_paginate,collect_all, andasync_collect_all(re-exported fromproofline/__init__.py) with zero new runtime dependencies.proofline/client.py): Addediter_pull_request_reviews,list_all_reviews, andlist_all_pull_request_reviewson bothProoflineClientandAsyncProoflineClient, keeping existingiter_reviewsanditer_export_pagesbehavior backward-compatible.proofline/_generated/. Updatedscripts/contracts.pyto cover the new hand-written pagination exports.N + 1is never fetched until all items from pageNare consumed; breaking out of a loop or closing/aclose()ing the generator stops further HTTP requests immediately.max_itemsormax_pages(non-positive integers,bool,float, etc.) raiseValueErroreagerly when constructing the iterator—before any network call is issued.max_itemsormax_pagesstops iteration cleanly; empty intermediate pages with a validnext_cursorcontinue up tomax_pages; empty or repeated/cyclic cursors raiseProoflineError(0, "urn:proofline:sdk:invalid-pagination", ...).asyncio.CancelledErrorpropagate directly to the caller's loop without being swallowed.README.md): Added an "Auto-Pagination" section with sync, async, early-termination, and custompaginateexamples.How it was tested
Full SDK check suite (
scripts/check.py)Ran the full repository verification script in
sdk-python/(venv, CPython 3.13.18), covering OpenAPI client regeneration verification, contracts,ruff check,ruff format --check,mypy, fullpytestsuite, sdist/wheel build, and wheel/sdist installed sync/async HTTP smoke tests:Visual review (AI agent browser)
1440×900,0console errors,0failed HTTP requests)/browser do a visual review of the implemented auto-pagination feature, build the visual review example with a production grade style for best visualization.prooflinePython SDK (ProoflineClient.iter_pull_request_reviews,ProoflineClient.list_all_pull_request_reviews,proofline.paginate) against a loopback Proofline HTTP server, and verified all 6 scenarios:3/3pages fetched,6items yielded,completed1/5pages fetched,2items yielded,4requests avoided (early_break, pages 2–5 not fetched)max_items=4:2/3pages fetched,4items yielded,1request avoided (max_items)max_pages=2:2/5pages fetched,4items yielded,3requests avoided (max_pages)2/2pages fetched, skipped empty page 1 withnext_cursor="c1", yielded2items (completed)2/2pages fetched, repeated cursor"c1"raisedProoflineError(urn:proofline:sdk:invalid-pagination)