Skip to content

feat: add service activator pattern support#300

Merged
JerrettDavis merged 1 commit into
mainfrom
feat/service-activator-pattern
May 22, 2026
Merged

feat: add service activator pattern support#300
JerrettDavis merged 1 commit into
mainfrom
feat/service-activator-pattern

Conversation

@JerrettDavis
Copy link
Copy Markdown
Owner

Closes #294.\n\nAdds the Service Activator enterprise integration pattern with fluent runtime support, source generator attributes and factory generation, TinyBDD coverage, production-shaped DI example, and catalog/docs entries.

Copilot AI review requested due to automatic review settings May 22, 2026 03:27
@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

@github-actions
Copy link
Copy Markdown
Contributor

Test Results

  1 files    1 suites   2m 39s ⏱️
914 tests 914 ✅ 0 💤 0 ❌
919 runs  919 ✅ 0 💤 0 ❌

Results for commit 60d13af.

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 the Service Activator enterprise integration pattern across the PatternKit stack: a new runtime fluent API (PatternKit.Core), Roslyn source generator + attributes (PatternKit.Generators*), DI-importable production-shaped inventory example (PatternKit.Examples), and accompanying tests/docs/catalog entries.

Changes:

  • Introduces ServiceActivator<TRequest, TResponse> runtime API with a fluent builder and activation result type.
  • Adds [GenerateServiceActivator] / [ServiceActivatorHandler] attributes plus ServiceActivatorGenerator (with diagnostics + generator tests).
  • Adds inventory service-activator example, DI registration via AddPatternKitExamples(), and updates pattern/example catalogs + docs TOCs.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/PatternKit.Tests/Messaging/Activation/ServiceActivatorTests.cs Adds runtime unit coverage for fluent service activator activation and validation.
test/PatternKit.Generators.Tests/ServiceActivatorGeneratorTests.cs Verifies factory generation output and generator diagnostics for service activators.
test/PatternKit.Generators.Tests/AbstractionsAttributeCoverageTests.cs Extends attribute-coverage suite to include the new generator attributes + defaults/guards.
test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitPatternCatalogTests.cs Updates production-readiness expectations to include the new pattern and counts.
test/PatternKit.Examples.Tests/Messaging/InventoryServiceActivatorExampleTests.cs Adds end-to-end example verification for fluent, generated, and DI-imported service activator usage.
src/PatternKit.Generators/Messaging/ServiceActivatorGenerator.cs Implements the incremental generator that emits ServiceActivator<,> factories and diagnostics.
src/PatternKit.Generators/AnalyzerReleases.Unshipped.md Registers new generator diagnostic IDs (PKSVA001–003).
src/PatternKit.Generators.Abstractions/Messaging/ServiceActivatorAttributes.cs Adds new public generator attributes for service-activator factory generation and handler marking.
src/PatternKit.Examples/ProductionReadiness/PatternKitPatternCatalog.cs Registers the Service Activator pattern entry with docs/source/tests/example pointers.
src/PatternKit.Examples/ProductionReadiness/PatternKitExampleCatalog.cs Adds a new example descriptor for “Inventory Service Activator”.
src/PatternKit.Examples/Messaging/InventoryServiceActivatorExample.cs Adds a production-shaped inventory reservation example with fluent + source-generated activator paths and IServiceCollection import.
src/PatternKit.Examples/DependencyInjection/PatternKitExampleServiceCollectionExtensions.cs Wires the new example into AddPatternKitExamples() and adds an example service descriptor/registration.
src/PatternKit.Core/Messaging/Activation/ServiceActivator.cs Introduces the core runtime Service Activator API and its result type.
docs/patterns/toc.yml Adds Service Activator to the patterns navigation TOC.
docs/patterns/messaging/service-activator.md Adds the Service Activator pattern documentation page.
docs/patterns/messaging/README.md Adds an overview entry/link for Service Activator within messaging patterns.
docs/guides/pattern-coverage.md Adds Service Activator to the coverage matrix (runtime + generator).
docs/generators/toc.yml Adds Service Activator generator docs to the generators TOC.
docs/generators/service-activator.md Adds generator usage docs and lists diagnostics.
docs/generators/index.md Adds Service Activator to the generator index table.
docs/examples/toc.yml Adds the Inventory Service Activator example to the examples TOC.
docs/examples/inventory-service-activator.md Adds the example documentation page for inventory service activation.
docs/examples/index.md Adds the new inventory service activator example to the examples index list.

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

Comment on lines +59 to +66
public sealed class ServiceActivatorResult<TRequest, TResponse>
{
public ServiceActivatorResult(
string activatorName,
Message<TRequest> request,
Message<TResponse> response)
=> (ActivatorName, Request, Response) = (activatorName, request, response);

.Handle((message, context) => Message<InventoryReservationResult>.Create(result))
.Build();

var response = activator.Activate(Message<InventoryReservationRequest>.Create(request));
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

❌ Patch coverage is 96.71053% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.04%. Comparing base (b07f89d) to head (60d13af).

Files with missing lines Patch % Lines
...nKit.Core/Messaging/Activation/ServiceActivator.cs 93.33% 2 Missing ⚠️
...ples/Messaging/InventoryServiceActivatorExample.cs 90.47% 2 Missing ⚠️
....Generators/Messaging/ServiceActivatorGenerator.cs 98.46% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #300      +/-   ##
==========================================
+ Coverage   90.36%   96.04%   +5.68%     
==========================================
  Files         420      424       +4     
  Lines       35581    35733     +152     
  Branches     5039     5064      +25     
==========================================
+ Hits        32151    34321    +2170     
+ Misses       1514     1412     -102     
+ Partials     1916        0    -1916     
Flag Coverage Δ
unittests 96.04% <96.71%> (+5.68%) ⬆️

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.

@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.

@github-actions
Copy link
Copy Markdown
Contributor

Code Coverage

Summary
  Generated on: 05/22/2026 - 03:32:19
  Coverage date: 05/22/2026 - 03:30:37 - 05/22/2026 - 03:32:08
  Parser: MultiReport (9x Cobertura)
  Assemblies: 4
  Classes: 1226
  Files: 517
  Line coverage: 94.9%
  Covered lines: 35273
  Uncovered lines: 1885
  Coverable lines: 37158
  Total lines: 82334
  Branch coverage: 76.5% (10300 of 13454)
  Covered branches: 10300
  Total branches: 13454
  Method coverage: 96.3% (6786 of 7043)
  Full method coverage: 88.5% (6238 of 7043)
  Covered methods: 6786
  Fully covered methods: 6238
  Total methods: 7043

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%

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Service Activator enterprise integration pattern

2 participants