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
feat(notification): prepare Channel storage for rolling upgrades - #5484
Prepare notification Channel storage for Phase 1 of the V4 migration. This is the first PR in the Channel → Rule → Event stack.
Why
Old and new backends share a database during a rolling deployment. Both must be able to read and update Channels throughout the rollout and after an application rollback.
How
Read both Channel type spellings and both webhook configuration shapes. Keep writes in the legacy uppercase, enveloped format and preserve the existing V1 and V3 API representations.
Add nullable event-type filters and provider data, plus inactive reconciliation fields. Existing Rule assignments still determine routing.
Exercise storage compatibility, filter semantics and migration defaults against PostgreSQL.
Summary by CodeRabbit
New Features
Webhook channel types now use consistent casing across the service and API, while existing stored formats remain supported.
Notification channels now track reconciliation status and scheduling details.
Bug Fixes
Invalid channel types and configurations are rejected with errors instead of being silently accepted.
Channel filters now support matching both current and legacy webhook type formats.
Documentation
Added guidance on channel storage compatibility and future routing and reconciliation considerations.
Confidence Score: 5/5
The PR appears safe to merge; no blocking issues remain.
Summary
Prepares Channel storage for rolling upgrades while keeping legacy writes and the existing V1 and V3 API formats.
Channel reads accept both stored formats while writes keep the legacy shape.
Channel rows gain inactive fields for future routing and reconciliation.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
V1["V1 API: WEBHOOK"] --> Domain["Domain: webhook"]
V3["V3 API: webhook"] --> Domain
Domain --> Write["Write legacy type and config envelope"]
Write --> DB[(Channel storage)]
DB --> Read["Read either type spelling and config shape"]
Read --> Domain
Reviewing files that changed from the base of the PR and between b0bbadf and b0bbadf.
Files ignored due to path filters: 10
openmeter/ent/db/migrate/schema.go is excluded by !**/ent/db/**
openmeter/ent/db/mutation.go is excluded by !**/ent/db/**
openmeter/ent/db/notificationchannel.go is excluded by !**/ent/db/**
openmeter/ent/db/notificationchannel/notificationchannel.go is excluded by !**/ent/db/**
openmeter/ent/db/notificationchannel/where.go is excluded by !**/ent/db/**
openmeter/ent/db/notificationchannel_create.go is excluded by !**/ent/db/**
openmeter/ent/db/notificationchannel_update.go is excluded by !**/ent/db/**
openmeter/ent/db/runtime.go is excluded by !**/ent/db/**
openmeter/ent/db/setorclear.go is excluded by !**/ent/db/**
tools/migrate/migrations/atlas.sum is excluded by !**/*.sum, !**/*.sum
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
The PR changes webhook channel type handling across API and storage boundaries, adds channel metadata and reconciliation fields, and supports legacy-envelope and flat webhook configuration reads. Mapping errors now propagate through channel, rule, and event reads.
Changes: Notification channel compatibility
Layer / File(s)
Summary
Channel type contracts and API boundaries openmeter/notification/channel.go, openmeter/notification/httpdriver/*, openmeter/notification/service/channel_test.go, api/v3/handlers/notification/channels/*
The domain webhook type is now lowercase. HTTP request mapping validates API channel types and response mapping converts them explicitly. V3 handler comments and tests use lowercase domain values.
The schema and migration add event filter, provider data, generation, and reconciliation fields. The adapter maps canonical webhook filters to both stored spellings and writes webhook configs in the legacy envelope format. Tests cover field preservation and migration defaults. Documentation records type/config formats and reconciliation follow-ups.
Configuration decoding and read error propagation openmeter/notification/adapter/channel.go, openmeter/notification/adapter/entitymapping.go, openmeter/notification/adapter/rule.go, openmeter/notification/adapter/{event,rule}_test.go
The adapter accepts legacy-envelope and flat webhook configs. Channel, rule, and event mappings return configuration errors to their callers. Tests cover valid flat configs and malformed stored configs across read paths.
openmeterio/openmeter#5351: Defines Notification V4 channel provider contracts and provider data, which relates to the fields this PR adds to channel storage.
openmeterio/openmeter#5401: Refactors V4 provider contracts and defines provider data as map[string]string, related to this PR’s provider_data storage field.
openmeterio/openmeter#5352: Implements the V4 Svix provider, which uses channel event-type routing and provider data.
This change prepares Channel storage for rolling upgrades while keeping the legacy write formats and existing API representations. I found no concrete merge-blocking risk in the supplied change.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly summarizes the main change: preparing notification Channel storage for rolling upgrades.
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.
Finishing Touches
Generate docstrings
Commit to this branch
Create a new PR
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; 7 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
kind/refactorCode refactor, cleanup or minor improvement
2 participants
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.
What
Prepare notification Channel storage for Phase 1 of the V4 migration. This is the first PR in the Channel → Rule → Event stack.
Why
Old and new backends share a database during a rolling deployment. Both must be able to read and update Channels throughout the rollout and after an application rollback.
How
Summary by CodeRabbit


Confidence Score: 5/5
The PR appears safe to merge; no blocking issues remain.Summary
Prepares Channel storage for rolling upgrades while keeping legacy writes and the existing V1 and V3 API formats.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR V1["V1 API: WEBHOOK"] --> Domain["Domain: webhook"] V3["V3 API: webhook"] --> Domain Domain --> Write["Write legacy type and config envelope"] Write --> DB[(Channel storage)] DB --> Read["Read either type spelling and config shape"] Read --> DomainReviews (3) · Last reviewed commit: "docs(notification): remove TODO from cha..." · Reviewed by Greptile