-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty Label response can possibly be cached from GitHub? #773
Comments
I'm going to remove the tests that aren't great, IMO. We should add back the following once we solve the bug:
We can also add python unit tests at the API level around adding and removing labels. That can be handled in #396. |
It seems like if we move to a vertical label editor (cf. #545), having the extra status- or browser- text won't be a big deal. |
The namespace is to allow us to separate them in the UI. Basically at the end I don't think the label gear (in the future) would have any kind of |
This was happening to me before the renaming, specifically in Japan. When you open the gear, and github doesn't have time to send the response, and you start playing with it and it erases all labels. |
Ah, OK. So we're relying on the namespace to alphabetize/sort the labels for us? |
OK, let's ignore that problem for now and focus on:
|
And now it doesn't reproduce in production or development. So apologies @karlcow for insinuating you/we broke something here. 🙇 My best guess is something bad happening between GitHub and us. We do cache the labels endpoint, so one theory is somehow we cached an empty response: @karlcow should we rip out the caching? I think it's the only place we use that Flask-Cache extension, and it's caused us some problems in the past as well. |
☑️ My vote is to remove the caching of labels and let the browser use its cache. |
Let me take an issue by chance when we load the issue, we call the URI: which is a json file, which has already the labels. {
"url": "https://api.github.com/repos/webcompat/web-bugs/issues/583",
"labels_url": "https://api.github.com/repos/webcompat/web-bugs/issues/583/labels{/name}",
"comments_url": "https://api.github.com/repos/webcompat/web-bugs/issues/583/comments",
"events_url": "https://api.github.com/repos/webcompat/web-bugs/issues/583/events",
"html_url": "https://github.com/webcompat/web-bugs/issues/583",
"id": 53115789,
"number": 583,
"title": "www.torinofc.it - News are updated but not in browser",
"user": {
"login": "PeopleInside",
"id": 5006150,
"avatar_url": "https://avatars.githubusercontent.com/u/5006150?v=3",
"gravatar_id": "",
"url": "https://api.github.com/users/PeopleInside",
"html_url": "https://github.com/PeopleInside",
"followers_url": "https://api.github.com/users/PeopleInside/followers",
"following_url": "https://api.github.com/users/PeopleInside/following{/other_user}",
"gists_url": "https://api.github.com/users/PeopleInside/gists{/gist_id}",
"starred_url": "https://api.github.com/users/PeopleInside/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/PeopleInside/subscriptions",
"organizations_url": "https://api.github.com/users/PeopleInside/orgs",
"repos_url": "https://api.github.com/users/PeopleInside/repos",
"events_url": "https://api.github.com/users/PeopleInside/events{/privacy}",
"received_events_url": "https://api.github.com/users/PeopleInside/received_events",
"type": "User",
"site_admin": false
},
"labels": [
{
"url": "https://api.github.com/repos/webcompat/web-bugs/labels/browser-firefox",
"name": "browser-firefox",
"color": "FF4E00"
},
{
"url": "https://api.github.com/repos/webcompat/web-bugs/labels/status-contactready",
"name": "status-contactready",
"color": "A1EBBF"
}
],
"state": "open",
"locked": false,
"assignee": null,
"milestone": null,
"comments": 3,
"created_at": "2014-12-30T13:34:39Z",
"updated_at": "2015-10-20T03:14:31Z",
"closed_at": null,
"body": "<!-- @browser: Firefox 34.0 -->\r\n<!-- @ua_header: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0 -->\r\n\r\n**URL**: http://www.torinofc.it/\r\n**Browser / Version**: Firefox 34.0\r\n**Operating System**: Windows 8.1\r\n**Problem type**: Don't know but something's wrong.\r\n**Site owner**: No\r\n\r\n**Steps to Reproduce**\r\n1) Navigate to: http://www.torinofc.it/\r\n2) You will see the news of the day\r\n3) Return in this website in next days and news are updated but you will see the old and not the new. In anonimous firefox session you can see correclty in normal, no\r\n\r\nI think is Brwoser issue.\r\nI had installed AdBlock plus on my Firefox but also i have tried to disable this for this website but continue to see the issue.\r\n\r\nSomeone can confirm and find what is the problem?\r\n\r\nThanks\r\n\r\nExpected Behavior:\r\nActual Behavior:\r\n",
"closed_by": null
} Why do we need for every issues to call the full list of labels, be cached or not. What I'm hitting at is that if we decide to be in a more controlled environment, there is no need to get the full list of labels, but just the one we allow, and that could be a list managed at the config level. No more caching issues, no more http requests and one less problem without it. 😈 Here @miketaylr should facepalm itself to have clicked the link. Let it sink in your brain 👺 |
I'm looking at simplifying some labels-related code.. |
Note @hallvors this one is really about the caching of the full labels list. Not the rest ;) |
I'm looking at everything, @karlcow :) Having a config-level list of labels is basically a cache with manual maintenance. It prevents some things that we may want to allow (like vendors who contribute defining their own browser- labels). I don't think the labels will change too often, and a GitHub PR to change them isn't too much of an overhead, so I'm not against it as such, but we should probably discuss a bit more.. |
Because we need the label editor to show all the possible labels, not just the labels already associated with an issue. I guarantee there are better ways to do this. And a config-level list seems like a good way to approach it. We probably need to think through how to deal with the label-tagger-bot and new UA strings (maybe I'm gonna go ahead and send a PR removing the caching (because browsers can do their own caching). And we can continue label discussion in a new issue. |
agreed @miketaylr |
(a config-list would help us rip out this overly-complicated way to add back namespaces when we don't know the full list in advance: |
|
Just for documentation: I got a local instance into a state where it causes the "no element found" error to happen. If the request has If-None-Match or If-Modified-Since headers, it is conditional and a 304 response is just fine. However, I pasted the URL into Fiddler's request maker and sent a request with nothing but a UA header - and the backend STILL said 304. That's just silly - it doesn't help a UA who never requested the file before to be told "oh, I've got it cached so I think you should use something cached locally too". To prove I'm actually seeing this, here's a copy of the HTTP traffic:
Obviously, this confuses the hapless browser. |
Aha! Thanks for tracking down the error. I'll do a deploy at some point today and then we'll be down with this particular bug FOREVER~~~~ 🇺🇸 🇫🇷 🎏 |
If we were using https://github.com/thadeusb/flask-cache maybe @thadeusb is interested in this thread? Unfortunately I don't know exactly what happened, but is it possible that the Flask backend sent a conditional request to GitHub's API server, and Flask-Cache simply passed on the 304 response to the client? |
(Seems development has stalled on that project though. Oh well.) |
@hallvors That would be the case. Flask-cache only deals with creating keys and managing objects within an external caching service such as Redis/Memcached. It is not for using etags or browser cache control. For that I would recommend flask-webcache. |
@thadeusb thanks for responding! :) |
Could be! We can consider that in the future. For now let's rely on browsers and GitHub doing the right thing with caching (famous last words...). |
Sadly our existing labels tests aren't good enough. This came up trying to get #712 working.
Right now on production if you open the label gear you get an empty label w/ the following error in the console:
no element found
Looks like we're sending an empty response?
This doesn't happen in dev, but the other bug is that if you open the label editor on an issue with labels, the checkboxes aren't selected. That's a regression, likely from all the namespace mangling.
I'm beginning to want to rip out all the special namespace handling code and just show them everywhere.
@karlcow any good reasons to not show
browser-foo
andstatus-foo
in the webcompat UI? Or were we just trying to have a seamless transition?The text was updated successfully, but these errors were encountered: