Skip to content

Fix version comparisons when installing/updating/downgrading#19631

Merged
seanbudd merged 29 commits into
betafrom
fixCompareVersion
Feb 20, 2026
Merged

Fix version comparisons when installing/updating/downgrading#19631
seanbudd merged 29 commits into
betafrom
fixCompareVersion

Conversation

@seanbudd

@seanbudd seanbudd commented Feb 17, 2026

Copy link
Copy Markdown
Member

Link to issue number:

May fix #19600
Fixes #18291

Summary of the issue:

  • NVDA would identify a downgrade if the old installed copy files were created before/after the new installer. This should instead compare the versions of the NVDA files. By checking timestamps, an alpha build of 2026.2 created before 2026.1 was released would be identified as a downgrade incorrectly.
  • NVDA would check "Use NVDA during sign-in" by default when performing a fresh install. This might be considered a security issue, and should be explicitly opt-in.
  • NVDA would always check "Use NVDA during sign-in" by default when not performing a fresh install, but downgrade/upgrade status could not be determined. i.e. we know that a previous copy exists, but we don't know the time difference of the files, so we don't check the registry. instead we should check the registry if we know a previous copy exists.
    NVDA would do the same for creating the desktop shortcut.
  • NVDA would not warn about downgrading a portable copy

Description of user facing changes:

  • NVDA will no longer check the "Use NVDA during sign-in" by default when performing a fresh install
  • NVDA will now check the registry to see if "Use NVDA during sign-in" is set even if we are unsure if the previous install makes this an upgrade or downgrade.
  • NVDA will now check to see if we should re-create the desktop shortcut, even if we are unsure if the previous install makes this an upgrade or downgrade.
  • NVDA should now correctly identify downgrades and show the Downgrade warning dialog appropriately including for portable copies

Description of developer facing changes:

  • installer._comparePreviousInstall now returns a ComparisonState enum
  • gui.installerGui.doInstall parameter startOnLogon default value is now False not True

Description of development approach:

This pull request refactors the installer logic to improve version comparison and installation flow, primarily by introducing a new ComparisonState enum for clearer handling of installation states.

  • Introduced a ComparisonState enum in installer.py to represent installation comparison results more clearly (e.g., FRESH_INSTALL, UPGRADE, REINSTALL, DOWNGRADE, UNKNOWN), replacing the previous integer/None return values. The comparePreviousInstall function now returns this enum and uses file version information for comparison instead of file modification times.
  • Updated installerGui.py to use the new ComparisonState enum throughout the installation logic, ensuring correct handling of fresh installs, upgrades, and downgrades, and improving the logic for desktop shortcut creation and "start on logon" options. [1] [2] [3] [4]

Testing strategy:

  • Test updating to this PR
  • Test downgrading to this PR
  • Test sidegrade (reinstall) with this PR
  • Test unknown upgrade/downgrade with this PR (modify file version)
  • Test silent install from CLI variations
  • Test fresh install
  • Test upgrading/downgrading portable copies

Known issues with pull request:

The backwards compatibility here might not be correct. Callers may need to call .value on the return of comparePreviousInstall to have the same behaviour. We may either need to make an API breaking change, a deprecation layer, or create a new function entirely and keep the old broken one.

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.

@seanbudd seanbudd marked this pull request as ready for review February 17, 2026 02:20
@seanbudd seanbudd requested a review from a team as a code owner February 17, 2026 02:20
@seanbudd seanbudd marked this pull request as draft February 17, 2026 02:20
@seanbudd seanbudd added this to the 2026.1 milestone Feb 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors NVDA's installer logic to fix version comparison issues and correct the default behavior of the "Use NVDA during sign-in" checkbox. The changes aim to resolve issue #19600 where the checkbox was being enabled without user action. The core improvement replaces file modification timestamp comparisons with actual file version comparisons using Windows version info APIs.

Changes:

  • Introduced a ComparisonState enum to represent installation states (FRESH_INSTALL, OLDER, SAME, NEWER, UNKNOWN) instead of integer/None values
  • Updated version comparison logic to use file version information instead of file modification timestamps
  • Fixed "Use NVDA during sign-in" checkbox to default to False for fresh installs and check registry settings for existing installations
  • Added type annotations and improved documentation for getFileVersionInfo function

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.

File Description
source/installer.py Introduces ComparisonState enum and refactors comparePreviousInstall() to use file version comparison instead of timestamps
source/gui/installerGui.py Updates installer GUI logic to use ComparisonState enum and fixes default checkbox behavior for "Use NVDA during sign-in"
source/fileUtils.py Adds type annotations and documentation to getFileVersionInfo function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/installer.py
Comment thread source/installer.py Outdated
Comment thread source/installer.py Outdated
Comment thread source/installer.py Outdated
Comment thread source/installer.py Outdated
Comment thread source/installer.py Outdated
Comment thread source/gui/installerGui.py Outdated
Comment thread source/fileUtils.py Outdated
Comment thread source/gui/installerGui.py Outdated
@seanbudd seanbudd changed the title Fix version comparisons when installing/updating Fix version comparisons when installing/updating/downgrading Feb 17, 2026
Comment thread source/installer.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/installer.py Outdated
Comment thread source/installer.py Outdated
Comment thread source/gui/installerGui.py Outdated
Comment thread source/installer.py Outdated
seanbudd and others added 2 commits February 17, 2026 17:46
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@SaschaCowley

Copy link
Copy Markdown
Member

The approach here looks good to me. I think we can probably get this in to 26.1 if it's ready soon.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/installer.py Outdated
Comment thread source/gui/installerGui.py
Comment thread user_docs/en/changes.md
@seanbudd seanbudd marked this pull request as ready for review February 18, 2026 02:45
@seanbudd seanbudd marked this pull request as draft February 18, 2026 04:20
Comment thread user_docs/en/changes.md Outdated
@seanbudd seanbudd marked this pull request as ready for review February 19, 2026 02:43

@SaschaCowley SaschaCowley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Mostly wording suggestions and one type annotation fix.

Comment thread source/gui/installerGui.py Outdated
Comment thread source/gui/installerGui.py Outdated
Comment thread source/gui/installerGui.py Outdated
Comment thread source/gui/installerGui.py Outdated
Comment thread source/gui/installerGui.py Outdated
Comment thread source/gui/installerGui.py Outdated
Comment thread source/installer.py Outdated
Comment thread source/installer.py Outdated
Comment thread user_docs/en/changes.md Outdated
@seanbudd seanbudd marked this pull request as draft February 19, 2026 06:30
Comment thread source/installer.py Outdated
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
@seanbudd seanbudd marked this pull request as ready for review February 19, 2026 06:34
@seanbudd seanbudd merged commit bb1d7d8 into beta Feb 20, 2026
85 of 91 checks passed
@seanbudd seanbudd deleted the fixCompareVersion branch February 20, 2026 03:14
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.

3 participants