Fix notification state after automation condition edits - #32
Merged
Merged
Conversation
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
Editing an existing Notify rule to replace a removed sensor could retain the old sensor's active notification state and suppress the replacement sensor's activation email. Condition edits now receive a persisted notification revision, so the new conditions start inactive and can send a fresh activation. Unchanged saves, renames, and restarts preserve their state.
Superseded queued messages are discarded, and an old in-flight delivery cannot mark the new conditions as delivered. Existing rules retain their legacy state identity until edited. Includes regression coverage, canonical automation documentation, and version v0.26.269.1.
Verification
python3 -m pytest testApparatus/test_notification_rule_edits.py testApparatus/test_email_notifications.py testApparatus/test_automation_contract.py testApparatus/test_sai_switch_controller.py testApparatus/test_compile_python.py -q: 112 passed, 1 skipped.npm run validate:pr: 44 Chromium checks passed using the isolated host fixture.git diff --check: passed.Contributor checklist
Maintainer verification
npm run validate:prpasses on a trusted host when the change can affect rendered UI behavior.Residual risk or unverified areas
No direct hardware, live MQTT broker, or onboarding paths were exercised for this change. SMTP was mocked in automated tests. An email already in flight when conditions change may finish sending, but cannot activate the edited conditions' state. The implementation has not been deployed to Samhain by this agent.