[PR #2422] Add Warnings during settings load #24928

Open
opened 2026-01-31 09:06:09 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/2422

State: closed
Merged: Yes


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
**Original Pull Request:** https://github.com/microsoft/terminal/pull/2422 **State:** closed **Merged:** Yes --- <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## 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](https://user-images.githubusercontent.com/18356694/62965553-f603d300-bdca-11e9-84d2-8c653b65e68a.png) **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](https://user-images.githubusercontent.com/18356694/62965545-f1d7b580-bdca-11e9-8645-2cf17a416a82.png) <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #1348 * [x] Closes #990 * [x] Closes the issue where the json being empty crashes the app * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] (☞゚ヮ゚)☞**Tests added/passed** ☜(゚ヮ゚☜) * [N/A] Requires documentation to be updated * [x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## 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
claunia added the pull-request label 2026-01-31 09:06:09 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#24928