Skip to content
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

Export config file warnings for deprecated options #4659

Merged
merged 2 commits into from
Sep 16, 2021

Conversation

KevinOConnor
Copy link
Collaborator

This PR will add a new printer.configfile.warnings entry containing a string message reporting any deprecated config options. This should be useful for warning users about needed config updates before they become errors.

@Arksine , @meteyou , @cadriel - it would be great if the frontends could prominently display this information.

-Kevin

@Arksine
Copy link
Collaborator

Arksine commented Sep 5, 2021

I have a PR (Arksine/moonraker#223) that will add this to the list of warnings. As soon as its merged it will show in Mainsail, it doesn't appear that Fluidd shows warnings at the moment.

Below is an example.
image

It might be a good idea to render newlines so that the warnings are easier to read. Also clients might wish to check the warning list each time Klipper reports "ready" so it can update the UI if the user fixes config. Alternatively clients could just fetch Klipper's warnings directly from the configfile and create a separate section, in which case the Moonraker PR would be largely unnecessary.

@FrYakaTKoP
Copy link
Contributor

I hope you guys are prepared for the big support wave coming out of this 😊

(don't get me wrong, i like it. sooner or later people need to get rid of their legacy config)

@Arksine
Copy link
Collaborator

Arksine commented Sep 7, 2021

I'm sure there will be plenty of "what do I do" questions, but this is a pretty easy fix for the community to handle. It also gives us a chance to get people moved over before those options are invalid.

The remaining holdouts on rotation distance will probably be the most difficult. It might be useful if the frontends provided a rotation distance calculator.

@FrYakaTKoP
Copy link
Contributor

don't worry most of the support questions will land on the frontend discords, where we are now trained after the first "auth enable" wave.

What i would like to see is, instead a long string block with warnings some kind of list of warnings (it's already in a json why not add another layer or two). This would allow the frontend to render the warnings better also may directly hint the user to a guide. What in my opinion would help alot.

Didn't discuss this with mete, but i think it is worth the effort. Atleast we could reduce some of the questions.

@meteyou
Copy link
Contributor

meteyou commented Sep 8, 2021

i discussed this topic with @FrYakaTKoP and the best option for the guis would be a array with a object of each warning like this:

[
  {
    type: "deprecated",
    section: "gcode_macro PANELDUE_BEEP",
    option: "default_parameter_frequency",
    value: 1000,
    message: "Option 'default_parameter_duration' in section 'gcode_macro_PANELDUE_BEEP' is deprecated."
  },
  {
    type: "deprecated",
    section: "gcode_macro PANELDUE_BEEP",
    option: "default_parameter_layer_height",
    value: 0.2,
    message: "Option 'default_parameter_layer_height' in section 'gcode_macro_PANELDUE_BEEP' is deprecated."
  }
]

with this option we can integrate a translation for warnings and for the fallback we have the message itself. This is just a suggestion, we could implement the best possible output in mainsail.

@Arksine
Copy link
Collaborator

Arksine commented Sep 8, 2021

If it were possible to specify the file name of the config file containing the deprecated (or invalid) option it would probably be useful. Not sure that is easily done though, might be something to consider at a later date if the configfile module needs significant refactoring to track that

@KevinOConnor
Copy link
Collaborator Author

Thanks. I made some changes based on the feedback at #4659 (comment) . As recommended, printer.configfile.warnings will now be a list containing dictionaries - where each dictionary will have (at a minimum) type and message fields. I did introduce two different types right now - deprecated_option and deprecated_value. Only deprecated_value types will have a value parameter.

-Kevin

@KevinOConnor
Copy link
Collaborator Author

If it were possible to specify the file name of the config file containing the deprecated (or invalid) option it would probably be useful. Not sure that is easily done though, might be something to consider at a later date if the configfile module needs significant refactoring to track that

It might be possible to track that, but it doesn't seem to be a simple change. So, I'd recommend going forward with this smaller change before the v0.10.0 release - if desired, we can add a filename field later.

-Kevin

@meteyou
Copy link
Contributor

meteyou commented Sep 14, 2021

this works fine for me! now i have to fix some deprecated options...

image

is it possible to add the value to each option? i think it is easier for many users to understand if to find / recognize the line (as it is in their config). since from time to time certain options can be named very similar to sections.

@KevinOConnor
Copy link
Collaborator Author

It's possible to include the value field, but that seems confusing to me when the entire option is deprecated. I fear it would be confused with a deprecated_value report (Value 'rpi_temperature' in option 'sensor' in section 'controller_fan host_fan' is deprecated.).

-Kevin

Add a new printer.configfile.warnings with a list of config features
that are deprecated.

Signed-off-by: Kevin O'Connor <[email protected]>
@KevinOConnor KevinOConnor merged commit 46167ca into master Sep 16, 2021
@KevinOConnor KevinOConnor deleted the work-warn-20210904 branch September 16, 2021 17:45
@KevinOConnor
Copy link
Collaborator Author

FYI, I merged this branch. We can add additional fields in the future if desired (after the v0.10.0 release).

Thanks,
-Kevin

@github-actions github-actions bot locked and limited conversation to collaborators Oct 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants