Possible bug in releases of a Repository object: tag is null


#1

Consider the following query:

{
  stack: repository(owner: "commercialhaskell", name: "stack") {
    releases(last: 3) {
      edges {
        cursor
        node {
          tag {
            name
          }
        }
      }
    }
  }
}

The response is

{
  "data": {
    "stack": {
      "releases": {
        "edges": [
          {
            "cursor": "Y3Vyc29yOjMyNjYyNjg=",
            "node": {
              "tag": {
                "name": "v1.1.2"
              }
            }
          },
          {
            "cursor": "Y3Vyc29yOjQwMTM1MTk=",
            "node": {
              "tag": {
                "name": "v1.2.0"
              }
            }
          },
          {
            "cursor": "Y3Vyc29yOjQ4MTI0Mzc=",
            "node": {
              "tag": null
            }
          }
        ]
      }
    }
  }
}

Note the mysterious nonexistent release with a tag being null. In comparison, you get three existing releases through the REST API:

$ curl -sS 'https://api.github.com/repos/commercialhaskell/stack/releases?per_page=3' | jq -r '.[].tag_name'
v1.2.0
v1.1.2
v1.1.0

I think the release with a null tag might be an unpublished draft or a deleted release.


#2

Hi @zmwangx,

I ran this query:

{
  repository(owner: "commercialhaskell", name: "stack") {
    id
    name
    releases(last: 10) {
      edges {
        cursor
        node {
          tag {
            name
          }
        }
      }
    }
  }
}

Here’s the response:

{
  "data": {
    "repository": {
      "id": "MDEwOlJlcG9zaXRvcnkzNDgxNzkyMg==",
      "name": "stack",
      "releases": {
        "edges": [
          {
            "cursor": "Y3Vyc29yOjIzMzg0NDM=",
            "node": {
              "tag": {
                "name": "v1.0.0"
              }
            }
          },
          {
            "cursor": "Y3Vyc29yOjI0NDIzMzI=",
            "node": {
              "tag": {
                "name": "v1.0.2"
              }
            }
          },
          {
            "cursor": "Y3Vyc29yOjI2NTA1NDM=",
            "node": {
              "tag": {
                "name": "v1.0.4"
              }
            }
          },
          {
            "cursor": "Y3Vyc29yOjI5NjczMzc=",
            "node": {
              "tag": {
                "name": "v1.0.4.3"
              }
            }
          },
          {
            "cursor": "Y3Vyc29yOjMxNDcyNDA=",
            "node": {
              "tag": {
                "name": "v1.1.0"
              }
            }
          },
          {
            "cursor": "Y3Vyc29yOjMyNjYyNjg=",
            "node": {
              "tag": {
                "name": "v1.1.2"
              }
            }
          },
          {
            "cursor": "Y3Vyc29yOjQwMTM1MTk=",
            "node": {
              "tag": {
                "name": "v1.2.0"
              }
            }
          },
          {
            "cursor": "Y3Vyc29yOjQ4MTI0Mzc=",
            "node": {
              "tag": {
                "name": "v1.3.0"
              }
            }
          },
          {
            "cursor": "Y3Vyc29yOjUwMTg3MjE=",
            "node": {
              "tag": {
                "name": "v1.3.2"
              }
            }
          },
          {
            "cursor": "Y3Vyc29yOjU3MTIyODQ=",
            "node": {
              "tag": {
                "name": "v1.4.0"
              }
            }
          }
        ]
      }
    }
  }
}

For cursor Y3Vyc29yOjI5NjczMzc=, I see that the name isn’t null but v1.0.4.3. Are you still seeing this behavior for this repository’s releases? If so, could you please write back with steps for reliably reproducing what you’re seeing so I can take a look? Thanks!


#3

I can no longer reproduce.


#4

Hey @zmwangx, thanks for writing back. Please let us know if you do find this behavior again and I’d be happy to take another look!


#5

@francisfuzz Actually I looked a little deeper into this issue by testing on my own dummy repo just now, and it confirmed my suspicion that unpublished drafts result in the nulls. Try this on zmwangx/test, which has one published release and two drafts:

{
  repository(owner: "zmwangx", name: "test") {
    id
    name
    releases(last: 10) {
      edges {
        cursor
        node {
          tag {
            name
          }
        }
      }
    }
  }
}

Response:

{
  "data": {
    "repository": {
      "id": "MDEwOlJlcG9zaXRvcnk3MTE4OTA1OA==",
      "name": "test",
      "releases": {
        "edges": [
          {
            "cursor": "Y3Vyc29yOjQ1NTMxOTY=",
            "node": {
              "tag": null
            }
          },
          {
            "cursor": "Y3Vyc29yOjQ1NTMyODE=",
            "node": {
              "tag": null
            }
          },
          {
            "cursor": "Y3Vyc29yOjYwMTUzNzg=",
            "node": {
              "tag": {
                "name": "v1"
              }
            }
          }
        ]
      }
    }
  }
}

#6

Hi @zmwangx! My apologies for a late reply here. I ran your earlier query and see that unpublished drafts result in a null tag. I’ve opened up an issue internally so the team can look at this. I can’t promise an ETA for when this will be addressed, but I’ll be sure to circle back here and let you know if there have been any updates!


#7

No worries, thanks for confirming the issue.


#8

I still get it every now and then. Any updates regarding this issue?

Related post: GraphQL API does not return Releases tagged "prerelease"