feat(notifications): add support for notifications and notification h…#928
Merged
Conversation
bb85e6c to
278a941
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
bdeda6f to
cdc2a04
Compare
ca35c53 to
53274e6
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a first-class notification/event routing mechanism to BEC so core services can emit standardized events (scan lifecycle, alarms, interlocks, plus custom strings) and SciHub can route them to configured messaging backends (SciLog/Signal/Teams) via a persisted notification routing config.
Changes:
- Introduces notification message/config models plus new Redis endpoints for transient notification events and persisted routing configuration.
- Adds
RedisConnector.notify()and emits notifications from scan status updates, alarm raising, and scan interlock actions. - Implements SciHub-side
MessagingManagerto subscribe to notification topics and fan out to messaging services; expands tests across server/lib.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| bec_server/tests/tests_scihub/test_scihub_cli_launch.py | Adds coverage that SciHub starts/stops the messaging manager. |
| bec_server/tests/tests_scan_server/test_scan_interlock.py | Verifies scan interlock notifications are emitted (and skipped appropriately). |
| bec_server/tests/tests_scan_server/test_generator_scan_worker.py | Asserts generator worker emits new-scan / scan-completed notifications. |
| bec_server/tests/tests_scan_server/scans_v4/test_scan_actions.py | Tests CLI rendering helper and scan-status notification emission in v4 scan actions. |
| bec_server/bec_server/scihub/scihub.py | Starts a MessagingManager and shuts it down during SciHub shutdown. |
| bec_server/bec_server/scan_server/scans/scan_actions.py | Emits notifications on scan open/close and renders CLI call string for user-facing text. |
| bec_server/bec_server/scan_server/generator_scan_worker.py | Emits notifications on scan open/close and renders CLI call string. |
| bec_server/bec_server/actors/scan_interlock.py | Emits notifications when interlock triggers/clears. |
| bec_lib/tests/test_redis_connector.py | Updates alarm tests to expect notification emission. |
| bec_lib/tests/test_messaging_service.py | Adds tests for notification conversion and auto-notification config persistence/merging. |
| bec_lib/tests/test_messaging_hooks.py | Adds tests for notification endpoints and routing behavior. |
| bec_lib/tests/test_core_utils.py | Adds tests for CLI value rendering helper. |
| bec_lib/tests/test_bec_messages.py | Adds serialization tests for notification messages/config. |
| bec_lib/pyproject.toml | Adds BeautifulSoup dependency for HTML stripping in some backends. |
| bec_lib/bec_lib/utils/scan_utils.py | Adds scan-info → CLI-call composition helpers. |
| bec_lib/bec_lib/tests/utils.py | Extends ConnectorMock with notify() helper used by tests. |
| bec_lib/bec_lib/redis_connector.py | Adds notify() and emits notifications when alarms are raised. |
| bec_lib/bec_lib/messaging_services.py | Adds auto-notification configuration tracking and introduces NotificationMessageObject. |
| bec_lib/bec_lib/messaging_hooks.py | Implements MessagingEvent enum + MessagingManager for routing notifications to services. |
| bec_lib/bec_lib/messages.py | Adds Notification* message models (but also introduces a problematic import; see comments). |
| bec_lib/bec_lib/endpoints.py | Adds endpoints for notification events and routing config. |
| .github/workflows/ci.yml | Updates Codecov action version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
12d3241 to
8e31b60
Compare
8e31b60 to
2c67b7d
Compare
cappel89
previously approved these changes
Jun 16, 2026
2c67b7d to
f8a2928
Compare
cappel89
approved these changes
Jun 16, 2026
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.
Description
This PR adds the ability to create notification automatically when certain evens occur in BEC. There are a few event types predefined:
In addition, beamlines can simply publish new events with custom event strings and subscribe to those as well.
For more information, please take a look at the PR in bec docs: bec-project/bec_docs#77