Skip to content

Properly convert strings to booleans when upgrading profiles to the new schema#14183

Merged
seanbudd merged 1 commit into
nvaccess:branchFor2022.4from
lukaszgo1:confUpgradeStepsConvertStringsToBooleans
Sep 26, 2022
Merged

Properly convert strings to booleans when upgrading profiles to the new schema#14183
seanbudd merged 1 commit into
nvaccess:branchFor2022.4from
lukaszgo1:confUpgradeStepsConvertStringsToBooleans

Conversation

@lukaszgo1

Copy link
Copy Markdown
Contributor

Opened against branch for 2022.4 since this fixes regression which ideally should not get into the release.

Link to issue number:

None, fix-up of #14132

Summary of the issue:

When upgrading configurations to the new versions of the schema we often need to check what value was set previously as not to change user preferences. In our profile upgrade steps we relied on the fact that false values in the config are falthy in the boolean context, but at the state where profile is upgraded these are not yet transformed into right types, so a value set to False is set to literal string "False" which is always truthy in a boolean context.
I've discovered this when, after #14132 got merged, in the profile where I had reporting of row and column headers disabled it got re-enabled after the schema update.

Description of user facing changes

People who have reporting of row and column header disabled would still have them disabled after updating to NVDA 2022.4.

Description of development approach

In places where we check if the option is set to True in our profile upgrade steps I used the default configobj converter between string and booleans to convert options into the right values. In addition I've removed some unnecessary pass statements and some variables capturing exceptions which weren't used.
While fixing previous upgrade steps would not help people who are upgrading NVDA regularly it still made sense to do so, to support people who skipped several upgrades and to have consistent style for the upgrade steps.

Testing strategy:

With a config profile using previous version of the schema and with reporting of row and column headers disabled upgraded into the latest schema - made sure reporting of row and column headers remained disabled.

Known issues with pull request:

People on Alpha who had reporting of rows and column disabled still have to set the configuration manually - there is no way to fix this automatically.

Change log entries:

None needed - unreleased regression.

Code Review Checklist:

  • Pull Request description:
    • description is up to date
    • change log entries
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • API is compatible with existing add-ons.
  • Documentation:
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • Security precautions taken.

@lukaszgo1 lukaszgo1 requested a review from a team as a code owner September 25, 2022 12:09
@lukaszgo1 lukaszgo1 requested review from seanbudd and removed request for a team September 25, 2022 12:09
@lukaszgo1

Copy link
Copy Markdown
Contributor Author

cc @seanbudd @feerrenrut

@CyrilleB79 You may also want to review this.

@CyrilleB79

Copy link
Copy Markdown
Contributor

Good catch @lukaszgo1, many thanks!
That's a case where type hints would have been very useful!

@seanbudd seanbudd changed the base branch from branchFor2022.4 to master September 26, 2022 00:36
@seanbudd

Copy link
Copy Markdown
Member

@lukaszgo1 - can you open temp

@seanbudd seanbudd closed this Sep 26, 2022
@seanbudd seanbudd reopened this Sep 26, 2022
@seanbudd

Copy link
Copy Markdown
Member

I've changed the base to master temporarily to run the build system and tests on AppVeyor.

This needs to retarget branchFor2022.4 after these succeed.

@seanbudd seanbudd added this to the 2022.4 milestone Sep 26, 2022
@seanbudd seanbudd changed the title Properly convert strings to booleans when upgrading profiles to the new shema. Properly convert strings to booleans when upgrading profiles to the new schema Sep 26, 2022
@seanbudd seanbudd changed the base branch from master to branchFor2022.4 September 26, 2022 02:23
@seanbudd seanbudd merged commit 44a2dde into nvaccess:branchFor2022.4 Sep 26, 2022
@lukaszgo1 lukaszgo1 deleted the confUpgradeStepsConvertStringsToBooleans branch September 26, 2022 06:05
@feerrenrut

Copy link
Copy Markdown
Contributor

Is it possible that this fixes the cause of:

@seanbudd

seanbudd commented Oct 3, 2022

Copy link
Copy Markdown
Member

I think that's really unlikely, #8720 is thought to be caused by an issue with fetching/setting the registry.

It would also be difficult to confirm if this fixes the issue, as #8720 cannot be consistently reproduced

feerrenrut pushed a commit that referenced this pull request Nov 23, 2022
Closes #14170

Summary:
For some GUI settings, a difference between the default (base) profile and another profile,
could have unexpected results.
An example:
- A profile named 'Notepad' with setting (GUI option) 'line indentation reporting' to 'tones'
- The default profile with the same GUI option set to 'speech' 
- Result: indentation reported with speech and tones instead of tones only when returning to notepad
- Issue #14170 contains detailed steps.

Only one combo-box was used to set line indentation reporting in the UI, but the value of this
combo-box was saved in two items in the configuration.
These two items were then managed separately when dealing with configuration profile switching.

The following combo-boxes in the GUI were impacted by this issue:
* "Line indentation reporting" in doc formatting settings
  - See initial description of #14170
* "Cell borders" in doc formatting settings
  - See #14170 (comment)
* "Show messages" combined with "Message timeout" in braille settings 
  - See #14170 (comment)
* "Tether Braille" in braille settings
  - See #14170 (comment)

Change for users:
The values of the following settings should not change unexpectedly anymore
when switching profile:
* Line indentation in Document formatting settings.
* Cell borders in doc formatting settings
* Show messages in braille settings
* Tether Braille in braille settings

Approach:
* One control in the GUI now matches one and only one item in the config
* Upgrade the config adequately
* Used the same approach as #14132 (and the fix in #14183)

A note on profile upgrade:
Because it is possible for arbitrary stacking order for config profiles it is not possible
to determine the setting which would be expected by the user.
Config stacking can be caused by mixes of the following, default/base, manually enabled profile, app triggered profile, say-all triggered profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants