Skip to content

[PBI] Notification correlation (grouping related events) #439

@cjlapao

Description

@cjlapao

Description

Implement and validate the correlation_id grouping mechanism that allows multiple notifications about the same underlying entity (e.g. an alert when a host goes down and a success when it recovers) to be associated with each other. Includes the REST filter and any query helpers needed to retrieve a correlated group.

User Story

As a user investigating an alert, I want to be able to see all notifications related to the same host or event in one view, so that I can understand the full timeline — when it went wrong, whether it recovered, and what actions were taken.

Acceptance Criteria

  • correlation_id stored correctly: The field is persisted verbatim from the dispatcher request. No server-side lookup or validation is performed on the value.
  • REST filter works: GET /notifications?correlation_id=<value> returns all of the authenticated user's notifications sharing that correlation_id, ordered by created_at ascending (oldest first, to read as a timeline).
  • Index in place: A database index on (user_id, correlation_id) exists to make the filter performant.
  • Nullable correctly handled: Notifications with no correlation_id are not returned when filtering by a specific value. A filter for correlation_id=null is not supported (not a required use case).
  • Dispatcher test: An integration test emits two notifications with the same correlation_id (one alert, one success) and verifies both are retrieved by the correlation filter.
  • Unit tests: Cover correlation_id passthrough, correct ordering in the grouped response, and the index being used in the query plan.

Definition of Done

  • Code implemented following best practices.
  • Unit tests written and passing.
  • Code reviewed and approved.
  • Merged into the main branch.
  • Documentation updated (if applicable).
  • Deployed to staging/production environment.

Assumptions and Constraints

  • Assumption: The caller is responsible for using a meaningful, stable correlation_id — typically the record_id of the root entity (e.g. the host's UUID).
  • Constraint: The system does not enforce or validate relationships between correlated notifications. Correlation is purely a grouping convention.

Dependencies

No response

Additional Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    pbiProduct Backlog ItemtriageSelected for triage

    Type

    Projects

    Status

    📋 Awaiting Triage

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions