Skip to content

docs: fix README errors and document generic notification handlers (v2.1.2)#49

Merged
hasanxdev merged 1 commit into
mainfrom
copilot/fix-readme-issues
May 8, 2026
Merged

docs: fix README errors and document generic notification handlers (v2.1.2)#49
hasanxdev merged 1 commit into
mainfrom
copilot/fix-readme-issues

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 8, 2026

Several README examples contained incorrect type parameters and a misplaced section heading. Issue #44 also surfaced a missing clarification about IRequest return types when validators/pipelines are involved.

Fixes

  • Stream request definitionIStreamRequest<PingDispatchR, ValueTask<int>>IStreamRequest<CounterStreamRequestDispatchR, int> (element type must not be wrapped in ValueTask; self-reference type was wrong)
  • Stream handler definition — handler type was used as the type argument instead of the request type (CounterStreamHandlerDispatchRCounterStreamRequestDispatchR)
  • Notification section heading — "Stream Pipeline DispatchR" → "Notification DispatchR"

Clarification (Issue #44)

Added an [!IMPORTANT] callout under Request Definition: TResponse must always be a generic wrapper (Task<T> / ValueTask<T>). Using bare Task or ValueTask silently breaks handler dispatch when pipeline behaviors or validators are present.

New: Generic Notification Handlers (v2.1.2)

Added docs and example for the open-generic INotificationHandler<TNotification> pattern released in v2.1.2:

public sealed class AllNotificationsLogger<TNotification>(ILogger<AllNotificationsLogger<TNotification>> logger)
    : INotificationHandler<TNotification>
    where TNotification : INotification
{
    public ValueTask Handle(TNotification notification, CancellationToken cancellationToken)
    {
        logger.LogInformation("[Generic] Received notification of type {NotificationType}: {@Notification}",
            typeof(TNotification).Name, notification);
        return ValueTask.CompletedTask;
    }
}

Updated the "Currently supports" list to include this third notification variant.

…docs (v2.1.2)

Agent-Logs-Url: https://github.com/hasanxdev/DispatchR/sessions/bf9f2dea-964c-4768-b4e7-31ae7fb7ea59

Co-authored-by: hasanxdev <30981174+hasanxdev@users.noreply.github.com>
@hasanxdev hasanxdev marked this pull request as ready for review May 8, 2026 20:11
Copilot AI review requested due to automatic review settings May 8, 2026 20:11
@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@hasanxdev hasanxdev merged commit 1254be0 into main May 8, 2026
4 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Documentation-focused update to correct README examples and describe the new open-generic notification handler pattern introduced in v2.1.2, plus a clarification about request return types in DispatchR.

Changes:

  • Fix incorrect IStreamRequest<,> and stream handler type parameters in README examples.
  • Correct a misplaced notification section heading and add documentation/example for open-generic INotificationHandler<TNotification>.
  • Add an [!IMPORTANT] callout about request TResponse return types when pipelines/validators are involved.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
```

> [!IMPORTANT]
> Always use a **generic** return type such as `Task<TResult>` or `ValueTask<TResult>`. Using a bare `Task` or `ValueTask` (without a type argument) may prevent the handler from being triggered when pipeline behaviors or validators are present.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants