Repository navigation
fix: register supernotify.* actions in async_setup (quality scale action-setup) - #345
Merged
Merged
Conversation
…ion-setup) The actions were registered when the config entry loaded and removed when it unloaded, so automations using them failed validation while Supernotify was starting or after a failed setup. They are now registered once from async_setup, and each looks up the loaded entry's engine when called, raising a translated ServiceValidationError when it isn't loaded. This was the one Bronze rule not met. enquire_configuration now reads the config from SupernotifyEngine.full_config. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 tasks done
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.
Summary
Step 1 of 3 towards an accurate quality scale level.
action-setupwas the one Bronze rule not met, so the declared Silver level was overstated. With this, Bronze and Silver are both met.actions.py:async_setup_actions(hass)registers thesupernotify.*actions once, fromasync_setup, so they exist whether or not the config entry is loaded, and automations using them always validate. Each handler looks up the loaded entry's engine when called (_loaded_engine), raising a translatedServiceValidationError(not_loaded) when there isn't one.async_unregister_engine_actionsandACTION_NAMESare gone.enquire_configurationreads the config from the newSupernotifyEngine.full_config, rather than from a value captured at registration.not_loadedmessage added in all 11 languages.quality_scale.yaml:action-setupmarked done. Changelog entry under v2.19.2. The manifest version is unchanged, as the release is being held.notify.supernotifyis unchanged: it's the legacy notify service and still follows the entry.Test plan
not_loadednot_loadedprek run(ruff, mypy, ty, codespell, bandit)🤖 Generated with Claude Code