You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(notification): make event delivery status loading opt-in - #5532
Event reads eagerly loaded delivery statuses and their attempt histories even when the caller only needed the Event. The entitlement balance and reset workers paid for that extra query on every matching lookup.
Make delivery status loading opt-in on ListEvents and GetEvent. Both workers keep their existing ListEvents filters and pagination. The V1 and V3 HTTP handlers, reconciler, and resend path explicitly request delivery statuses.
Notes for reviewer
An omitted or empty EventExpand skips loading delivery statuses. Filtering by delivery state still works independently of expansion.
Tests cover both workers’ lookup inputs and all three expansion cases for get and list. The eight affected packages passed with -race, including PostgreSQL-backed tests. Scoped lint reported zero issues.
Summary by CodeRabbit
New Features
Event retrieval and listing now support optionally including delivery-status details.
Bug Fixes
Notification event views and processing paths now request delivery-status details when needed, while pending-status filtering continues to work without expanding those details.
Confidence Score: 5/5
The PR appears safe to merge; current callers retain the delivery data they need.
Summary
Makes delivery-status loading opt-in for ListEvents and GetEvent.
Event reads load delivery details only when callers ask.
No actionable issues found. Tests were not run during this review.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[ListEvents or GetEvent] --> B[Load event, rule, and active channels]
B --> C{Expand.DeliveryStatus?}
C -->|Yes| D[Load delivery statuses and attempts]
C -->|No| E[Skip delivery statuses]
D --> F[Return event]
E --> F
No actionable comments were generated in the recent review.
Walkthrough
Event reads now support optional delivery-status expansion. The adapter loads delivery statuses only when requested, and callers that use them request the expansion. The changes also add tests for threshold-handler event queries.
Changes: Event delivery-status expansion
Layer / File(s)
Summary
Expansion contract and adapter query openmeter/notification/event.go, openmeter/notification/adapter/event.go, openmeter/notification/adapter/*_test.go
List and get inputs add an expansion option. The adapter conditionally loads delivery statuses, and tests cover requested and omitted expansion.
Expansion requests at event callers api/v3/handlers/notification/events/*, openmeter/notification/eventhandler/*, openmeter/notification/httpdriver/event.go, openmeter/notification/service/event.go
The API handlers, HTTP driver, reconciliation, and resend lookup request expanded delivery statuses. The webhook test also fetches the event with expansion enabled.
This change makes delivery-status loading opt-in for event reads, and the callers that need the data now request it. No concrete defect was found, so the change looks safe to merge.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title names the main change: delivery status loading in notification event queries becomes opt-in through an expansion option. The raw summary confirms this in ListEvents, GetEvent, and the adapte…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: delivery status loading in notification event queries becomes opt-in through an expansion option. The raw summary confirms this in ListEvents, GetEvent, and the adapter query helper. The perf() prefix is a conventional commit type and fits the performance intent in the objectives. The title is concise and specific.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
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
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.
Overview
Event reads eagerly loaded delivery statuses and their attempt histories even when the caller only needed the Event. The entitlement balance and reset workers paid for that extra query on every matching lookup.
Make delivery status loading opt-in on
ListEventsandGetEvent. Both workers keep their existingListEventsfilters and pagination. The V1 and V3 HTTP handlers, reconciler, and resend path explicitly request delivery statuses.Notes for reviewer
EventExpandskips loading delivery statuses. Filtering by delivery state still works independently of expansion.TotalCount. This change can ship independently of the delivery status index in perf(notification): index delivery status lookups by event ID #5510.-race, including PostgreSQL-backed tests. Scoped lint reported zero issues.Summary by CodeRabbit


Confidence Score: 5/5
The PR appears safe to merge; current callers retain the delivery data they need.Summary
Makes delivery-status loading opt-in for
ListEventsandGetEvent.No actionable issues found. Tests were not run during this review.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[ListEvents or GetEvent] --> B[Load event, rule, and active channels] B --> C{Expand.DeliveryStatus?} C -->|Yes| D[Load delivery statuses and attempts] C -->|No| E[Skip delivery statuses] D --> F[Return event] E --> FReviews (1) · Last reviewed commit: "perf(notification): make event delivery ..." · Reviewed by Greptile