Skip to content

feat(messaging): add content enricher pattern surface#386

Merged
JerrettDavis merged 1 commit into
mainfrom
feature/content-enricher-pattern
May 27, 2026
Merged

feat(messaging): add content enricher pattern surface#386
JerrettDavis merged 1 commit into
mainfrom
feature/content-enricher-pattern

Conversation

@JerrettDavis

Copy link
Copy Markdown
Owner

Closes #385.

Summary

  • Adds Content Enricher source-generator attributes and generator support.
  • Adds customer profile enrichment example with IServiceCollection integration.
  • Adds TinyBDD generator/example/catalog/benchmark coverage and documentation.
  • Adds BenchmarkDotNet scenario coverage and published benchmark results.

Validation

  • dotnet build PatternKit.slnx --configuration Release --no-restore -m:1
  • dotnet test test\PatternKit.Generators.Tests\PatternKit.Generators.Tests.csproj --configuration Release --no-build --logger "console;verbosity=minimal" -p:TestTfmsInParallel=false
  • dotnet test test\PatternKit.Examples.Tests\PatternKit.Examples.Tests.csproj --configuration Release --no-build --logger "console;verbosity=minimal" -p:TestTfmsInParallel=false
  • dotnet run -c Release --framework net10.0 --project benchmarks\PatternKit.Benchmarks -- --filter PatternKit.Benchmarks.Messaging.ContentEnricherBenchmarks* --artifacts artifacts\benchmarks-contentenricher --join
  • git diff --check

Copilot AI review requested due to automatic review settings May 27, 2026 06:30
@github-actions

github-actions Bot commented May 27, 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 27, 2026

Copy link
Copy Markdown
Contributor

Test Results

    1 files      1 suites   2m 48s ⏱️
1 058 tests 1 058 ✅ 0 💤 0 ❌
1 063 runs  1 063 ✅ 0 💤 0 ❌

Results for commit 10515b1.

♻️ This comment has been updated with latest results.

@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.83794% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.62%. Comparing base (59f890b) to head (10515b1).

Files with missing lines Patch % Lines
...t.Generators/Messaging/ContentEnricherGenerator.cs 94.96% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #386      +/-   ##
==========================================
+ Coverage   89.56%   95.62%   +6.06%     
==========================================
  Files         522      525       +3     
  Lines       42258    42511     +253     
  Branches     6104     6142      +38     
==========================================
+ Hits        37848    40652    +2804     
+ Misses       2003     1859     -144     
+ Partials     2407        0    -2407     
Flag Coverage Δ
unittests 95.62% <96.83%> (+6.06%) ⬆️

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

github-actions Bot commented May 27, 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.

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

This PR promotes the Content Enricher enterprise integration pattern to a first-class PatternKit surface area by adding generator support, a production-style example (including IServiceCollection integration), and full catalog/benchmark/docs coverage.

Changes:

  • Adds Content Enricher source-generator attributes, diagnostics, and the incremental generator implementation.
  • Adds a customer profile enrichment example with fluent + generated paths, plus DI registration and tests.
  • Updates catalog / documentation / benchmarks to include the new pattern and publish benchmark results/coverage counts.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/PatternKit.Generators.Tests/ContentEnricherGeneratorTests.cs Adds generator tests validating source output and diagnostics for the new content enricher generator.
test/PatternKit.Generators.Tests/AbstractionsAttributeCoverageTests.cs Ensures new generator attributes are included in attribute coverage validation.
test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitPatternCatalogTests.cs Updates pattern catalog tests to include “Content Enricher” and adjusts enterprise integration count.
test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitBenchmarkCoverageTests.cs Updates published benchmark results expectations to reflect the new pattern route totals.
test/PatternKit.Examples.Tests/Messaging/CustomerProfileContentEnricherExampleTests.cs Adds example tests covering fluent vs generated behavior and DI registration paths.
src/PatternKit.Generators/Messaging/ContentEnricherGenerator.cs Introduces the new incremental generator and diagnostics for content enricher factories.
src/PatternKit.Generators/AnalyzerReleases.Unshipped.md Documents newly introduced analyzer diagnostic IDs for the content enricher generator.
src/PatternKit.Generators.Abstractions/Messaging/ContentEnricherAttributes.cs Adds public attribute API + enum used by consumers to drive generation.
src/PatternKit.Examples/ProductionReadiness/PatternKitPatternCatalog.cs Registers “Content Enricher” in the production-readiness pattern catalog with links to docs/tests/benchmarks.
src/PatternKit.Examples/ProductionReadiness/PatternKitExampleCatalog.cs Adds the customer profile content enricher example descriptor to the example catalog.
src/PatternKit.Examples/Messaging/CustomerProfileContentEnricherExample.cs Adds the customer profile content enricher example (fluent + generated) and DI extensions.
src/PatternKit.Examples/DependencyInjection/PatternKitExampleServiceCollectionExtensions.cs Wires the new example into the aggregate AddPatternKitExamples() registration.
README.md Updates pattern counts and includes content enricher in the benchmark summary table.
docs/patterns/toc.yml Adds the Content Enricher pattern page to the patterns TOC.
docs/patterns/messaging/content-enricher.md New pattern documentation page for Content Enricher.
docs/guides/pattern-coverage.md Updates pattern coverage guide to include Content Enricher and its generator surface.
docs/guides/benchmarks.md Adds Content Enricher rows to the benchmark guidance table.
docs/guides/benchmark-results.md Adds Content Enricher benchmark results and updates totals/coverage matrices.
docs/generators/toc.yml Adds Content Enricher generator docs to the generators TOC.
docs/generators/index.md Adds Content Enricher to the generator index list.
docs/generators/content-enricher.md New generator documentation page describing usage and constraints.
docs/examples/toc.yml Adds the customer profile content enricher example page to the examples TOC.
docs/examples/customer-profile-content-enricher.md New example documentation page for the customer profile content enricher demo.
benchmarks/PatternKit.Benchmarks/Messaging/ContentEnricherBenchmarks.cs Adds BenchmarkDotNet scenarios for fluent vs generated construction/execution.

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

Comment on lines +242 to +251
private readonly record struct Step(IMethodSymbol Method, string Name, int Order, string Policy, string DefaultFactoryName)
{
internal static Step From(IMethodSymbol method, AttributeData attribute)
=> new(
method,
attribute.ConstructorArguments[0].Value as string ?? method.Name,
GetNamedInt(attribute, "Order") ?? 0,
GetNamedPolicy(attribute, "Policy") ?? "Throw",
GetNamedString(attribute, "DefaultFactoryName") ?? string.Empty);
}
Comment on lines +213 to +223
private static string? GetNamedPolicy(AttributeData attribute, string name)
{
var value = attribute.NamedArguments.FirstOrDefault(kv => kv.Key == name).Value.Value;
return value switch
{
0 => "Throw",
1 => "Skip",
2 => "UseDefault",
_ => value?.ToString()
};
}
Comment on lines +23 to +44
[Benchmark(Description = "Fluent: enrich customer profile")]
[BenchmarkCategory("Fluent", "Execution")]
public CustomerProfileEnrichmentSummary Fluent_EnrichCustomerProfile()
=> CustomerProfileContentEnricherExampleRunner.RunFluentAsync(Update).AsTask().GetAwaiter().GetResult();

[Benchmark(Description = "Generated: enrich customer profile")]
[BenchmarkCategory("Generated", "Execution")]
public CustomerProfileEnrichmentSummary Generated_EnrichCustomerProfile()
{
var result = GeneratedCustomerProfileContentEnricher.Create()
.EnrichAsync(Message<CustomerProfileUpdate>.Create(Update))
.AsTask()
.GetAwaiter()
.GetResult();
var payload = result.Message.Payload;
return new CustomerProfileEnrichmentSummary(
payload.CustomerId,
payload.Email ?? string.Empty,
payload.Tier ?? string.Empty,
payload.MarketingOptIn,
result.StepResults.Count(step => step.Applied));
}
@JerrettDavis
JerrettDavis force-pushed the feature/content-enricher-pattern branch from 33f7171 to 10515b1 Compare May 27, 2026 06:38
@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Summary
  Generated on: 05/27/2026 - 06:43:53
  Coverage date: 05/27/2026 - 06:41:54 - 05/27/2026 - 06:43:40
  Parser: MultiReport (9x Cobertura)
  Assemblies: 4
  Classes: 1598
  Files: 643
  Line coverage: 94.6%
  Covered lines: 41681
  Uncovered lines: 2374
  Coverable lines: 44055
  Total lines: 96286
  Branch coverage: 75.5% (12273 of 16242)
  Covered branches: 12273
  Total branches: 16242
  Method coverage: 95.9% (8342 of 8691)
  Full method coverage: 88.1% (7664 of 8691)
  Covered methods: 8342
  Fully covered methods: 7664
  Total methods: 8691

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

@JerrettDavis
JerrettDavis merged commit 15172ed into main May 27, 2026
12 checks passed
@JerrettDavis
JerrettDavis deleted the feature/content-enricher-pattern branch May 27, 2026 06:49
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 Content Enricher enterprise integration pattern surface

2 participants