You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
review(#135): unbounded by default + eager validation in 7 wrapper methods
Per bot review on PR #135:
### Behavior change: max_pages=None is now truly unbounded
Dropped the silent 1000-page cap. None iterates until the server
returns no cursor; the existing cursor-repeat guard remains the
safety net against infinite loops (cap was never part of the public
contract). Bot's recommended path: most users expect None = unbounded
and a silent truncation post-release would be a harder break to fix.
### Fix: 7 wrapper methods had lazy validation
Methods using `yield from self._list_all(...)` (5 sync) or
`async for item in ... yield item` (2 async) were silently generators
— their body, including _validate_max_pages, did not execute until
the caller advanced the iterator. milestones.list_all(max_pages=0)
returned a generator without raising; the ValueError only fired on
the first next().
Fixed by converting to `return self._list_all(...)`:
- communications.{Sync,Async}.list_all_rfqs
- incentive_programs.list_all
- milestones.list_all
- structured_targets.list_all
- subaccounts.{Sync,Async}.list_all_transfers
Async ones additionally need `def` (not `async def`) so they're plain
functions returning the AsyncIterator, not coroutines.
### Async drift FQNs
Added all 19 async resource FQNs to _MAX_PAGES_FQNS in
tests/_contract_support.py so the drift framework recognizes the
kwarg if coverage is ever extended to async classes.
### Regression tests
- TestMaxPagesEagerValidation × 4 (sync + async, both styles) — asserts
ValueError fires at call time, not on first __next__.
- TestMaxPagesNoneIsUnbounded × 1 — server returns 1100 pages, suite
iterates all 1100 (proves the 1000 cap is gone).
Verify: 1577 passed (+5). ruff + mypy --strict clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments