Possible bug: Annotations added through GraphQL duplicated exponentially


#1

It seems duplicate annotations are created when a Check Run is updated via GraphQL. Here’s an example query I’m using:

{
  "query": "\n    mutation UpdateCheckRun($input: UpdateCheckRunInput!) {\n      updateCheckRun(input: $input) {\n        clientMutationId\n      }\n    }\n  ",
  "variables": {
    "input": {
      "checkRunId": "MDg6Q2hlY2tSdW4xNTYxMTYzMg==",
      "completedAt": "2018-09-05T01:16:28.389Z",
      "conclusion": "FAILURE",
      "status": "COMPLETED",
      "repositoryId": "MDEwOlJlcG9zaXRvcnkxNDcyNDcwMzI=",
      "output": {
        "annotations": [
          {
            "annotationLevel": "FAILURE",
            "location": {
              "startLine": 6,
              "endLine": 6,
              "endColumn": 31,
              "startColumn": 17
            },
            "message": "Strings must use singlequote. - (quotes)",
            "path": "index.js"
          },
          {
            "annotationLevel": "FAILURE",
            "location": {
              "startLine": 12,
              "endLine": 12
            },
            "message": "Extra semicolon. - (semi)",
            "path": "index.js"
          }
        ],
        "summary": "Y'all need to fix some errors",
        "title": "ESLint"
      }
    }
  }
}

Note that the query attaches two annotations. However, the Checks tab in the PR I’m referencing shows four annotations - each duplicated twice: https://github.com/jplhomer/test-splints/pull/2/checks

I’ve noticed this number of duplicates increases exponentially with the number of Annotations added:

I’m guessing this might be a simple loop problem within the GraphQL resolver - please let me know if this is a bug or if I’m doing something wrong!