feat(messaging): add content enricher pattern surface#386
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Test Results 1 files 1 suites 2m 48s ⏱️ Results for commit 10515b1. ♻️ This comment has been updated with latest results. |
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🔍 PR Validation ResultsVersion: `` ✅ Validation Steps
📊 ArtifactsDry-run artifacts have been uploaded and will be available for 7 days. This comment was automatically generated by the PR validation workflow. |
There was a problem hiding this comment.
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.
| 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); | ||
| } |
| 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() | ||
| }; | ||
| } |
| [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)); | ||
| } |
33f7171 to
10515b1
Compare
Code Coverage |
Closes #385.
Summary
Validation