Calling the metrics API for nextcloud has a carriage return in "name: candidate\r"
https://dashboard.snapcraft.io/dev/api/snaps/metrics
{'metrics': [{'metric_name': 'weekly_installed_base_by_channel', 'status': 'OK', 'buckets': ['2019-06-05'], 'series': [{'values': [13], 'name': '13/edge'}, {'values': [32], 'name': '13/candidate'}, {'values': [5], 'name': '14/edge'}, {'values': [144], 'name': '15/stable'}, {'values': [4], 'name': 'beta/pr-890'}, {'values': [3], 'name': '12/stable'}, {'values': [9], 'name': 'latest/stable'}, {'values': [25505], 'name': 'stable'}, {'values': [2], 'name': 'beta/pr-688'}, {'values': [1], 'name': 'beta/pr-862'}, {'values': [5], 'name': '11/stable'}, {'values': [2], 'name': 'stable/pr-388'}, {'values': [33], 'name': 'beta'}, {'values': [2], 'name': 'beta/pr-573'}, {'values': [38], 'name': 'candidate'}, {'values': [202], 'name': '16/candidate'}, {'values': [1], 'name': 'beta/pr-628'}, {'values': [22], 'name': '14/stable'}, {'values': [148], 'name': '14/candidate'}, {'values': [10], 'name': 'stable/394-theming-fix'}, {'values': [7], 'name': 'stable/pr-411'}, {'values': [29], 'name': '14/beta'}, {'values': [2], 'name': '16/stable'}, {'values': [22], 'name': '16/edge'}, {'values': [10], 'name': '12/edge'}, {'values': [12], 'name': '15/edge'}, {'values': [231], 'name': '15/candidate'}, {'values': [4], 'name': '15/beta'}, {'values': [2], 'name': '13/beta'}, {'values': [1], 'name': '16/candidate\r'}, {'values': [1], 'name': 'stable/pr-349'}, {'values': [1], 'name': 'latest/edge'}, {'values': [34], 'name': '13/stable'}, {'values': [1], 'name': 'beta/pr-1038'}, {'values': [55], 'name': 'edge'}], 'snap_id': 'njObIbGQEaVx1H4nyWxchk1i8opy4h54'}]}
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 4nyWxchk1i8opy4 h54", "revision": 10, "tracking-channel": "16/candidate\r", "instance-key": "a"} 4nyWxchk1i8opy4 h54", "instance-key": "a"}
{
"context": [
{"snap-id": "njObIbGQEaVx1H
],
"actions": [
{"action": "refresh", "snap-id": "njObIbGQEaVx1H
]
}
$ curl -s -H 'Content-Type: application/json' \ Series: 16' \ Architecture: amd64' \ /api.snapcraft. io/v2/snaps/ refresh' \ effective- channel" : "16/candidate", instance- key": "a", released- at": "2019-05- 23T19:23: 14.127486+ 00:00",
"created- at": "2019-05- 23T16:15: 50.409353+ 00:00",
"sha3- 384": "e07d888235eae5 6edcae9c085b1d2 8dbbd0207a9f98d ed18bfe6db79e82 4f9dc19c6dc308f bbe142d9ea1a00b e29f815" , /api.snapcraft. io/api/ v1/snaps/ download/ njObIbGQEaVx1H4 nyWxchk1i8opy4h 54_13518. snap"
"publisher" : {
"display- name": "Nextcloud", EJSAvS2AG2Iryb1 MNU",
"username" : "nextcloud",
"validation" : "verified" 4nyWxchk1i8opy4 h54", 4nyWxchk1i8opy4 h54"
-H 'Snap-Device-
-H 'Snap-Device-
'https:/
-d '@bad_channel.json' \
| jq '.'
{
"error-list": [],
"results": [
{
"
"
"name": "nextcloud",
"
"result": "refresh",
"snap": {
"download": {
"deltas": [],
"size": 252055552,
"url": "https:/
},
"license": "AGPL-3.0+",
"name": "nextcloud",
"prices": {},
"id": "lBnslZGp88VvX4
},
"revision": 13518,
"snap-id": "njObIbGQEaVx1H
"summary": "Nextcloud Server - A safe home for all your data",
"title": "Nextcloud",
"type": "app",
"version": "16.0.1snap1-rc1"
},
"snap-id": "njObIbGQEaVx1H
}
]
}
}}}
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.