~sircmpwn/todo.sr.ht#254: 
GraphQL ticket pagination only returns a single page of results

I'm having trouble paging through tickets with the GraphQL API on todo.sr.ht. Using this query:

query ($cursor: Cursor) {
    trackerByOwner(owner: "~eliasnaur", tracker: "gio") {
        tickets(cursor: $cursor) {
            results {
                submitter {
                    canonicalName
                }
            }
            cursor
        }
    }
}

I get the first page of results just fine, but supplying the cursor to the second invocation results in an empty response every time:

{
  "data": {
    "trackerByOwner": {
      "tickets": {
        "results": [],
        "cursor": null
      }
    }
  }
}

I've tried using the GraphQL playground, curl, and my own program, and I get consistent results in all of them. I also tried hard-coding the cursor into the second query to check for string processing issues, but that didn't help.

I know this tracker has hundreds of tickets, so it isn't just that there are only 25 results. I also tried this on other trackers with the same single page of results.

You should be able to test this for yourself on the playground by running the query I used above and then copying the cursor from its response back into the query:

https://todo.sr.ht/graphql

Status
RESOLVED FIXED
Submitter
~whereswaldon
Assigned to
Submitted
15 days ago
Updated
3 days ago
Labels
No labels applied.

~sircmpwn 12 days ago

If you include the "created" field, does it start working? If so, probably related to another known bug.

~whereswaldon 12 days ago

Adding the created field for both the tracker and the tickets didn't change the behavior:

query {
    trackerByOwner(owner: "~eliasnaur", tracker: "gio") {
        created
        tickets(cursor: "cursor-from-page-1") {
            results {
                created
                submitter {
                    canonicalName
                }
            }
            cursor
        }
    }
}

Results:

{
  "data": {
    "trackerByOwner": {
      "created": "2019-03-30T14:54:44Z",
      "tickets": {
        "results": [],
        "cursor": null
      }
    }
  }
}

~sircmpwn 12 days ago

How about id?

~whereswaldon 12 days ago

No change:

query {
    trackerByOwner(owner: "~eliasnaur", tracker: "gio") {
id
created
        tickets(cursor: "cursor-from-first-page") {
            results {
id
created
                submitter {
                    canonicalName
                }
            }
            cursor
        }
    }
}

Yields:

{
  "data": {
    "trackerByOwner": {
      "id": 1117,
      "created": "2019-03-30T14:54:44Z",
      "tickets": {
        "results": [],
        "cursor": null
      }
    }
  }
}

~sircmpwn 12 days ago

Alright, it's something else. Will look into it this week.

~sircmpwn 12 days ago

~adnano, can you look into this sometime in the next few days? No rush.

~adnano 12 days ago

I can't reproduce this issue locally. However, I can reproduce it for trackerByOwner and trackerByName queries on the flagship todo.sr.ht instance.

My guess is that the cursor returned by todo.sr.ht is invalid somehow, though I can't verify that as the cursor is encrypted.

~sircmpwn REPORTED FIXED 3 days ago

Fixed it. The issue is that the cursors were inconsistently using the scoped ID vs the database ID. It was not reproducible locally because these columns tend to be similar on small development databases.

Register here or Log in to comment, or comment via email.