-
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
[discussion] Config-level list of accepted labels? #781
Comments
The controlled list would make it a lot simpler indeed. A proposal would be to have a separate json file to deploy that would be read when the server is started (and/or any Step 2. Would be to remove the HTTP request entirely little by little having both in parallel if necessary, they would be fed from the same file and/or data structure. |
Implementing this is easy ;) Adding one JSON file and changing one URL in the JS source, done. Here's what the backend sends right now: But we could also tweak the JSON a bit and simplify the code handling it even more. For example, the current JSON is an array of these objects:
and we could make that
and use "category" for grouping in the UI and prefixing when saving to GitHub. |
I have partly suggested this in the code for @magsout in https://github.com/karlcow/webcompat.com/blob/486ecaf01fa08edfa65116a17586a6e1894ebdb1/config.py.example#L104 The data model can be improved. |
So 344b277 is a possible (basic) implementation of this. It simply adds the JSON file GitHub is currently sending to |
We might want to augment this fix with some code that makes sure existing labels on an issue get listed in the labels editor even if they are not included in the hardcoded "all labels" list - just to guard against data loss. I'll look into that.. |
A suggestion for how to make sure we don't drop labels that are not in the labels.json list on the floor is here: c04e67a |
(and now I've grabbed somebody else's issue without reassigning again..) |
(Hm, I don't even think I meant to assign myself this issue.) |
In the pull request / code review we're discussing a little how the static json file should get updated - like periodic downloads from Github, or every time the webcompat app i started, or manually / through pull requests. This decision depends on what exactly we want to achieve here.
From some of the above discussion, I thought we were doing the former. From the PR discussion it sounds like we're doing the latter. Thoughts? (Personally I think we should just go with the current code and iterate if we change our minds - it's not hard to change - because the site is semi-broken and labels are being dropped and lost without this fix or something equivalent.) |
My understanding of "Config-level list of accepted labels" is we manually enumerate the labels we want to display in the webcompat UI (and then from that we generate a JSON file to serve to the client). What we have in #812 is just serving today's version of the repo's labels. I'm less interested in saving a single (asynchronous) request to GitHub, but that's a bonus. (and #781 (comment) led me to believe we wanted to build the JSON response ourselves, not just re-hash what GitHub gives us).
If we want a quick fix, we can just land #803. |
No problem, let's land #803 and take the time to agree on what we want to do here. |
This shouldn't have been closed, I think. Let's discuss how to solve this in Orlando and move forward. ⏩ |
Summarizing our discussion: we agree that we want this for the following reasons:
Having a static list on the backend will fulfil all those reasons. However, we don't need to maintain a GitHub-style JSON file with URLs and colours per label - this just adds overhead. We can do just a plain text file or simple array - for example in static/config/labels.txt |
My proposal: I'd like to improve performance not only by not hitting GitHub, but also by including the list of labels in our built JS file so that we don't need an extra XHR request to get them. Nearly every page we show needs to know something about labels. They should simply be included. |
Hold off on sending a PR, just yet. I know @karlcow has some ideas around why we might need to have these labels in memory from the Python side as well. If that's the case (I forget the specifics right now), then having the list of labels in a labels.py dict (or in config.py, or literally anywhere that Python can read them) would be good. From that we can build out a labels.js (serving plain .txt seems weird?) and include that in relevant files via the build system. @karlcow, remind us? It would mean adding new labels would require a new deploy/build, but that's how we ship all new features -- seems OK. |
I think we can split this up into a number of tasks:
I think we should ignore the CSS. We just use the same names as labels because it's convenient for us to know where to stick the right colors, etc. And I don't want to start sticking Python templates into our CSS if we can avoid it. We already have a JS build process for them... let's not add more if we can avoid it. |
(and yes, we should open new bugs for 1 - 3, if we're going to work on them). |
(Minor point I just want to mention: we should not add more non-sensitive stuff into config.py - or if we do choose to put them in config.py we should fix #786 first so we avoid all those painful updates where you first debug and then finally remember to copy and paste new stuff from config.py.example to your own config.py.) |
Let's reconsider after #886 |
Previous discussions:
#436 (comment)
#773 (comment)
Pros:
Cons:
Discuss!
The text was updated successfully, but these errors were encountered: