Comment 1 for bug 1831910

Revision history for this message
Celso Providelo (cprov) wrote :

I am not sure about the origin of `16/candidate\r` channel, but it seems to work just fine for refreshes.

{{{

$ cat bad_channel.json
{
  "context": [
    {"snap-id": "njObIbGQEaVx1H4nyWxchk1i8opy4h54", "revision": 10, "tracking-channel": "16/candidate\r", "instance-key": "a"}
  ],
  "actions": [
    {"action": "refresh", "snap-id": "njObIbGQEaVx1H4nyWxchk1i8opy4h54", "instance-key": "a"}
  ]
}

$ curl -s -H 'Content-Type: application/json' \
        -H 'Snap-Device-Series: 16' \
        -H 'Snap-Device-Architecture: amd64' \
        'https://api.snapcraft.io/v2/snaps/refresh' \
        -d '@bad_channel.json' \
| jq '.'
{
  "error-list": [],
  "results": [
    {
      "effective-channel": "16/candidate",
      "instance-key": "a",
      "name": "nextcloud",
      "released-at": "2019-05-23T19:23:14.127486+00:00",
      "result": "refresh",
      "snap": {
        "created-at": "2019-05-23T16:15:50.409353+00:00",
        "download": {
          "deltas": [],
          "sha3-384": "e07d888235eae56edcae9c085b1d28dbbd0207a9f98ded18bfe6db79e824f9dc19c6dc308fbbe142d9ea1a00be29f815",
          "size": 252055552,
          "url": "https://api.snapcraft.io/api/v1/snaps/download/njObIbGQEaVx1H4nyWxchk1i8opy4h54_13518.snap"
        },
        "license": "AGPL-3.0+",
        "name": "nextcloud",
        "prices": {},
        "publisher": {
          "display-name": "Nextcloud",
          "id": "lBnslZGp88VvX4EJSAvS2AG2Iryb1MNU",
          "username": "nextcloud",
          "validation": "verified"
        },
        "revision": 13518,
        "snap-id": "njObIbGQEaVx1H4nyWxchk1i8opy4h54",
        "summary": "Nextcloud Server - A safe home for all your data",
        "title": "Nextcloud",
        "type": "app",
        "version": "16.0.1snap1-rc1"
      },
      "snap-id": "njObIbGQEaVx1H4nyWxchk1i8opy4h54"
    }
  ]
}

}}}

It seems that we are "trimming" channels before evaluating operations, but the raw content is recorded in the metrics.

IMO, the trimming is masking deeper problems and should be removed, the refresh operation would fail (client would be fixed if necessary) and no metric would be recorded.