Skip to content

feat: add messaging gateway pattern support#299

Merged
JerrettDavis merged 1 commit into
mainfrom
feat/messaging-gateway-pattern
May 22, 2026
Merged

feat: add messaging gateway pattern support#299
JerrettDavis merged 1 commit into
mainfrom
feat/messaging-gateway-pattern

Conversation

@JerrettDavis
Copy link
Copy Markdown
Owner

Closes #293.

Summary

  • Adds MessagingGateway runtime support for typed request/response facades over message channels.
  • Adds [GenerateMessagingGateway] and [MessagingGatewayHandler] source generator support with diagnostics.
  • Adds a DI-ready payment authorization gateway example, docs, catalog entries, and TinyBDD coverage.

Validation

  • dotnet build src\PatternKit.Core\PatternKit.Core.csproj -f netstandard2.0 /p:UseSharedCompilation=false
  • dotnet build src\PatternKit.Core\PatternKit.Core.csproj -f net8.0 /p:UseSharedCompilation=false
  • dotnet build src\PatternKit.Core\PatternKit.Core.csproj -f net10.0 /p:UseSharedCompilation=false
  • dotnet build src\PatternKit.Generators\PatternKit.Generators.csproj /p:UseSharedCompilation=false
  • dotnet test test\PatternKit.Tests\PatternKit.Tests.csproj -f net8.0 --no-restore --filter "FullyQualifiedName~MessagingGatewayTests" /p:BuildProjectReferences=false /p:UseSharedCompilation=false
  • dotnet test test\PatternKit.Tests\PatternKit.Tests.csproj -f net10.0 --no-restore --filter "FullyQualifiedName~MessagingGatewayTests" /p:BuildProjectReferences=false /p:UseSharedCompilation=false
  • dotnet test test\PatternKit.Generators.Tests\PatternKit.Generators.Tests.csproj -f net8.0 --no-restore --filter "FullyQualifiedNameMessagingGatewayGeneratorTests|FullyQualifiedNameAbstractionsAttributeCoverageTests" /p:BuildProjectReferences=false /p:UseSharedCompilation=false
  • dotnet test test\PatternKit.Generators.Tests\PatternKit.Generators.Tests.csproj -f net10.0 --no-restore --filter "FullyQualifiedNameMessagingGatewayGeneratorTests|FullyQualifiedNameAbstractionsAttributeCoverageTests" /p:BuildProjectReferences=false /p:UseSharedCompilation=false
  • git diff --check

Local examples build remains blocked by the existing analyzer/compiler mismatch (CS9057) and generated demo types; hosted CI remains authoritative for examples/docs.

Copilot AI review requested due to automatic review settings May 22, 2026 03:06
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copy link
Copy Markdown
Contributor

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

Adds first-class Messaging Gateway support to PatternKit’s messaging slice: a runtime typed request/response facade over MessageChannel<T>, plus a Roslyn generator + attributes to generate DI-friendly gateway factories. It also expands the example + documentation catalogs and adds TinyBDD coverage across runtime, generator, and examples.

Changes:

  • Introduces MessagingGateway<TRequest, TResponse> runtime API and result model in PatternKit.Core.
  • Adds [GenerateMessagingGateway] / [MessagingGatewayHandler] abstractions + MessagingGatewayGenerator with diagnostics PKGWY001-003.
  • Adds payment authorization gateway example (fluent + generated), DI import paths, catalog entries, docs, and tests.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/PatternKit.Tests/Messaging/Gateways/MessagingGatewayTests.cs Adds runtime gateway behavior tests (success, rejection, builder validation).
test/PatternKit.Generators.Tests/MessagingGatewayGeneratorTests.cs Adds generator tests for source output + diagnostics.
test/PatternKit.Generators.Tests/AbstractionsAttributeCoverageTests.cs Extends attribute coverage tests for new gateway attributes.
test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitPatternCatalogTests.cs Updates expected catalog pattern set/count for new Messaging Gateway entry.
test/PatternKit.Examples.Tests/Messaging/PaymentMessagingGatewayExampleTests.cs Adds example validation (fluent vs generated + DI imports).
src/PatternKit.Generators/Messaging/MessagingGatewayGenerator.cs Implements the incremental source generator and diagnostics for gateways.
src/PatternKit.Generators/AnalyzerReleases.Unshipped.md Documents new analyzer diagnostic IDs PKGWY001-003.
src/PatternKit.Generators.Abstractions/Messaging/MessagingGatewayAttributes.cs Adds generator attribute definitions for gateway generation.
src/PatternKit.Examples/ProductionReadiness/PatternKitPatternCatalog.cs Registers Messaging Gateway in the pattern catalog with related assets.
src/PatternKit.Examples/ProductionReadiness/PatternKitExampleCatalog.cs Registers “Payment Messaging Gateway” example descriptor.
src/PatternKit.Examples/Messaging/PaymentMessagingGatewayExample.cs Adds payment authorization gateway demo (fluent + generated + DI).
src/PatternKit.Examples/DependencyInjection/PatternKitExampleServiceCollectionExtensions.cs Wires the new example into AddPatternKitExamples() and adds an example service record.
src/PatternKit.Core/Messaging/Gateways/MessagingGateway.cs Adds the runtime gateway + result types.
docs/patterns/toc.yml Adds Messaging Gateway to patterns TOC.
docs/patterns/messaging/README.md Adds Messaging Gateway section and link.
docs/patterns/messaging/messaging-gateway.md Adds new Messaging Gateway pattern documentation page.
docs/guides/pattern-coverage.md Adds Messaging Gateway to the pattern coverage matrix.
docs/generators/toc.yml Adds Messaging Gateway generator docs to TOC.
docs/generators/messaging-gateway.md Adds generator usage + diagnostics documentation.
docs/generators/index.md Adds Messaging Gateway to generator index table.
docs/examples/toc.yml Adds Payment Messaging Gateway example to examples TOC.
docs/examples/payment-messaging-gateway.md Adds new example documentation page.
docs/examples/index.md Adds Payment Messaging Gateway to examples index list.

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


public MessagingGatewayResult<TRequest, TResponse> Invoke(TRequest request, MessageContext? context = null)
{
var requestMessage = Message<TRequest>.Create(request);
@github-actions
Copy link
Copy Markdown
Contributor

Test Results

  1 files    1 suites   2m 13s ⏱️
908 tests 908 ✅ 0 💤 0 ❌
913 runs  913 ✅ 0 💤 0 ❌

Results for commit 9d21033.

@github-actions
Copy link
Copy Markdown
Contributor

Code Coverage

Summary
  Generated on: 05/22/2026 - 03:11:20
  Coverage date: 05/22/2026 - 03:09:44 - 05/22/2026 - 03:11:11
  Parser: MultiReport (9x Cobertura)
  Assemblies: 4
  Classes: 1213
  Files: 512
  Line coverage: 94.9%
  Covered lines: 35122
  Uncovered lines: 1881
  Coverable lines: 37003
  Total lines: 82015
  Branch coverage: 76.5% (10253 of 13394)
  Covered branches: 10253
  Total branches: 13394
  Method coverage: 96.3% (6748 of 7002)
  Full method coverage: 88.5% (6201 of 7002)
  Covered methods: 6748
  Fully covered methods: 6201
  Total methods: 7002

PatternKit.Core                                                                                                    96.1%
  PatternKit.Application.AntiCorruption.AntiCorruptionLayer<T1, T2>                                                90.4%
  PatternKit.Application.AntiCorruption.AntiCorruptionResult<T>                                                     100%
  PatternKit.Application.AuditLog.AuditLogAppendResult<T>                                                          85.7%
  PatternKit.Application.AuditLog.InMemoryAuditLog<T1, T2>                                                         95.4%
  PatternKit.Application.DataMapping.DataMapper<T1, T2>                                                            94.6%
  PatternKit.Application.DataMapping.DataMapperError                                                                 90%
  PatternKit.Application.DataMapping.DataMapperResult<T>                                                           84.6%
  PatternKit.Application.DomainEvents.DomainEventDispatcher<T>                                                     95.4%
  PatternKit.Application.DomainEvents.DomainEventDispatchResult                                                     100%
  PatternKit.Application.EventSourcing.EventStoreAppendResult                                                       100%
  PatternKit.Application.EventSourcing.InMemoryEventStore<T1, T2>                                                  97.9%
  PatternKit.Application.EventSourcing.StoredEvent<T1, T2>                                                           80%
  PatternKit.Application.FeatureToggles.FeatureToggleDecision                                                      87.5%
  PatternKit.Application.FeatureToggles.FeatureToggleRule<T>                                                        100%
  PatternKit.Application.FeatureToggles.FeatureToggleSet<T>                                                        96.9%
  PatternKit.Application.IdentityMap.IdentityMap<T1, T2>                                                            100%
  PatternKit.Application.IdentityMap.IdentityMapResult<T>                                                          92.8%
  PatternKit.Application.MaterializedViews.MaterializedView<T1, T2>                                                98.4%
  PatternKit.Application.Repository.InMemoryRepository<T1, T2>                                                     92.8%
  PatternKit.Application.Repository.RepositoryResult<T>                                                            93.3%
  PatternKit.Application.ServiceLayer.ServiceLayerOperation<T1, T2>                                                96.7%
  PatternKit.Application.ServiceLayer.ServiceLayerResult<T>                                                        94.7%
  PatternKit.Application.ServiceLayer.ServiceLayerRule<T>                                                           100%
  PatternKit.Application.Specification.Specification<T>                                                             100%
  PatternKit.Application.Specification.SpecificationRegistry<T>                                                    93.3%
  PatternKit.Application.TableDataGateway.InMemoryTableDataGateway<T1, T2>                                           86%
  PatternKit.Application.TableDataGateway.TableGatewayResult<T>                                                    82.3%
  PatternKit.Application.TransactionScript.TransactionScript<T1, T2>                                                 97%
  PatternKit.Application.TransactionScript.TransactionScriptError                                                    90%
  PatternKit.Application.TransactionScript.TransactionScriptResult<T>                                               100%
  PatternKit.Application.UnitOfWork.UnitOfWork                                                                     90.9%
  PatternKit.Application.UnitOfWork.UnitOfWorkResult                                                               94.7%
  PatternKit.Application.UnitOfWork.UnitOfWorkRollbackResult                                                        100%
  PatternKit.Application.UnitOfWork.UnitOfWorkStep                                                                  100%
  PatternKit.Behavioral.Chain.ActionChain<T>                                                                        100%
  PatternKit.Behavioral.Chain.AsyncActionChain<T>                                                                   100%
  PatternKit.Behavioral.Chain.AsyncResultChain<T1, T2>                                                             97.7%
  PatternKit.Behavioral.Chain.ResultChain<T1, T2>                                                                   100%

@github-actions
Copy link
Copy Markdown
Contributor

🔍 PR Validation Results

Version: ``

✅ Validation Steps

  • Build solution
  • Run tests
  • Build documentation
  • Dry-run NuGet packaging

📊 Artifacts

Dry-run artifacts have been uploaded and will be available for 7 days.


This comment was automatically generated by the PR validation workflow.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

❌ Patch coverage is 96.55172% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.04%. Comparing base (9f92751) to head (9d21033).

Files with missing lines Patch % Lines
...ernKit.Core/Messaging/Gateways/MessagingGateway.cs 92.50% 3 Missing ⚠️
...amples/Messaging/PaymentMessagingGatewayExample.cs 93.10% 2 Missing ⚠️
....Generators/Messaging/MessagingGatewayGenerator.cs 98.55% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #299      +/-   ##
==========================================
+ Coverage   90.34%   96.04%   +5.70%     
==========================================
  Files         416      420       +4     
  Lines       35407    35581     +174     
  Branches     5010     5039      +29     
==========================================
+ Hits        31987    34174    +2187     
+ Misses       1515     1407     -108     
+ Partials     1905        0    -1905     
Flag Coverage Δ
unittests 96.04% <96.55%> (+5.70%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JerrettDavis JerrettDavis merged commit b07f89d into main May 22, 2026
13 checks passed
@JerrettDavis JerrettDavis deleted the feat/messaging-gateway-pattern branch May 22, 2026 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Messaging Gateway enterprise integration pattern

2 participants