Skip to content

feat: add domain service pattern slice#409

Merged
JerrettDavis merged 2 commits into
mainfrom
feat/domain-modeling-domain-service
May 28, 2026
Merged

feat: add domain service pattern slice#409
JerrettDavis merged 2 commits into
mainfrom
feat/domain-modeling-domain-service

Conversation

@JerrettDavis

Copy link
Copy Markdown
Owner

Adds the next domain modeling slice for #403: Domain Service.

Includes:

  • fluent DomainServiceOperation/DomainServiceRegistry APIs
  • GenerateDomainServiceRegistry source generator path
  • IServiceCollection-importable shipping example
  • TinyBDD runtime, generator, example, and catalog coverage
  • BenchmarkDotNet scenario and benchmark result docs
  • README/docs/catalog/toc updates

Local validation:

  • dotnet format PatternKit.slnx --verify-no-changes --verbosity minimal
  • dotnet build PatternKit.slnx --configuration Release --no-restore -m:1
  • dotnet test PatternKit.slnx --configuration Release --no-build -p:TestTfmsInParallel=false --logger "console;verbosity=minimal"
  • dotnet build benchmarks\PatternKit.Benchmarks\PatternKit.Benchmarks.csproj --configuration Release -m:1
  • docfx docs\docfx.json --warningsAsErrors

@github-actions

github-actions Bot commented May 28, 2026

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

github-actions Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Test Results

    12 files      12 suites   10m 0s ⏱️
 3 569 tests  3 569 ✅ 0 💤 0 ❌
10 718 runs  10 718 ✅ 0 💤 0 ❌

Results for commit 969dfb6.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented May 28, 2026

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

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.66667% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.68%. Comparing base (a1da42f) to head (969dfb6).

Files with missing lines Patch % Lines
...s/DomainServices/DomainServiceRegistryGenerator.cs 97.65% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #409      +/-   ##
==========================================
+ Coverage   89.61%   95.68%   +6.07%     
==========================================
  Files         539      543       +4     
  Lines       43432    43657     +225     
  Branches     6263     6297      +34     
==========================================
+ Hits        38922    41775    +2853     
+ Misses       2032     1882     -150     
+ Partials     2478        0    -2478     
Flag Coverage Δ
unittests 95.68% <98.66%> (+6.07%) ⬆️

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 “Domain Service” domain-modeling slice to PatternKit’s production-readiness catalog, including runtime APIs, a source generator, an importable DI example, tests, benchmarks, and documentation updates to keep the catalog/coverage matrices consistent.

Changes:

  • Introduces DomainServiceOperation<TRequest,TResponse> and DomainServiceRegistry<TRequest,TResponse> runtime APIs plus TinyBDD coverage.
  • Adds GenerateDomainServiceRegistry / DomainServiceOperation attributes and an incremental generator to emit registry factories from annotated methods.
  • Adds a Shipping Domain Service example (fluent + generated + DI), plus BenchmarkDotNet scenario and docs/catalog/TOC updates reflecting the new pattern counts.

Reviewed changes

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

Show a summary per file
File Description
test/PatternKit.Tests/Application/DomainServices/DomainServiceTests.cs New TinyBDD tests covering runtime operation/registry behavior and validation.
test/PatternKit.Generators.Tests/DomainServiceRegistryGeneratorTests.cs New Roslyn generator tests for emitted source and diagnostics.
test/PatternKit.Generators.Tests/AbstractionsAttributeCoverageTests.cs Adds attribute coverage assertions for the new generator attributes.
test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitPatternCatalogTests.cs Updates expected pattern list and ApplicationArchitecture count.
test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitBenchmarkCoverageTests.cs Updates expected published route-result total to include the new pattern.
test/PatternKit.Examples.Tests/DomainServiceDemo/ShippingDomainServiceDemoTests.cs New example tests validating fluent vs generated parity and DI import routes.
src/PatternKit.Generators/DomainServices/DomainServiceRegistryGenerator.cs New incremental generator emitting domain service registry factory and diagnostics.
src/PatternKit.Generators/AnalyzerReleases.Unshipped.md Registers new diagnostics IDs (PKDOM001–PKDOM004).
src/PatternKit.Generators.Abstractions/DomainServices/DomainServiceAttributes.cs Adds generator attribute definitions for domain service registries/operations.
src/PatternKit.Examples/ProductionReadiness/PatternKitPatternCatalog.cs Adds “Domain Service” to the production pattern catalog with coverage links.
src/PatternKit.Examples/ProductionReadiness/PatternKitExampleCatalog.cs Adds “Shipping Domain Service Pattern” example descriptor.
src/PatternKit.Examples/DomainServiceDemo/ShippingDomainServiceDemo.cs New shipping domain service demo (fluent + generated + IServiceCollection integration).
src/PatternKit.Examples/DependencyInjection/PatternKitExampleServiceCollectionExtensions.cs Wires the new domain service example into AddPatternKitExamples().
src/PatternKit.Core/Application/DomainServices/DomainService.cs Adds the runtime domain service operation/registry implementation.
README.md Updates pattern counts and benchmark matrix rows for Domain Service.
docs/patterns/toc.yml Adds Domain Service to patterns TOC.
docs/patterns/application/domain-service.md Adds the new pattern documentation page.
docs/index.md Updates pattern counts and patterns table to include Domain Service.
docs/guides/pattern-coverage.md Adds Domain Service to the coverage guide table.
docs/guides/benchmarks.md Adds Domain Service rows to the benchmarks table.
docs/guides/benchmark-results.md Updates benchmark results matrices/counts to include Domain Service and new generator.
docs/generators/toc.yml Adds Domain Service generator to generators TOC.
docs/generators/domain-service.md Adds generator documentation and diagnostic list.
docs/examples/toc.yml Adds shipping domain service example to examples TOC.
docs/examples/shipping-domain-service-pattern.md Adds the new shipping domain service example write-up.
benchmarks/PatternKit.Benchmarks/Application/DomainServiceBenchmarks.cs Adds BenchmarkDotNet scenario for fluent vs generated registry construction/execution.

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

Comment on lines +194 to +198
sb.Append("partial ").Append(type.TypeKind == TypeKind.Struct ? "struct" : "class").Append(' ').Append(type.Name).AppendLine();
sb.AppendLine("{");
sb.Append(" public static global::PatternKit.Application.DomainServices.DomainServiceRegistry<")
.Append(requestType.ToDisplayString(TypeFormat)).Append(", ")
.Append(responseType.ToDisplayString(TypeFormat)).Append("> ")
@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Summary
  Generated on: 05/28/2026 - 21:35:54
  Coverage date: 05/28/2026 - 21:33:32 - 05/28/2026 - 21:35:43
  Parser: MultiReport (12x Cobertura)
  Assemblies: 5
  Classes: 1645
  Files: 665
  Line coverage: 94.6%
  Covered lines: 42821
  Uncovered lines: 2404
  Coverable lines: 45225
  Total lines: 98630
  Branch coverage: 75.5% (12561 of 16620)
  Covered branches: 12561
  Total branches: 16620
  Method coverage: 96% (8582 of 8932)
  Full method coverage: 88.2% (7882 of 8932)
  Covered methods: 8582
  Fully covered methods: 7882
  Total methods: 8932

PatternKit.Core                                                                                                     95.4%
  PatternKit.Application.ActivityTracking.ActivityGateState                                                          100%
  PatternKit.Application.ActivityTracking.ActivityLease                                                              100%
  PatternKit.Application.ActivityTracking.ActivityRecord                                                             100%
  PatternKit.Application.ActivityTracking.ActivityTracker                                                            100%
  PatternKit.Application.Aggregates.AggregateCommandHandler<T1, T2, T3>                                              100%
  PatternKit.Application.Aggregates.AggregateCommandResult<T>                                                        100%
  PatternKit.Application.Aggregates.AggregateRoot<T1, T2>                                                            100%
  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.DomainServices.DomainServiceOperation<T1, T2>                                               100%
  PatternKit.Application.DomainServices.DomainServiceRegistry<T1, T2>                                                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%

@JerrettDavis JerrettDavis merged commit a4fe01f into main May 28, 2026
12 checks passed
@JerrettDavis JerrettDavis deleted the feat/domain-modeling-domain-service branch May 28, 2026 21:41
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.

2 participants