Skip to content

feat(messaging): add message history pattern#380

Merged
JerrettDavis merged 1 commit into
mainfrom
feature/message-history-pattern
May 27, 2026
Merged

feat(messaging): add message history pattern#380
JerrettDavis merged 1 commit into
mainfrom
feature/message-history-pattern

Conversation

@JerrettDavis

Copy link
Copy Markdown
Owner

Summary

  • Adds Message History with fluent runtime and source-generated factory paths.
  • Adds production IServiceCollection examples, docs, catalog coverage, TinyBDD tests, and BenchmarkDotNet results.

Closes #379

Validation

  • dotnet build PatternKit.slnx --configuration Release --no-restore -m:1
  • PatternKit.Tests passed on net8/net9/net10
  • PatternKit.Generators.Tests passed on net8/net9/net10
  • PatternKit.Examples.Tests passed on net8/net9/net10
  • MessageHistory BenchmarkDotNet slice passed

Copilot AI review requested due to automatic review settings May 27, 2026 04:09
@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

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 Message History enterprise integration pattern with runtime APIs, source generation, examples, documentation, tests, catalog coverage, and benchmark result entries.

Changes:

  • Introduces MessageHistory<TPayload> and MessageHistoryEntry for appending/reading handling history from message headers.
  • Adds [GenerateMessageHistory] and MessageHistoryGenerator for source-generated history builder factories.
  • Adds order message history examples, DI registration, docs/catalog entries, tests, and benchmark coverage/results.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/PatternKit.Core/Messaging/Diagnostics/MessageHistory.cs Adds core message history recorder and entry model.
src/PatternKit.Generators.Abstractions/Messaging/MessageHistoryAttributes.cs Adds generator attribute for message history factories.
src/PatternKit.Generators/Messaging/MessageHistoryGenerator.cs Adds Roslyn incremental generator for message history builders.
src/PatternKit.Generators/AnalyzerReleases.Unshipped.md Registers new generator diagnostics.
src/PatternKit.Examples/Messaging/OrderMessageHistoryExample.cs Adds fluent/generated message history example and DI demo registration.
src/PatternKit.Examples/DependencyInjection/PatternKitExampleServiceCollectionExtensions.cs Adds aggregate example registration and service wrapper.
src/PatternKit.Examples/ProductionReadiness/PatternKitPatternCatalog.cs Adds Message History to production readiness catalog.
src/PatternKit.Examples/ProductionReadiness/PatternKitExampleCatalog.cs Adds Order Message History to example catalog.
benchmarks/PatternKit.Benchmarks/Messaging/MessageHistoryBenchmarks.cs Adds construction/execution benchmarks.
test/PatternKit.Tests/Messaging/Diagnostics/MessageHistoryTests.cs Adds core behavior and validation tests.
test/PatternKit.Generators.Tests/MessageHistoryGeneratorTests.cs Adds generator output/diagnostic tests.
test/PatternKit.Generators.Tests/AbstractionsAttributeCoverageTests.cs Adds attribute coverage expectations.
test/PatternKit.Examples.Tests/Messaging/OrderMessageHistoryExampleTests.cs Adds example and DI coverage.
test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitPatternCatalogTests.cs Updates catalog count expectations.
test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitBenchmarkCoverageTests.cs Updates benchmark route total expectation.
README.md Updates pattern counts and benchmark table.
docs/patterns/messaging/message-history.md Adds pattern documentation.
docs/patterns/toc.yml Adds pattern TOC entry.
docs/generators/message-history.md Adds generator documentation.
docs/generators/index.md Adds generator index entry.
docs/generators/toc.yml Adds generator TOC entry.
docs/examples/order-message-history.md Adds example documentation.
docs/examples/toc.yml Adds example TOC entry.
docs/guides/pattern-coverage.md Adds coverage guide row.
docs/guides/benchmarks.md Adds benchmark guide rows.
docs/guides/benchmark-results.md Updates benchmark matrices and counts.

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

sb.AppendLine();
}

sb.Append("partial ").Append(type.TypeKind == TypeKind.Struct ? "struct" : "class").Append(' ').Append(type.Name).AppendLine();
Comment on lines +28 to +36
_ = RoslynTestHelpers.Run(comp, new MessageHistoryGenerator(), out var run, out _);
return run.Results.Single().GeneratedSources.Single().SourceText.ToString();
})
.Then("the generated factory returns a configured builder", text =>
{
ScenarioExpect.Contains("MessageHistory<global::MyApp.Order>.Builder Build()", text);
ScenarioExpect.Contains("MessageHistory<global::MyApp.Order>.Create(@\"checkout-api\")", text);
ScenarioExpect.Contains(".Action(@\"received\")", text);
ScenarioExpect.Contains(".Header(@\"X-History\")", text);
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

    1 files      1 suites   2m 51s ⏱️
1 036 tests 1 036 ✅ 0 💤 0 ❌
1 041 runs  1 041 ✅ 0 💤 0 ❌

Results for commit 5281db7.

@github-actions

Copy link
Copy Markdown
Contributor

Code Coverage

Summary
  Generated on: 05/27/2026 - 04:15:08
  Coverage date: 05/27/2026 - 04:13:20 - 05/27/2026 - 04:14:56
  Parser: MultiReport (9x Cobertura)
  Assemblies: 4
  Classes: 1563
  Files: 629
  Line coverage: 94.5%
  Covered lines: 41015
  Uncovered lines: 2346
  Coverable lines: 43361
  Total lines: 94900
  Branch coverage: 75.5% (12056 of 15963)
  Covered branches: 12056
  Total branches: 15963
  Method coverage: 95.9% (8211 of 8555)
  Full method coverage: 88.1% (7542 of 8555)
  Covered methods: 8211
  Fully covered methods: 7542
  Total methods: 8555

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%

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

@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.02439% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.61%. Comparing base (fa96e10) to head (5281db7).

Files with missing lines Patch % Lines
...it.Generators/Messaging/MessageHistoryGenerator.cs 97.36% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #380      +/-   ##
==========================================
+ Coverage   89.57%   95.61%   +6.04%     
==========================================
  Files         510      514       +4     
  Lines       41628    41833     +205     
  Branches     6011     6037      +26     
==========================================
+ Hits        37287    39999    +2712     
+ Misses       1978     1834     -144     
+ Partials     2363        0    -2363     
Flag Coverage Δ
unittests 95.61% <99.02%> (+6.04%) ⬆️

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.

@JerrettDavis
JerrettDavis merged commit 9d8efab into main May 27, 2026
13 checks passed
@JerrettDavis
JerrettDavis deleted the feature/message-history-pattern branch May 27, 2026 04:21
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 Message History enterprise integration pattern

2 participants