feat: add provider capability declaration system - #773
Merged
Abd-Standard merged 1 commit intoSep 1, 2026
Merged
Conversation
Introduce a capability-aware notification provider abstraction so that providers can declare what features they support and the core pipeline never depends on a concrete provider implementation. Changes: - Add ProviderCapability enum (RICH_FORMATTING, ATTACHMENTS, MESSAGE_UPDATES, THREADING, INTERACTIVE_COMPONENTS, NATIVE_SCHEDULING) and NotificationProvider interface in src/types/provider-capabilities.ts - Implement DiscordNotificationProvider (declares 5 capabilities, delegates HTTP delivery to sendWebhook, degrades unsupported features gracefully) in src/services/providers/discord-provider.ts - Implement WebhookNotificationProvider (declares ATTACHMENTS only, generic JSON POST) in src/services/providers/webhook-provider.ts - Add ProviderRegistry with register/unregister/get/findByCapability/ deliver and module-level singleton helpers in src/services/provider-registry.ts - Update NotificationScheduler to dispatch through the registry first; falls back to legacy direct-Discord path for backward compatibility - Add 35 unit tests covering all acceptance criteria in src/services/providers/provider-capabilities.test.ts
|
@Moh-dakai Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
Introduces a capability-aware notification provider abstraction so providers can declare what features they support, unsupported features are handled gracefully, and the core notification pipeline never depends on a concrete
provider class.
Motivation
The pipeline previously had a hard-coded switch statement in NotificationScheduler.executeNotification that directly instantiated Discord-specific logic and threw not yet implemented errors for every other channel. This made it
impossible to add new providers without modifying the scheduler, and gave callers no way to know whether a feature like rich formatting or file attachments was available before attempting delivery.
Changes
New types — src/types/provider-capabilities.ts
Discord provider — src/services/providers/discord-provider.ts
Webhook provider — src/services/providers/webhook-provider.ts
Provider registry — src/services/provider-registry.ts
Scheduler update — src/services/notification-scheduler.ts
Tests — src/services/providers/provider-capabilities.test.ts
35 tests covering:
Acceptance criteria
┌──────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Criterion │ How it is satisfied │
├──────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Providers can declare supported capabilities │ ProviderMetadata.capabilities: ReadonlySet + hasCapability() │
├──────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Unsupported features are handled gracefully │ deliver() populates DeliveryResult.degradedCapabilities and logs a warning; delivery still succeeds │
├──────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ The core pipeline does not depend on a specific provider │ NotificationScheduler only imports ProviderRegistry and the NotificationProvider interface │
└──────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────┘
Testing
35 tests, 35 passed
Closes #708