Safer handling of the initial installation of add-ons#16851
Conversation
WalkthroughThe changes aim to improve error handling and logging during the addon bundle installation process. The Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GUI as addonGui
participant Handler as addonHandler
participant Store as addonStore
User->>GUI: Initiates Addon Installation
GUI->>Handler: Calls installAddonBundle
Handler->>Handler: Extracts Bundle and Installs Addon
Handler->>Handler: Catches Exceptions and Logs Errors
Handler->>Handler: Stores Exceptions in bundle._installExceptions
Handler-->>GUI: Returns Installed Addon or None
alt Installation Successful
GUI->>Store: Proceed with Installation
else Installation Fails
GUI->>Store: Handle Cleanup
end
GUI-->>User: Provides Installation Result
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
|
@josephsl - could you test this build? could you also provide a sample add-on to confirm testing with? |
|
Hi, Tested from the source code copy and things work as expected. To reproduce, use the attached test version of Windows App Essentials build. When the add-on is run with the PR applied, you'll get a message about unsupported Windows release (don't worry about the message itself as we're testing the install failure mechanism). Thanks. |
|
Be sure to rename from .zip to .nvda-addon extension. |
|
@josephsl - I think that failed to attach |
|
Hi, As an alternative, try the following add-on for testing purposes: https://github.com/josephsl/wintenApps/releases/download/24.06/wintenApps-20240714.0.0.nvda-addon Thanks. |
| during the installation process. | ||
|
|
||
| :return: The installed add-on object, or None if the installation failed. | ||
| Regardless if installation failed or not, the created add-on object should be returned |
There was a problem hiding this comment.
Seems this line contradicts the previous line? I.e. returning None if installation fails verses the addon object should ways be returned even if installation fails.
Link to issue number:
Fixes #16704
Fixup of #15967
Summary of the issue:
In the following code block:
https://github.com/nvaccess/nvda/blob/release-2024.2/source/addonHandler/__init__.py#L432-L454
addon.runInstallTask("onInstall"), it is caught, and then re-raised asAddonErrorfinallystatementreturning the add-onDescription of user facing changes
Add-on installation failures should fail gracefully
Description of development approach
Instead of raising exceptions, store them and exit the installation process when a failure occurs.
If exceptions are stored, cancel the installation and perform the require clean-up tasks
Testing strategy:
Test external add-on install
.zipfrom the nameTest install/update from add-on store
%APPDATA%\nvda\addonStore\_dlKnown issues with pull request:
None
Code Review Checklist:
Summary by CodeRabbit
New Features
Improvements
Documentation
Refactor