Skip to content

feat: add gateway aggregation pattern#317

Merged
JerrettDavis merged 1 commit into
mainfrom
feature/gateway-aggregation-309
May 22, 2026
Merged

feat: add gateway aggregation pattern#317
JerrettDavis merged 1 commit into
mainfrom
feature/gateway-aggregation-309

Conversation

@JerrettDavis
Copy link
Copy Markdown
Owner

Closes #309

Summary

  • adds Gateway Aggregation runtime API and source generator
  • adds customer dashboard aggregation demo with IServiceCollection and ASP.NET Core endpoint integration
  • adds TinyBDD runtime, generator, example, catalog, and docs coverage

Local 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 net9.0 /p:UseSharedCompilation=false
  • dotnet build src\PatternKit.Core\PatternKit.Core.csproj -f net10.0 /p:UseSharedCompilation=false
  • dotnet build src\PatternKit.Generators.Abstractions\PatternKit.Generators.Abstractions.csproj /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/net9.0/net10.0 --filter FullyQualifiedName~GatewayAggregationTests
  • dotnet test test\PatternKit.Generators.Tests\PatternKit.Generators.Tests.csproj -f net8.0/net9.0/net10.0 --filter FullyQualifiedNameGatewayAggregationGeneratorTests|FullyQualifiedNameAbstractionsAttributeCoverageTests
  • git diff --check

Note: local full examples build still hits the existing CS9057 compiler/analyzer mismatch; hosted CI validates examples/docs.

@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 27s ⏱️
952 tests 952 ✅ 0 💤 0 ❌
957 runs  957 ✅ 0 💤 0 ❌

Results for commit d707963.

@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 - 13:07:23
  Coverage date: 05/22/2026 - 13:05:34 - 05/22/2026 - 13:07:11
  Parser: MultiReport (9x Cobertura)
  Assemblies: 4
  Classes: 1318
  Files: 547
  Line coverage: 94.8%
  Covered lines: 36706
  Uncovered lines: 2002
  Coverable lines: 38708
  Total lines: 85315
  Branch coverage: 75.9% (10682 of 14070)
  Covered branches: 10682
  Total branches: 14070
  Method coverage: 96.3% (7148 of 7418)
  Full method coverage: 88.4% (6562 of 7418)
  Covered methods: 7148
  Fully covered methods: 6562
  Total methods: 7418

PatternKit.Core                                                                                                     95.9%
  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%

@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

❌ Patch coverage is 91.78082% with 24 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.92%. Comparing base (cb4a93d) to head (d707963).

Files with missing lines Patch % Lines
.../GatewayAggregation/GatewayAggregationGenerator.cs 91.60% 11 Missing ⚠️
...ore/Cloud/GatewayAggregation/GatewayAggregation.cs 88.60% 9 Missing ⚠️
...ionDemo/CustomerDashboardGatewayAggregationDemo.cs 91.11% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #317      +/-   ##
==========================================
+ Coverage   90.14%   95.92%   +5.77%     
==========================================
  Files         444      448       +4     
  Lines       36964    37254     +290     
  Branches     5248     5290      +42     
==========================================
+ Hits        33322    35736    +2414     
+ Misses       1609     1518      -91     
+ Partials     2033        0    -2033     
Flag Coverage Δ
unittests 95.92% <91.78%> (+5.77%) ⬆️

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.

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 Gateway Aggregation as a first-class PatternKit pattern, including a fluent runtime API, a Roslyn incremental generator for factory creation, and an end-to-end “Customer Dashboard” demo integrated with DI and ASP.NET Core routing. This lands the pattern into the production readiness catalogs and documentation sets (patterns, generators, examples).

Changes:

  • Introduces GatewayAggregation<TRequest,TResponse> runtime API with per-part results, composition, and explicit failure reporting.
  • Adds GenerateGatewayAggregation source generator + attribute surface + generator diagnostics + generator tests.
  • Adds a DI + ASP.NET Core minimal API example and wires it into catalogs, coverage docs, and TOCs.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/PatternKit.Tests/Cloud/GatewayAggregation/GatewayAggregationTests.cs Runtime API behavioral coverage (success, failures, validation).
test/PatternKit.Generators.Tests/GatewayAggregationGeneratorTests.cs Verifies generated factory output and diagnostic IDs for invalid declarations.
test/PatternKit.Generators.Tests/AbstractionsAttributeCoverageTests.cs Ensures new generator attributes expose defaults/config and are tracked in attribute coverage.
test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitPatternCatalogTests.cs Updates catalog expectations to include the new pattern and family counts.
test/PatternKit.Examples.Tests/GatewayAggregationDemo/CustomerDashboardGatewayAggregationDemoTests.cs Validates fluent/generated demo paths and DI importability.
src/PatternKit.Generators/GatewayAggregation/GatewayAggregationGenerator.cs New incremental generator that emits a gateway factory from fetches + composer.
src/PatternKit.Generators/AnalyzerReleases.Unshipped.md Registers new generator diagnostic IDs (PKGA001–PKGA004).
src/PatternKit.Generators.Abstractions/Cloud/GatewayAggregationAttributes.cs Adds generator attribute API: host, fetch, composer attributes.
src/PatternKit.Examples/ProductionReadiness/PatternKitPatternCatalog.cs Registers Gateway Aggregation pattern coverage descriptor and links docs/tests/examples.
src/PatternKit.Examples/ProductionReadiness/PatternKitExampleCatalog.cs Adds “Customer Dashboard Gateway Aggregation” example descriptor.
src/PatternKit.Examples/GatewayAggregationDemo/CustomerDashboardGatewayAggregationDemo.cs New demo: downstream clients, fluent + generated construction, DI + endpoint mapping.
src/PatternKit.Examples/DependencyInjection/PatternKitExampleServiceCollectionExtensions.cs Adds AddCustomerDashboardGatewayAggregationExample and includes it in AddPatternKitExamples.
src/PatternKit.Core/Cloud/GatewayAggregation/GatewayAggregation.cs Adds the core gateway aggregation runtime types and fluent builder.
docs/patterns/toc.yml Adds Gateway Aggregation to pattern TOC under Cloud Architecture.
docs/patterns/cloud/gateway-aggregation.md Adds the pattern doc + quick runtime snippet + guidance.
docs/guides/pattern-coverage.md Extends coverage matrix with the new runtime + generator entries.
docs/generators/toc.yml Adds Gateway Aggregation generator doc to TOC.
docs/generators/index.md Adds generator index entry + quick reference snippet.
docs/generators/gateway-aggregation.md Adds generator guide + example + diagnostic list.
docs/examples/toc.yml Adds the customer dashboard gateway aggregation example to examples TOC.
docs/examples/index.md Adds example summary entry to examples landing page.
docs/examples/customer-dashboard-gateway-aggregation.md Adds example doc with DI usage snippet and endpoint mapping note.

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

Comment on lines +113 to +122
private static FetchMember[] FetchMembers(INamedTypeSymbol type)
=> type.GetMembers().OfType<IMethodSymbol>()
.Select(method => new
{
Method = method,
Attribute = method.GetAttributes().FirstOrDefault(attr => attr.AttributeClass?.ToDisplayString() == FetchAttributeName)
})
.Where(static item => item.Attribute is not null)
.Select(static item => new FetchMember((string)item.Attribute!.ConstructorArguments[0].Value!, item.Method))
.ToArray();
Comment on lines +70 to +83
var fetches = FetchMembers(type);
var composers = MembersWith(type, ComposerAttributeName);
if (fetches.Length == 0 || composers.Length != 1)
{
context.ReportDiagnostic(Diagnostic.Create(MissingMembers, node.Identifier.GetLocation(), type.Name));
return;
}

var duplicate = fetches.GroupBy(static item => item.Name, StringComparer.OrdinalIgnoreCase).FirstOrDefault(static group => group.Count() > 1);
if (duplicate is not null)
{
context.ReportDiagnostic(Diagnostic.Create(DuplicateFetch, node.Identifier.GetLocation(), duplicate.Key));
return;
}
sb.Append("abstract ");
else if (type.IsSealed && type.TypeKind == TypeKind.Class)
sb.Append("sealed ");
sb.Append("partial ").Append(type.TypeKind == TypeKind.Struct ? "struct" : "class").Append(' ').Append(type.Name).AppendLine();
Comment on lines +148 to +169
var ns = type.ContainingNamespace.IsGlobalNamespace ? null : type.ContainingNamespace.ToDisplayString();
var requestTypeName = requestType.ToDisplayString(TypeFormat);
var responseTypeName = responseType.ToDisplayString(TypeFormat);
var sb = new StringBuilder();
sb.AppendLine("// <auto-generated/>");
sb.AppendLine("#nullable enable");
sb.AppendLine();
if (ns is not null)
{
sb.Append("namespace ").Append(ns).AppendLine(";");
sb.AppendLine();
}

sb.Append(GetAccessibility(type.DeclaredAccessibility)).Append(' ');
if (type.IsStatic)
sb.Append("static ");
else if (type.IsAbstract && type.TypeKind == TypeKind.Class)
sb.Append("abstract ");
else if (type.IsSealed && type.TypeKind == TypeKind.Class)
sb.Append("sealed ");
sb.Append("partial ").Append(type.TypeKind == TypeKind.Struct ? "struct" : "class").Append(' ').Append(type.Name).AppendLine();
sb.AppendLine("{");
@JerrettDavis JerrettDavis merged commit 36faa71 into main May 22, 2026
13 checks passed
@JerrettDavis JerrettDavis deleted the feature/gateway-aggregation-309 branch May 22, 2026 13:13
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 Gateway Aggregation pattern

2 participants