feat(messaging): add message expiration pattern#384
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Test Results 1 files 1 suites 2m 19s ⏱️ Results for commit 874c2c5. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #384 +/- ##
==========================================
+ Coverage 89.55% 95.61% +6.06%
==========================================
Files 518 522 +4
Lines 42034 42258 +224
Branches 6070 6104 +34
==========================================
+ Hits 37645 40407 +2762
+ Misses 1997 1851 -146
+ Partials 2392 0 -2392
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. |
Code Coverage |
There was a problem hiding this comment.
Pull request overview
Adds the Message Expiration enterprise integration pattern to PatternKit, including a fluent runtime API, a new Roslyn source generator path, an end-to-end example with DI wiring, tests, docs, and benchmark/catalog coverage updates.
Changes:
- Introduces
MessageExpiration<TPayload>runtime API + result type, with TinyBDD coverage for stamping/evaluation behavior. - Adds
[GenerateMessageExpiration]+MessageExpirationGeneratorwith generator tests and diagnostics registration. - Updates pattern/example catalogs, documentation, README tables, benchmark coverage matrix, and package pinning for Roslyn (
Microsoft.CodeAnalysis.CSharp).
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/PatternKit.Tests/packages.lock.json | Updates lockfile for multi-target test restore (incl. net10.0). |
| test/PatternKit.Tests/Messaging/Reliability/MessageExpirationTests.cs | Adds runtime behavior tests for message expiration stamping/evaluation. |
| test/PatternKit.Generators.Tests/packages.lock.json | Updates generator-test lockfile for new Roslyn pin and net10.0. |
| test/PatternKit.Generators.Tests/MessageExpirationGeneratorTests.cs | Adds generator output/diagnostic tests for message expiration generation. |
| test/PatternKit.Generators.Tests/AbstractionsAttributeCoverageTests.cs | Extends attribute coverage to include GenerateMessageExpirationAttribute. |
| test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitPatternCatalogTests.cs | Updates expected catalog entries/counts to include Message Expiration. |
| test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitBenchmarkCoverageTests.cs | Updates expected benchmark route-result totals after adding the new pattern. |
| test/PatternKit.Examples.Tests/packages.lock.json | Updates examples-test lockfile (incl. net10.0). |
| test/PatternKit.Examples.Tests/Messaging/OrderMessageExpirationExampleTests.cs | Adds example-level tests for fluent + generated expiration and DI registration. |
| src/PatternKit.Generators/packages.lock.json | Updates generator package lockfile (netstandard2.0) for Roslyn pin. |
| src/PatternKit.Generators/Messaging/MessageExpirationGenerator.cs | Adds incremental generator emitting MessageExpiration<T> factory source. |
| src/PatternKit.Generators/AnalyzerReleases.Unshipped.md | Documents new generator diagnostics PKMEXP001/PKMEXP002. |
| src/PatternKit.Generators.Abstractions/Messaging/MessageExpirationAttributes.cs | Adds [GenerateMessageExpiration] attribute API surface and options. |
| src/PatternKit.Examples/ProductionReadiness/PatternKitPatternCatalog.cs | Registers new pattern with source/tests/docs/example paths for coverage auditing. |
| src/PatternKit.Examples/ProductionReadiness/PatternKitExampleCatalog.cs | Registers new “Order Message Expiration” example descriptor. |
| src/PatternKit.Examples/Messaging/OrderMessageExpirationExample.cs | Adds order-deadline example (fluent + generated) and IServiceCollection integration. |
| src/PatternKit.Examples/DependencyInjection/PatternKitExampleServiceCollectionExtensions.cs | Wires the new example into the consolidated examples DI surface. |
| src/PatternKit.Core/Messaging/Reliability/MessageExpiration.cs | Adds core implementation of Message Expiration policy + evaluation result. |
| README.md | Updates pattern counts/table and adds benchmark rows for Message Expiration. |
| docs/patterns/toc.yml | Adds Message Expiration to patterns TOC. |
| docs/patterns/messaging/message-expiration.md | Adds pattern documentation and usage snippet. |
| docs/guides/pattern-coverage.md | Adds Message Expiration to the coverage guide table. |
| docs/guides/benchmarks.md | Adds Message Expiration benchmark rows. |
| docs/guides/benchmark-results.md | Adds Message Expiration rows + updates totals and generator coverage table. |
| docs/generators/toc.yml | Adds Message Expiration generator doc to generators TOC. |
| docs/generators/message-expiration.md | Adds generator documentation and option table. |
| docs/generators/index.md | Adds Message Expiration to generator index table. |
| docs/examples/toc.yml | Adds Order Message Expiration to examples TOC. |
| docs/examples/order-message-expiration.md | Adds example documentation and DI usage snippet. |
| Directory.Packages.props | Pins Microsoft.CodeAnalysis.CSharp to 5.0.0 for generator loading compatibility. |
| benchmarks/PatternKit.Benchmarks/Messaging/MessageExpirationBenchmarks.cs | Adds BenchmarkDotNet coverage for fluent vs generated construction/execution routes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return message.Headers.TryGetDateTimeOffset(_headerName, out var expiresAt) ? expiresAt : null; | ||
| } | ||
|
|
||
| /// <summary>Returns a new message with an expiration deadline based on the configured or supplied TTL.</summary> |
Closes #383.
Summary
[GenerateMessageExpiration]source-generated factory path.IServiceCollectionintegration, production catalog coverage, docs, README tables, and user guide entries.Microsoft.CodeAnalysis.CSharpto 5.0.0 so source generators load under the Windows SDK compiler used by the solution build.Validation
dotnet restore PatternKit.slnx --force-evaluatedotnet build PatternKit.slnx --configuration Release --no-restore -m:1dotnet test test\PatternKit.Tests\PatternKit.Tests.csproj --configuration Release --no-build --logger "console;verbosity=minimal" -p:TestTfmsInParallel=falsedotnet test test\PatternKit.Generators.Tests\PatternKit.Generators.Tests.csproj --configuration Release --no-build --logger "console;verbosity=minimal" -p:TestTfmsInParallel=falsedotnet test test\PatternKit.Examples.Tests\PatternKit.Examples.Tests.csproj --configuration Release --no-build --logger "console;verbosity=minimal" -p:TestTfmsInParallel=falsedotnet run -c Release --framework net10.0 --no-build --project benchmarks\PatternKit.Benchmarks -- --filter PatternKit.Benchmarks.Messaging.MessageExpirationBenchmarks* --artifacts artifacts\benchmarks-messageexpiration --joingit diff --check