feat(messaging): ADR-0030 P2 — subscription + preference#1444
Merged
Conversation
Adds the Layer-3 preference filter so users can mute notification topics/ channels, with admin-global defaults and mandatory-topic bypass. - sys_notification_preference: per (user_id, topic, channel) toggle; user_id='*' = admin-global default, a real-user row overrides it; topic/channel support '*' wildcards; unique (user_id, topic, channel). digest/quiet_hours fields for P3. - sys_notification_subscription: standing subscription of a principal to a topic (object + schema now; subscription-driven fan-out is a follow-up). - PreferenceResolver wired into emit() between recipient resolution and fan-out/enqueue. Most-specific-wins (user→*, topic→*, channel→*; default ON). Mandatory topics bypass (configurable, exact or prefix.); fail-open on no data / lookup error so a preference outage never silently drops notifications. emit() now filters the (recipient × channel) matrix per user. - Both objects registered by the plugin and contributed to the Setup app Configuration nav slot (ADR-0029 D7). Tests: service-messaging 66 passing — adds preference-resolver.test.ts (resolution matrix) + an emit-level mute/mandatory-bypass test. https://claude.ai/code/session_015pRGvrm3zrk5m8YvZhkAmF
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Jun 1, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Implements ADR-0030 P2 — Subscription + preference, continuing from the merged P0 (#1434) and P1 (#1441). Adds the Layer-3 preference filter so users can mute notification topics/channels, with admin-global defaults and mandatory-topic bypass.
What changed
Objects
sys_notification_preference— per(user_id, topic, channel)toggle (enabled, plusdigest/quiet_hoursfor P3).user_id='*'rows are the admin-global default; a real-user row overrides it;topic/channelsupport*wildcards. Unique(user_id, topic, channel).sys_notification_subscription— standing subscription of a principal (role:/team:/user:/id) to a topic. Object + schema land now; subscription-driven fan-out (expand a topic's subscribers when a producer emits without explicit audience) is a documented follow-up.PreferenceResolver (wired into
emit())Inserted between recipient resolution (P1) and fan-out/enqueue:
user → *,topic → *,channel → *, default ON. A user's row beats the global*default.MessagingServicePlugin({ mandatoryTopics }), exact match orprefix.(e.g.security.). Users can't mute these.emit()now filters the(recipient × channel)matrix per user (different recipients can accept different channels);fanOut/enqueueDeliveriesiterate per-recipient targets.Wiring
Both objects are registered by
MessagingServicePluginand contributed to the Setup app's Configuration nav slot (ADR-0029 D7), so they appear in REST/Studio only when messaging is installed.Acceptance (per build spec)
Testing
service-messaging: 66 passing — adds
preference-resolver.test.ts(resolution matrix: defaults, single-channel mute, topic mute, global-default + user override, specificity, wildcard topic, mandatory exact/prefix bypass, fail-open, org scoping) + an emit-level mute/mandatory-bypass integration test. service-automation 105 ✓, platform-objects 78 ✓.Follow-ups
digest/quiet_hoursbatching middleware → P3.sys_notification_template.🤖 Generated with Claude Code
Generated by Claude Code