Repository navigation
Add iter_export_pages to follow export cursors - #52
Conversation
|
Thanks for re-running it. The failure was mine: the contract check keeps a list of allowed client helpers and I hadn't added iter_export_pages to it. Fixed in b4d3866, and the full scripts/check.py passes locally. |
|
Codex review: The helper-registration fix is now green. Before yielding a page, validate its continuation cursor so a cyclic response cannot deliver duplicate rows to callers; add a regression asserting that the offending page is never yielded. This overlaps #27, our preferred bounded iterator, so please consolidate around one implementation. |
Yields each export page in order on the sync and async clients, sending the same dataset, window, format and grouping on every request, and stops after the page without a next cursor. Same guardrails as iter_reviews: max_pages bound, repeated or empty cursor raises invalid-pagination. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V9GvJaWFKxjgK1vyZ27mhr
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V9GvJaWFKxjgK1vyZ27mhr
…with an invalid cursor Adopt the bounded export iterator from prooflinedev#27 unchanged, rebased on current main: the continuation cursor is validated before its page is yielded, and max_pages rejects booleans and non-integers. Take prooflinedev#27's tests in place of this branch's. Add a regression for sync and async clients asserting that the page carrying an empty, resumed, repeated or cyclic cursor is never yielded. Co-authored-by: AI1120 <133474218+AI1120@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V9GvJaWFKxjgK1vyZ27mhr
b4d3866 to
e6fa891
Compare
|
Done in e6fa891. This branch now carries #27's iterator unchanged, rebased on current main and credited to its author in the commit: the continuation cursor is checked before its page is yielded, and max_pages rejects booleans and non-integers. I took #27's tests in place of mine and added the regression you asked for: for sync and async clients, the page carrying an empty, resumed, repeated or cyclic cursor is never yielded. It fails on the old order. Full scripts/check.py passes, 216 tests. If you'd rather merge #27 itself, happy to close this one. |
Who it helps: anyone pulling a full export window into a warehouse or spreadsheet. Today
export_reviewsreturns one page and the README says to loop onnext_cursoryourself, resending the same dataset, window, format and grouping each time. That's easy to get wrong: dropgroup_byon page 2 and the cursor is refused, or a bad cursor loops forever.What it does:
iter_export_pageson both clients yields eachExportPagein order and stops after the page with no next cursor.cursor=resumes from a saved position.Decisions
text,settled_untilandnext_cursor, so callers can checkpoint the cursor or write raw pages. Rows are one loop away.iter_reviews:max_pages(default 100, max 1000), a repeated or empty cursor raisesurn:proofline:sdk:invalid-pagination, going past the bound raisesurn:proofline:sdk:pagination-limit._pagination_limitnow takes a subject so the message says "Export" here; the review message is unchanged.export_reviews, so request validation, transport and error handling stay in one place.How I verified it
tests/test_http.pyacross sync and async: follows cursors with the same filters, resumes from a saved cursor, refuses a repeated or empty cursor, stops atmax_pages, validatesmax_pages. All 22 export tests pass.test_new_public_operationalso fails on a clean checkout in my environment because it shells out to the generator.ruff checkis clean;mypyreports only the 5 errors already onmain.