{"action":"created","issue":{"url":"https://api.github.com/repos/HabitRPG/habitica/issues/9923","repository_url":"https://api.github.com/repos/HabitRPG/habitica","labels_url":"https://api.github.com/repos/HabitRPG/habitica/issues/9923/labels{/name}","comments_url":"https://api.github.com/repos/HabitRPG/habitica/issues/9923/comments","events_url":"https://api.github.com/repos/HabitRPG/habitica/issues/9923/events","html_url":"https://github.com/HabitRPG/habitica/issues/9923","id":293813277,"number":9923,"title":"corrupt notifications array causes \"User validation failed\" errors","user":{"login":"Alys","id":1495809,"avatar_url":"https://avatars0.githubusercontent.com/u/1495809?v=4","gravatar_id":"","url":"https://api.github.com/users/Alys","html_url":"https://github.com/Alys","followers_url":"https://api.github.com/users/Alys/followers","following_url":"https://api.github.com/users/Alys/following{/other_user}","gists_url":"https://api.github.com/users/Alys/gists{/gist_id}","starred_url":"https://api.github.com/users/Alys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alys/subscriptions","organizations_url":"https://api.github.com/users/Alys/orgs","repos_url":"https://api.github.com/users/Alys/repos","events_url":"https://api.github.com/users/Alys/events{/privacy}","received_events_url":"https://api.github.com/users/Alys/received_events","type":"User","site_admin":false},"labels":[{"id":283308918,"url":"https://api.github.com/repos/HabitRPG/habitica/labels/help%20wanted","name":"help wanted","color":"0e8a16","default":true},{"id":54728440,"url":"https://api.github.com/repos/HabitRPG/habitica/labels/priority:%20medium","name":"priority: medium","color":"e99695","default":false},{"id":709193820,"url":"https://api.github.com/repos/HabitRPG/habitica/labels/section:%20Achievements/Popups/Notifications","name":"section: Achievements/Popups/Notifications","color":"c5def5","default":false},{"id":62632900,"url":"https://api.github.com/repos/HabitRPG/habitica/labels/status:%20issue:%20need%20investigation","name":"status: issue: need investigation","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":{"login":"Alys","id":1495809,"avatar_url":"https://avatars0.githubusercontent.com/u/1495809?v=4","gravatar_id":"","url":"https://api.github.com/users/Alys","html_url":"https://github.com/Alys","followers_url":"https://api.github.com/users/Alys/followers","following_url":"https://api.github.com/users/Alys/following{/other_user}","gists_url":"https://api.github.com/users/Alys/gists{/gist_id}","starred_url":"https://api.github.com/users/Alys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alys/subscriptions","organizations_url":"https://api.github.com/users/Alys/orgs","repos_url":"https://api.github.com/users/Alys/repos","events_url":"https://api.github.com/users/Alys/events{/privacy}","received_events_url":"https://api.github.com/users/Alys/received_events","type":"User","site_admin":false},"assignees":[{"login":"Alys","id":1495809,"avatar_url":"https://avatars0.githubusercontent.com/u/1495809?v=4","gravatar_id":"","url":"https://api.github.com/users/Alys","html_url":"https://github.com/Alys","followers_url":"https://api.github.com/users/Alys/followers","following_url":"https://api.github.com/users/Alys/following{/other_user}","gists_url":"https://api.github.com/users/Alys/gists{/gist_id}","starred_url":"https://api.github.com/users/Alys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alys/subscriptions","organizations_url":"https://api.github.com/users/Alys/orgs","repos_url":"https://api.github.com/users/Alys/repos","events_url":"https://api.github.com/users/Alys/events{/privacy}","received_events_url":"https://api.github.com/users/Alys/received_events","type":"User","site_admin":false}],"milestone":null,"comments":13,"created_at":"2018-02-02T08:46:19Z","updated_at":"2018-02-03T21:42:20Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"It's possible for users to have just this as their `notifications` array:\r\n```\r\n    \"notifications\": [\r\n        {\r\n            \"seen\": true,\r\n        }\r\n    ]\r\n```\r\n\r\nWhen that happens, they get repeated user validation errors like this when completing tasks, buying items, etc, etc:\r\n```\r\n{ \"success\": false, \"error\": \"BadRequest\", \r\n  \"message\": \"User validation failed\",\r\n  \"errors\": [ { \"message\": \"Path `type` is required.\", \"path\": \"type\" } ] }\r\n```\r\n\r\n![screenshot_2018-02-02_18-44-24](https://user-images.githubusercontent.com/1495809/35724352-1dc91c58-0849-11e8-9230-a0e65380d504.png)\r\n\r\nI've searched the users who have logged in in the past two days and found it in 13 accounts. I've removed it from those accounts now. I'll search older accounts too today and repeat the search tomorrow.\r\n\r\nI don't know yet if this is something that happened just because of today's migration from the old notification structure to the new one, or if it can be an ongoing problem. If the former, we can ignore this issue - it will stop being a problem after I've cleared all the affected accounts.\r\n\r\nHowever if it's an ongoing bug, it should be dealt with as a high priority because getting those errors after nearly every action is stressful and confusing. There's also indications in the two reports I've seen that it can stop your actions from taking effect. If we can't work out what's causing it rapidly, I suggest we modify our code temporarily so that it doesn't treat this data as a serious error (we'd revert that change once a proper fix is in place).\r\n\r\nFor reference, here's what the notifications array should look like when all notifications have been dismissed:\r\n```\r\n    \"notifications\": [ ]\r\n```\r\n\r\nand here's what it should look like with correctly-formatted notifications:\r\n```\r\n    \"notifications\": [\r\n        {\r\n            \"id\": \"c4523248-52f7-4bde-b990-7bf05aedbf0b\",\r\n            \"data\": {\r\n                \"group\": {\r\n                    \"name\": \"Chaos Guild\",\r\n                    \"id\": \"85dd1be6-336b-4e53-9949-2c09150b4035\"\r\n                }\r\n            },\r\n            \"seen\": false,\r\n            \"type\": \"NEW_CHAT_MESSAGE\"\r\n        }\r\n    ]\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/HabitRPG/habitica/issues/comments/362856737","html_url":"https://github.com/HabitRPG/habitica/issues/9923#issuecomment-362856737","issue_url":"https://api.github.com/repos/HabitRPG/habitica/issues/9923","id":362856737,"user":{"login":"Alys","id":1495809,"avatar_url":"https://avatars0.githubusercontent.com/u/1495809?v=4","gravatar_id":"","url":"https://api.github.com/users/Alys","html_url":"https://github.com/Alys","followers_url":"https://api.github.com/users/Alys/followers","following_url":"https://api.github.com/users/Alys/following{/other_user}","gists_url":"https://api.github.com/users/Alys/gists{/gist_id}","starred_url":"https://api.github.com/users/Alys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alys/subscriptions","organizations_url":"https://api.github.com/users/Alys/orgs","repos_url":"https://api.github.com/users/Alys/repos","events_url":"https://api.github.com/users/Alys/events{/privacy}","received_events_url":"https://api.github.com/users/Alys/received_events","type":"User","site_admin":false},"created_at":"2018-02-03T21:42:20Z","updated_at":"2018-02-03T21:42:20Z","author_association":"CONTRIBUTOR","body":"In the past 21 hours, there have been 78 new instances of users having just `{\"seen\":true}` or `null` as a notification (that's found in database data, not reported by users).\r\n\r\n@paglias has said there's a new variant too: \"with {id, seen, data} but not type\""}}
{"actor":{"display_login":"Alys"}}