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

Add Warnings during settings load #2422

Merged
12 commits merged into from
Aug 16, 2019
Merged

Conversation

zadjii-msft
Copy link
Member

Summary of the Pull Request

Adds support for two things: more discrete settings errors that we can detect on load, and discrete warnings we can detect on load.

Errors are things that we might find that cause the settings to be totally invalid. At the moment, there are two such cases:

  • Failing to parse the JSON at all
  • Failing to find any profiles. We need some profiles to be able to run.

When we find such an error case, we'll display more specific text in the popup:
image

Warnings are things that aren't necessarily fatal, but they certainly aren't good. I focused on two cases:

  • Failing to find the default profile in the list of profiles
  • Finding duplicate profiles in the list of profiles.

When we find a warning, we'll try to mitigate it, and keep running. We won't save the settings on load, because we'll have likely changed them internally. We'll also display all the warnings to the user, so they can see what they did wrong.
image

PR Checklist

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

  • I added tests.
  • I tried loading a totally empty profiles.json
  • I messed with the settingonce the app was open to see if this would work during reload
  • I tried removing the profiles entirely
  • I tried having 2 warnings simultaneously
  • I tried having invalid json

  * Add a ton of tests
  * Polish the _GetMessageText bits
  * Add code to check for duplicate profiles
  * Verify that many warnings work at the same time
  * comments y'all
@zadjii-msft zadjii-msft added Area-Settings Issues related to settings and customizability, for console or terminal Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels Aug 13, 2019
@zadjii-msft zadjii-msft self-assigned this Aug 13, 2019
</value>
</data>
<data name="DuplicateProfileText" xml:space="preserve">
<value>Found multiple profiles with the same guid in your profiles - temporarily ignoring duplicates. Make sure each profile's guid is unique.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we capitalize GUID?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually we do, but at the same time, the key is guid not GUID, so IDK. Maybe we should have a wordsmith's opinion @bitcrazed @cinnamon-msft

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the projects I've seen follow much of the guidance in Google's JSON Style Guide which states that property names should be camel cased:

{
  "thisPropertyIsAnIdentifier": "identifier value"
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sooooooooo you're saying we should call it gUID?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bitcrazed This is not a question about our json schema. This is a question about a user-facing error message

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhhhh - apologies!

In human-text, acronyms formed from the initial letter of each word should be all-caps - GUID.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with GUID

@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Aug 13, 2019
@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Aug 14, 2019
Copy link
Contributor

@DHowett-MSFT DHowett-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this properly propagate error texts up from jsoncpp?

@zadjii-msft
Copy link
Member Author

Does this properly propagate error texts up from jsoncpp?

you better believe it does :D

@DHowett-MSFT
Copy link
Contributor

This is a real failure in x86.

packages\Taef.Redist.Wlk.10.38.190610001-uapadmin\build\Include\Verify.h(539,31): Error C4389:  '==': signed/unsigned mismatch (compiling source file SettingsTests.cpp)
Process 'msbuild.exe' exited with code '1'.

Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(1) if I change the defaultProfile to an invalid guid, I get "No profiles were found in your settings.
". Not sure if you want to address that in this PR or open a new issue.

(2) In our dialog box, we should explicitly mention that we're temporarily using the "Windows Terminal default settings" or something to that nature. That way users know what is happening when there is an error. That should probably address my "temporarily" issue below.

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 14, 2019
…ettings-warnings

# Conflicts:
#	src/cascadia/TerminalApp/App.cpp
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 15, 2019
  * Fix x86 build break
  * Add a bit on "using the defaults" when we encountering an exception
  * remove a redundant variable
@zadjii-msft zadjii-msft added the Needs-Second It's a PR that needs another sign-off label Aug 15, 2019

// We don't use the what() method - we want to be able to display
// localizable error messages. Catchers of this exception should use
// _GetErrorText to get the localized exception string.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this _GetErrorText? Also, wouldn't providing a what() at least help someone figure out what's going on in the debugger moreso than providing nothing even if it's not localized?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some placeholder text. I f you really want, we could file a task to try and make that text specific to the exception value

@carlos-zamora
Copy link
Member

Text feels a bit redundant now. Like...
"Failed to load settings" and "Settings cound not be loaded from file"
"temporarily using the default settings" and "Temporarily using the Windows Terminal default settings."
image

Just something for us to be on the lookout for. Since we'll be defaulting to the Windows Terminal default settings, this means that the user may be working with profiles that don't exist AFTER the proper settings are imported. For example...

  • reate a tab from the WT default settings
  • import your custom settings
  • duplicate the created tab
  • CRASH!
    I'd bet that this is because we usually use "FindProfile()" (or something like that) and we just don't handle that properly. Want to go through and fix it now or should I submit an issue?

@miniksa miniksa added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 16, 2019
@zadjii-msft
Copy link
Member Author

@carlos-zamora yea that is pretty redundant now. I'll try and update that.

As far as the reload/duplicate crash, let's file a new issue, since that's not necessarily worse because of this change

@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 16, 2019
@cinnamon-msft
Copy link
Contributor

cinnamon-msft commented Aug 16, 2019

Nit: Could we change "in your profiles" to "in your profiles.json"? (I'm using an old screenshot, but the wording is still there)
image

@DHowett-MSFT
Copy link
Contributor

We may want to go less specific and just say “in your configuration file”?

@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Aug 16, 2019
@ghost
Copy link

ghost commented Aug 16, 2019

Hello @zadjii-msft!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit d7d96f7 into master Aug 16, 2019
@ghost ghost deleted the dev/migrie/f/1348-settings-warnings branch August 16, 2019 21:21
@ghost
Copy link

ghost commented Aug 27, 2019

🎉Windows Terminal Preview v0.4.2382.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Settings Issues related to settings and customizability, for console or terminal Area-UserInterface Issues pertaining to the user interface of the Console or Terminal AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Second It's a PR that needs another sign-off Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Display a specific error for not finding the default profile Possibly expose exception text on error dialog
7 participants