-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Improve build error/warning suggestions #3399
Comments
I like this idea. Adding a little more to this, I think we can make the Besides, each of this |
I'd vote against a separate table, it probably isn't necessary. I think we want to add a I say this as |
Removing this from new template project, this is mostly a backend change to start. We can discuss whether to surface this in the UI immediately or not, but I don't think we need to do too much on the front end side to accomplish this at the moment. The implementation in the new templates might look a little different however. |
My mind has maybe changed on this. If we want multiple warnings, we probably do need additional modeling like @humitos suggested previously. At very least, we need to be able to store an array of errors/warnings ids emit from a build. We probably still want to maintain the error/warning text inside application classes however, leveraging localization we already have and use. So |
Today I saw this message on CircleCI and I liked it: The link goes to https://discuss.circleci.com/t/legacy-convenience-image-deprecation/41034 |
One more thought here on technical implementation. It might be nice to use some of these error states on the build listing page. In template logic, some of the conditionals I might want to use are:
Implementation might depend a bit on this use case, as I'll want to have an easy to maintain way of using template error classes in template logic. Also, because this will be on the listing page, it could have negative impacts on build query time. Perhaps this could make more sense as a JSON field. |
I think we can handle all these cases by expanding the number of |
Hah maybe this is already getting confusing. Do you mean expanding the number of I'd still consider Build.state in [
Build.QUEUED,
Build.CLONING,
Build.INSTALLING,
Build.BUILDING,
Build.UPLOADING,
Build.COMPLETE,
] And As part of #9100, I broke out the larger discussion to #9110. There are a few questions there that relate to this issue. If we can come to some consensus there, we can figure out if this issue is still important, or if it becomes merged into a discussion about |
No. I'm saying that we can expand |
Okay so then I'd probably disagree there, this is the pattern I'm trying to get away from because the template and JS logic are far more confusing with this pattern. If we separate the two concepts:
If we combine the two concepts, we'll just need logic to unravel the combination field back to a list of steps, so that templates can describe the steps sequentially again. Reducing the number of fields doesn't really seem like a strong benefit, especially if we just need helpers to unravel this back to usable forms. Is there some strong benefit combining the two provides? |
In my proposal, it's easier for me to understand that
(extra messges are at and there is no other way to read the In your proposal, to express the same we need to make sure we are setting 3 fields:
IMHO, this could be more flexible but also more error and inconsistent data prone. I'm sure we will end up with a combination of those fields that should not be possible (e.g. |
I feel like what you are describing is the need for code level constructs though, not a data construct. To me, combining the fields into a singular field mostly feels mostly like a lateral move to abstract the storage of this data. We still need to break it apart when we need to use the data or query for one half of this combined field. With code level constructs, we can make queries and comparisons more descriptive, as well as contain logic in a single place. This avoids taking on work that will be costly and highly prone to pain, but gives us much more usable helpers for build state. Psome pseudo python: class BuildCancelled:
build_state = Build.STATE_ALL # or mock.ANY like object
build_status = [Build.STATUS_CANCELLED]
# Query with mgr method
Build.objects.is_state(Cancelled)
# Compare object
if build == BuildCancelled or build.is_state(BuildCancelled):
pass
# Avoid impossible scenarios by consolidating logic
build.set_state(BuildCancelled)
I don't feel strongly here, but I do suppose I think where I'm leaning is:
Still Anyways, the cost to this is very low in comparison, as we aren't altering a field. I'd only need to worry about adding conditional logic to templates/JS between the display of the old error format and the new error format. This is considerable work already, and so altering Build more has me even more concerned about downstream affects this change would have on templates and JS.
With some code level additions, we can help avoid this. But also, it doesn't really seem like |
I'm not describing something like that. I don't want to depend on those code helpers to keep consistency in data. In particular, when we can have the same without requiring extra code and just adding some extra states. I'm just suggesting adding more "final states" instead of "having only one ( I made a drawing to explain myself better:
(I'm suggesting using
If this is a method, how do we query at db level for successful builds? |
I think there are some useful points discussed, and parts of your implementation are what I would want if we were starting from scratch, but this refactor seems like mostly a lateral move due to the work that would actually be required. That, and it doesn't seem like this is solving a pervasive issue, but if it is it seems like the issue mostly affects core team. I still think code additions to help consolidate logic are our best option here. Core team can see some benefit without negatively affecting existing code, and users won't have data or APIs changed on them. The error message refactor is the more impactful of the two refactors though, so we should resolve what we need to unblock that and perhaps focus on just that for now. What you are describing is seeming like a combination field: Build.state + Build.status + some subset of error messages. The addition of build errors in this combination field feels at odds with
But then it also feels like bad design to put some error messages in WorkThe refactor to
There are several statuses that sit somewhere between
I would do this because on the build listing pages, I don't want granular information like "cancelled by user" vs "cancelled automatically". I'd just show the build as cancelled on the listing page. I would show by user, automatic, and duplicated cancellations on the detail page. This data is used by both templates (and so django model attrs/methods) and via our API (where I need to replicate chunks of the Build model in JS). |
I removed assignment, this is a very backend change. I'd still like to see this happen. I keep finding places where I want messages emit from the build process, instead of from template logic like: readthedocs.org/readthedocs/templates/builds/build_detail.html Lines 152 to 187 in 68fd63b
Not a huge deal to bring this pattern into the dashboard, but I'd like to start wrangling our error/info message patterns at some point. |
Note, I added the following issue and discussion:
Given this issue has gone in a few directions, it's probably worth moving the remaining discussion to the newer issue. I think my original description is still close to what we're talking about ultimately though. |
I read all this conversation again and I'm considering the ideas talked here. We will be able to attach multiple notifications to the same build (error, warning, note and tips). This means we don't need the field Besides, each notification will have an ID to a particular message that will support HTML content as described here. |
Currently, we are duplicating throwing an error logic in our build tips, along with the pattern of using logic in templates to determine this. There are two areas that we can improve on to provide a more useful pattern.
For example, a build is failed when we detect a failure state in the build task. This build is then recorded with the failure text and an exit code. On view, we are duplicating this logic, searching for a reason for failure. I think the build should be updated on failure with enough information that the view or template can simply reference the error.
For example, some vaguely psuedo python:
We also need to add a field to the build model to track the error code. This will be used to reverse the suggestion. Build exceptions should have a
get_suggestion()
method and perhaps some easy method of templating out new suggestions.This will accomplish:
Update:
To summarize what we are discussing doing here, and to maybe provide a little additional context to this change:
{% for error in build.errors %}<div class="{{ error.class }}">{{ error.message }}</div>{% endfor %}
The text was updated successfully, but these errors were encountered: