fix: send AAO directory pagination cursor as cursor#811
Merged
Conversation
54989c5 to
cc2186c
Compare
There was a problem hiding this comment.
LGTM. Fixes a real wire-level bug — spec-conformant directories define since (ISO 8601) and cursor (opaque) as distinct query params, and the SDK was recycling next_cursor values into since=.
Things I checked
- Public-API delta: new optional kwarg
cursor: str | None = Noneonfetch_agent_authorizations_from_directory(src/adcp/adagents.py:2008) — additive, non-breaking,fix:prefix is the right shape. - Pagination loop termination preserved in
detect_publisher_properties_divergence(src/adcp/adagents.py:2235) —seen_cursorsdedupe +MAX_DIRECTORY_PAGESguard untouched; page 1 sends neither param, page N reusesnext_cursorviacursor=. - Only in-repo caller of the public function is the divergence sweep itself, already migrated.
ad-tech-protocol-expert: sound — confirmed againstadcontextprotocol/adcp:docs/aao/directory-api.mdx:sincetyped ISO 8601,cursortyped opaque, no provision for cursors-on-since. The old "opaque cursor or RFC 3339" docstring was an SDK invention.- Tests pin both halves:
test_since_passes_through_as_query_stringassertscursoris empty whensinceis sent;test_cursor_passes_through_as_cursor_query_stringasserts the reverse;test_divergence_uses_cursor_param_for_second_page(tests/test_adagents.py:4643-4673) regression-pins the two-page flow with page 1 carrying neither and page 2 carryingcursor=page-2. Belt and suspenders, the right shape.
Follow-ups (non-blocking — file as issues)
- Spec also defines
status(repeated) andlimitquery params the SDK still doesn't surface — separate gap, not this PR's scope. - Adopters who were passing opaque cursors via
since=(bug-compatible with old client) silently keep doing so. Worth a release-note line calling that out so external callers migrate to the new kwarg.
Minor nits (non-blocking)
- Docstring tightening is text-only.
src/adcp/adagents.py:2029now documentssinceas RFC 3339 timestamp, but there's no runtime validator. Fine — wire-side schema validation is the right enforcement point, and tightening here would itself be breaking.
Safe to merge.
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.
Summary
cursorquery parameter to AAO directory authorization fetchessincescoped to timestamp-based incremental filteringnext_cursoras?cursor=...sinceandcursorsemanticsRoot Cause
The SDK reused
sincefor pagination tokens even though the directory spec definessinceandcursoras separate query parameters. Spec-conformant directories can reject page 2+ requests when opaque cursors arrive insince.Validation
PYTHONPATH=src pytest tests/test_adagents.py -qruff check src/adcp/adagents.py tests/test_adagents.py