Inconsistent ordering of PullRequest.reviews


#1

When there is a PullRequestReview of PENDING state, it always goes first.

Query:

query {
  node(id: "MDExOlB1bGxSZXF1ZXN0MTc5ODQ5MDky") {
    ... on PullRequest {
      reviews(last: 100) {
        nodes {
          id
          state
          createdAt
        }
      }
    }
  }
}

Result (note the createdAt):

{
  "data": {
    "node": {
      "reviews": {
        "nodes": [
          {
            "id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3MTEwMzU5ODM1",
            "state": "PENDING",
            "createdAt": "2018-04-09T08:02:52Z"
          },
          {
            "id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3MTA5OTQwOTAx",
            "state": "COMMENTED",
            "createdAt": "2018-04-06T03:54:25Z"
          },
          {
            "id": "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3MTA5OTQwOTQ1",
            "state": "COMMENTED",
            "createdAt": "2018-04-06T03:54:48Z"
          }
        ]
      }
    }
  }
}

Edit: The behavior is same with REST API, so this could be more of documentation issue.


#2

Hi @dittos. The review connection has a primary sort on submitted_at which may explain the ordering your seeing.