Skip to content

Don't save mathCAT settings to yaml#19637

Merged
SaschaCowley merged 1 commit into
betafrom
mathCatPrefs
Feb 18, 2026
Merged

Don't save mathCAT settings to yaml#19637
SaschaCowley merged 1 commit into
betafrom
mathCatPrefs

Conversation

@SaschaCowley

Copy link
Copy Markdown
Member

Link to issue number:

Follow-up to #18323, #19373 and #19613

Summary of the issue:

Since the introduction of MathCAT into NVDA in #18323, NVDA has persisted MathCAT settings to a YAML file . This is at odds with current project configuration standards, which use either configobj ini files, or JSON. This also duplicates settings, as they're also saved to nvda.ini.
Originally, these were stored in %AppData%\MathCAT\prefs.yaml, but as of #19373, they are saved to mathcat.yaml in NVDA's config directory. In neither case was shouldWriteToDisk checked before saving the preferences. Additionaly, NV Access's Corporate & Government page states "To prevent NVDA users from modifying their configuration or add-ons directly, user write access to [%APPDATA%\nvda] must also be restricted". If implemented, this would have stopped users from changing their MathCAT settings in memory, as they had to be saved to YAML to be loaded by MathCAT.
In #19613, the logic was changed to programmatically apply these settings with libmathcat.SetPreference, which should solve the problem of users without write access to their NVDA config directory being able to change their MathCAT preferences. However, the code that wrote the settings to the YAML file was not removed, nor did it contain any error handling.

Description of user facing changes:

None, but may avoid some errors in the logs.

Description of developer facing changes:

Pyyaml is no-longer a dependency.
mathPres.MathCAT.preferences.MathCATUserPreferences.save has been renamed to apply, and no longer saves the settings to YAML. Settings persistance is handled by NVDA's configuration system.

Description of development approach:

Removed the code that wrote MathCAT preferences to YAML, and any code that only it depended on. Renamed save to apply using VS Code's refactoring tool. Searched the repo for yaml and after confirming that we don't rely on pyyaml anywhere else, ran uv remove pyyaml.

Testing strategy:

Tested by loading the Wikipedia page on the quadratic formula in firefox. Located some math and read it. Changed settings one at a time and tested that they were applied correctly. Restarted NVDA and ensured that the new settings were still present.

Known issues with pull request:

None known

Code Review Checklist:

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

@SaschaCowley SaschaCowley requested a review from a team as a code owner February 18, 2026 01:55
@SaschaCowley SaschaCowley added this to the 2026.1 milestone Feb 18, 2026
@seanbudd

Copy link
Copy Markdown
Member

should we just remove this entirely if it just duplicates settings?

@SaschaCowley

Copy link
Copy Markdown
Member Author

should we just remove this entirely if it just duplicates settings?

Remove what? I've removed the YAML support, but the rest of mathPres.MathCAT.preferences is responsible for interfacing between NVDA and MathCAT (e.g. getting supported languages, converting our config keys to ones understood by MathCAT, actually applying settings to MathCAT).

@seanbudd

Copy link
Copy Markdown
Member

Sorry I misread the PR description. I thought we were still retaining a separate (non-YAML) file for settings in this PR

@SaschaCowley SaschaCowley merged commit 1ff05bd into beta Feb 18, 2026
73 of 75 checks passed
@SaschaCowley SaschaCowley deleted the mathCatPrefs branch February 18, 2026 06:51
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.

2 participants