feat: Make notifiers optional in Config model#42
Merged
Conversation
- Remove model validator requiring at least one notifier - Default notifiers to empty list in Config - Add NoopNotifier for when no notifiers are configured - Remove hard requirement in MultiplexNotifier constructor - Default setup finalize to empty notifiers list instead of MQTT
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #42 +/- ##
==========================================
+ Coverage 82.73% 82.88% +0.14%
==========================================
Files 107 107
Lines 9673 9679 +6
==========================================
+ Hits 8003 8022 +19
+ Misses 1670 1657 -13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
Make the
notifiersfield optional in the Config model so that the pipeline can start without any notifier configured.Changes
src/homesec/models/config.py: Remove_validate_notifiersmodel validator that required at least one notifier. Defaultnotifiersto empty list.src/homesec/runtime/worker.py: Add_NoopNotifierclass that silently drops alerts when no notifiers are configured, instead of raisingRuntimeError.src/homesec/notifiers/multiplex.py: Remove empty-list guard inMultiplexNotifier.__init__constructor.src/homesec/services/setup.py: Default finalize config to empty notifiers list instead of injecting a default MQTT notifier.Motivation
The setup wizard doesn't always configure a notifier (e.g., no MQTT broker available in dev/CI environments). Previously this caused a validation error that prevented
config.yamlfrom being written, leaving the app stuck in setup mode. With this change, the pipeline starts normally and logs a message that notifications are disabled.