-
-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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: Thanks. |
source/addonHandler/__init__.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 asAddonError
finally
statementreturn
ing 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
.zip
from the nameTest install/update from add-on store
%APPDATA%\nvda\addonStore\_dl
Known issues with pull request:
None
Code Review Checklist:
Summary by CodeRabbit
New Features
Improvements
Documentation
Refactor