Skip to content

Fix notification state after automation condition edits - #32

Merged
mot-yelraf merged 1 commit into
trunkfrom
fix-rule-state-post-mod
Sep 26, 2026
Merged

mot-yelraf merged 1 commit into
trunkfrom
fix-rule-state-post-mod

Conversation

@mot-yelraf

@mot-yelraf mot-yelraf commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

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

  • macOS, Python 3.13.9; isolated SQLite databases and fake SMTP senders.
  • 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.
  • User verified the fix before requesting publication and merge.

Contributor checklist

  • This pull request is focused on one logical change.
  • I added or updated tests for behavior changes.
  • I updated the canonical documentation when behavior or configuration changed.
  • I did not commit credentials, private runtime configuration, databases, or logs.
  • I preserved compatibility-sensitive MQTT, settings, switch identity, and persistence behavior, or documented an intentional break.

Maintainer verification

  • Required remote checks pass (Python 3.11/3.13 compilation and full regression suite with coverage).
  • npm run validate:pr passes on a trusted host when the change can affect rendered UI behavior.
  • Hardware-, broker-, onboarding-, and platform-specific behavior not covered remotely is recorded below.

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.

@mot-yelraf
mot-yelraf merged commit accc1de into trunk Sep 26, 2026
3 checks passed
@mot-yelraf
mot-yelraf deleted the fix-rule-state-post-mod branch September 26, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant