Fix #733: roll back PluginManager.register on validation failure - #740
Closed
adityabagla7 wants to merge 1 commit into
Closed
adityabagla7 wants to merge 1 commit into
adityabagla7 wants to merge 1 commit into
Conversation
Validate hook implementations before the plugin is published, and roll back any new empty hook callers if registration fails, so a rejected plugin can be fixed and registered again. Co-authored-by: Cursor <cursoragent@cursor.com>
Member
|
Written by Claude Opus 5.5 via Claude Code for the #740 author; I prompted it, it did the work, I read it. Thanks for picking up #733. Closing in favour of #741, which does the same validate-then-install split in two plain passes. Hook callers are only created once validation has passed, so there is nothing to roll back. It also leaves historic-replay failures alone, since those are outside #733 and unregistering there would change behaviour for plugins registered late. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #733
PluginManager.register()stored the plugin and installed earlier hook implementations before a later implementation was validated. If_verify_hookraisedPluginValidationError, the plugin stayed in the manager and those implementations stayed on the hook.Registration now checks every implementation before the plugin is published. Hook callers created only for this attempt are removed if validation fails, and a failure while installing implementations unregisters the plugin. A caller can fix the plugin and register it again.
Test plan
pytest testing/test_pluginmanager.py testing/test_hookcaller.py testing/test_invocations.py(118 passed)he_method1, one invalidhe_method1, and a new hook name raisesPluginValidationErrorand leaves no plugin, nohe_method1impls, and no new hook caller; a corrected plugin can then be registeredPlease review and assign this if that is how you track the issue. I have not contributed to pluggy before.
Made with Cursor