Skip to content

feat(notifications): add support for notifications and notification h…#928

Merged
wakonig merged 2 commits into
mainfrom
feature/notifications
Jun 16, 2026
Merged

feat(notifications): add support for notifications and notification h…#928
wakonig merged 2 commits into
mainfrom
feature/notifications

Conversation

@wakonig

@wakonig wakonig commented Jun 1, 2026

Copy link
Copy Markdown
Member

Description

This PR adds the ability to create notification automatically when certain evens occur in BEC. There are a few event types predefined:

  • new_scan
  • scan_completed
  • alarm_warning
  • alarm_minor
  • alarm_major
  • scan_interlock

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

@wakonig wakonig force-pushed the feature/notifications branch 3 times, most recently from bb85e6c to 278a941 Compare June 5, 2026 08:30
@codecov

codecov Bot commented Jun 5, 2026

Copy link
Copy Markdown

@wakonig wakonig force-pushed the feature/notifications branch 5 times, most recently from bdeda6f to cdc2a04 Compare June 9, 2026 06:58
@wakonig wakonig force-pushed the feature/notifications branch from ca35c53 to 53274e6 Compare June 10, 2026 08:13
@wakonig wakonig self-assigned this Jun 10, 2026
@wakonig wakonig marked this pull request as ready for review June 10, 2026 08:14
Copilot AI review requested due to automatic review settings June 10, 2026 08:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 MessagingManager to 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.

Comment thread bec_lib/bec_lib/messages.py Outdated
Comment thread bec_lib/bec_lib/redis_connector.py
Comment thread bec_lib/tests/test_bec_messages.py
Comment thread bec_lib/tests/test_messaging_hooks.py Outdated
Comment thread bec_lib/tests/test_messaging_hooks.py
Comment thread bec_lib/tests/test_messaging_hooks.py Outdated
Comment thread bec_lib/tests/test_messaging_hooks.py Outdated
Comment thread bec_lib/tests/test_messaging_hooks.py Outdated
Comment thread bec_lib/bec_lib/messaging_services.py
Comment thread bec_server/bec_server/scihub/scihub.py
@wakonig wakonig force-pushed the feature/notifications branch 5 times, most recently from 12d3241 to 8e31b60 Compare June 11, 2026 08:42
@wakonig wakonig requested a review from a team June 11, 2026 08:42
@wakonig wakonig force-pushed the feature/notifications branch from 8e31b60 to 2c67b7d Compare June 15, 2026 20:04
cappel89
cappel89 previously approved these changes Jun 16, 2026
@wakonig wakonig force-pushed the feature/notifications branch from 2c67b7d to f8a2928 Compare June 16, 2026 11:25
@wakonig wakonig requested a review from cappel89 June 16, 2026 11:41
@wakonig wakonig enabled auto-merge (rebase) June 16, 2026 11:41
@wakonig wakonig merged commit aee891f into main Jun 16, 2026
37 checks passed
@wakonig wakonig deleted the feature/notifications branch June 16, 2026 14:20
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.

3 participants