Skip to content

Add persistent system notifications with entity table backend#25873

Open
patrickmann wants to merge 5 commits intomasterfrom
feature/persistent-system-notifications
Open

Add persistent system notifications with entity table backend#25873
patrickmann wants to merge 5 commits intomasterfrom
feature/persistent-system-notifications

Conversation

@patrickmann
Copy link
Copy Markdown
Contributor

@patrickmann patrickmann commented May 3, 2026

/nocl new feature
/prd Graylog2/graylog-plugin-enterprise#14135

References #25789
Refer to the spec for design details.

Summary

  • Replace in-memory NotificationImpl/NotificationServiceImpl with MongoDB-backed SystemNotificationDto/SystemNotificationService
  • Add NotificationServiceAdapter to preserve the legacy NotificationService API while delegating to the new service
  • Expand NotificationsResource with paginated list, read/unread toggling, and bulk operations
  • Add SystemNotificationCleanupPeriodical for retention (age-based and count-based)
  • Add migration from old notifications collection to new system_notifications collection

How tested

The new paginated endpoint and history feature require a corresponding entity table UI for testing.
Back-compat of legacy endpoints:

  • trigger a notification, e.g. by not having any inputs running - observe notification
  • resolve the condition - observe that notification disappears
  • repeat, but dismiss the notification manually

Unit tests:

  • SystemNotificationServiceTest -- publish, dedup, mark read/unread, toggle, pagination, retention
  • NotificationServiceAdapterTest -- adapter delegates correctly to new service
  • SystemNotificationCleanupPeriodicalTest -- retention cleanup logic
  • DeletedStreamNotificationListenerTest -- stream deletion resolves notifications
  • SystemNotificationRenderServiceTest -- render service unchanged

patrickmann and others added 5 commits April 30, 2026 16:26
Replace the ephemeral notification system with a persistent model backed
by a new `system_notifications` MongoDB collection. Notifications now
have read/unread state with actor tracking, a paginated entity table API,
configurable retention with a cleanup periodical, and an audit trail.

Key changes:
- New SystemNotificationDto, SystemNotificationService, and
  NotificationServiceAdapter that implements the existing
  NotificationService interface as a facade
- Paginated GET endpoint, toggle-read, bulk toggle, read-all, retention
  config endpoints, and ID-based HTML render endpoint
- SystemNotificationCleanupPeriodical for age-based and safety-cap
  retention
- Migration from old `notifications` collection
- Remove extends Persisted/PersistedService from Notification interfaces
- Delete NotificationImpl and NotificationServiceImpl

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use AutoValue builder instead of private generated constructor for Actor
- Migrate to org.graylog2.database.MongoCollection wrapper
- Wrap MongoUtils.stream() calls in try-with-resources
- Replace unsupported $ne:null with $type:"string" in partial index filter
- Replace removed NotificationService.destroy() with fixed()
- Make RenderResponse a static inner class

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@patrickmann patrickmann marked this pull request as ready for review May 5, 2026 13:38
@patrickmann patrickmann requested a review from a team May 5, 2026 13:40
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