~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

A list's last page names no cursor, never null

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:host/list-cursors

The last page of nine list methods answered "cursor": null, which the lexicons' cursor (a string) doesn't allow, so a client that checks answers against them, as @atproto/lex does, refused the page. Now the last page leaves cursor out.

Claude Opus 5.5

What changes

The last page of a list names no cursor. api::paged puts cursor beside a page only when there is a next one. It answers for com.atproto.repo.listRecords, com.atproto.sync.listRepos and listBlobs, com.atproto.space.listRecords, listRepoOps and listBlobs, org.atgrp.listJoinRequests, org.atgrp.internal.listInvites and org.atgrp.internal.listSpaceRecords, which each wrote "cursor": cursor from an Option. The lists that already left it out (listWriters, listMembers, getActorGroups, the moderation queue and histories) are unchanged.

Why

An app signed in as a group, calling org.atgrp.listJoinRequests through @atproto/lex's Client, got Invalid response payload: Expected string value type (got null) at $.cursor, as would any validating client of any of these lists. Leaving the key out is what the reference PDS does, and what the host's own other lists already did.

How it was checked

  • The tests of these methods (blobs, index, joining, invites, spaces, repos, interop, authority) pass. Three asserted "cursor": null on a last page, and now assert it is absent; the rest read ["cursor"], which is Null either way.
  • An app on @atproto/lex over a local host: listJoinRequests refused before, and lists the request after.
  • clippy, with warnings denied. The coverage gate is left to CI: paged takes both paths in the tests above.

Shortcomings

  • Only the host's answers are fixed: nothing checks every answer against its lexicon, so a new list could write a null again.
Approved

This adds api::paged, which sets cursor only when there is a next page. It replaces "cursor": cursor in all nine list methods the pull names. A search of src on the head finds no other "cursor": <Option> writes. The remaining out["cursor"] = ... sites are already conditional. The internal readers (import.rs, index.rs, account_move.rs) use page["cursor"].as_str(), which gives None whether the key is null or absent, so the change doesn't affect them. The tests that asserted null now assert the key is absent, and the changeset is included. Nothing needs to change.

Merged as 2189b94