Skip to content

feat: add eventual consistency monitor pattern#460

Merged
JerrettDavis merged 1 commit into
mainfrom
feat/eventual-consistency-monitor-453
May 30, 2026
Merged

feat: add eventual consistency monitor pattern#460
JerrettDavis merged 1 commit into
mainfrom
feat/eventual-consistency-monitor-453

Conversation

@JerrettDavis

Copy link
Copy Markdown
Owner

Closes #453

Adds the Eventual Consistency Monitor pattern with source/target watermark tracking, generated factory support, DI-importable order projection convergence example, TinyBDD coverage, docs, catalogs, and benchmark matrix entries.

@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 a new Eventual Consistency Monitor pattern to PatternKit, including a fluent runtime API for tracking source/target watermarks and convergence, plus a source generator and a DI-importable example demonstrating projection convergence.

Changes:

  • Introduces EventualConsistencyMonitor<TKey> (runtime API), status/evaluation/state models, and TinyBDD unit coverage.
  • Adds GenerateEventualConsistencyMonitorAttribute + incremental generator to emit configured monitor factories.
  • Extends examples, docs, pattern catalogs, and benchmark coverage matrices to include the new pattern and demo.

Reviewed changes

Copilot reviewed 28 out of 28 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/PatternKit.Core/Application/EventualConsistency/EventualConsistencyMonitor.cs Adds the runtime monitor API (watermarks, evaluations, state) and core record/evaluate logic.
src/PatternKit.Generators.Abstractions/EventualConsistency/EventualConsistencyMonitorAttributes.cs Introduces the generator attribute contract (defaults + configuration surface).
src/PatternKit.Generators/EventualConsistency/EventualConsistencyMonitorGenerator.cs Implements the Roslyn incremental generator emitting configured factory methods + diagnostics.
src/PatternKit.Examples/EventualConsistencyDemo/OrderProjectionConsistencyDemo.cs Adds fluent + generated demo plus DI registration for a projection convergence scenario.
src/PatternKit.Examples/DependencyInjection/PatternKitExampleServiceCollectionExtensions.cs Registers the new example into the “importable examples” DI surface.
src/PatternKit.Examples/ProductionReadiness/PatternKitExampleCatalog.cs Adds the eventual consistency demo entry to the example catalog metadata.
src/PatternKit.Examples/ProductionReadiness/PatternKitPatternCatalog.cs Adds the new pattern to the pattern catalog (docs/code/tests/generator/example links).
benchmarks/PatternKit.Benchmarks/Application/EventualConsistencyMonitorBenchmarks.cs Adds construction/execution benchmarks (fluent + generated) for coverage matrix enforcement.
test/PatternKit.Tests/Application/EventualConsistency/EventualConsistencyMonitorTests.cs Adds runtime TinyBDD tests for lagging/converged/missing/unknown/config validation.
test/PatternKit.Generators.Tests/EventualConsistencyMonitorGeneratorTests.cs Adds generator tests covering output shape, nesting, escaping, and diagnostics.
test/PatternKit.Generators.Tests/AbstractionsTests.cs Adds attribute contract tests for the new generator attribute.
test/PatternKit.Examples.Tests/EventualConsistencyDemo/OrderProjectionConsistencyDemoTests.cs Adds end-to-end example tests (fluent vs generated + DI import path).
test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitPatternCatalogTests.cs Updates production-readiness pattern counts and expected catalog names.
test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitBenchmarkCoverageTests.cs Updates benchmark matrix expectations (route totals + name humanization).
docs/patterns/application/eventual-consistency-monitor.md Documents the new runtime pattern.
docs/generators/eventual-consistency-monitor.md Documents the generator usage and diagnostics.
docs/generators/index.md Adds the generator to the generator catalog table.
docs/examples/order-projection-eventual-consistency-monitor.md Documents the DI-importable example.
docs/examples/index.md Adds the new example to the examples index.
docs/guides/pattern-coverage.md Updates the pattern coverage catalog to include the new pattern.
docs/guides/benchmarks.md Adds benchmark matrix rows for the new pattern.
docs/guides/benchmark-results.md Adds benchmark results matrix rows and pattern coverage mapping.
docs/index.md Updates published pattern counts/listing to include the new pattern.

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

Comment on lines +74 to +77
if (sourceWatermark < 0)
throw new ArgumentOutOfRangeException(nameof(sourceWatermark));
if (targetWatermark < 0)
throw new ArgumentOutOfRangeException(nameof(targetWatermark));
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

    12 files      12 suites   10m 55s ⏱️
 3 943 tests  3 943 ✅ 0 💤 0 ❌
12 260 runs  12 260 ✅ 0 💤 0 ❌

Results for commit 0faa072.

@codecov

codecov Bot commented May 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.95122% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.83%. Comparing base (f88facf) to head (0faa072).

Files with missing lines Patch % Lines
.../EventualConsistency/EventualConsistencyMonitor.cs 96.55% 5 Missing ⚠️
...Consistency/EventualConsistencyMonitorGenerator.cs 96.00% 4 Missing ⚠️
...lConsistencyDemo/OrderProjectionConsistencyDemo.cs 97.87% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #460      +/-   ##
==========================================
+ Coverage   96.68%   96.83%   +0.15%     
==========================================
  Files         575      579       +4     
  Lines       46821    47147     +326     
  Branches     3071     6757    +3686     
==========================================
+ Hits        45267    45656     +389     
+ Misses       1554     1491      -63     
Flag Coverage Δ
unittests 96.83% <96.95%> (+0.15%) ⬆️

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

Copy link
Copy Markdown
Contributor

Code Coverage

Summary
  Generated on: 05/30/2026 - 19:49:34
  Coverage date: 05/30/2026 - 19:46:59 - 05/30/2026 - 19:49:22
  Parser: MultiReport (12x Cobertura)
  Assemblies: 5
  Classes: 1715
  Files: 579
  Line coverage: 96.6%
  Covered lines: 45581
  Uncovered lines: 1566
  Coverable lines: 47147
  Total lines: 100699
  Branch coverage: 82.3% (14199 of 17232)
  Covered branches: 14199
  Total branches: 17232
  Method coverage: 96.7% (8922 of 9223)
  Full method coverage: 90.5% (8348 of 9223)
  Covered methods: 8922
  Fully covered methods: 8348
  Total methods: 9223

PatternKit.Core                                                                                                     95.6%
  PatternKit.Application.ActivityTracking.ActivityGateState                                                          100%
  PatternKit.Application.ActivityTracking.ActivityLease                                                              100%
  PatternKit.Application.ActivityTracking.ActivityRecord                                                             100%
  PatternKit.Application.ActivityTracking.ActivityTracker                                                            100%
  PatternKit.Application.Aggregates.AggregateCommandHandler<T1, T2, T3>                                              100%
  PatternKit.Application.Aggregates.AggregateCommandResult<T>                                                        100%
  PatternKit.Application.Aggregates.AggregateRoot<T1, T2>                                                            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.BoundedContexts.BoundedContextAdapter                                                       100%
  PatternKit.Application.BoundedContexts.BoundedContextCapability                                                   83.3%
  PatternKit.Application.BoundedContexts.BoundedContextDescriptor                                                   95.4%
  PatternKit.Application.ContextMaps.ContextMapDescriptor                                                           96.8%
  PatternKit.Application.ContextMaps.ContextMapRelationship                                                          100%
  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.DomainServices.DomainServiceOperation<T1, T2>                                               100%
  PatternKit.Application.DomainServices.DomainServiceRegistry<T1, T2>                                                100%
  PatternKit.Application.EventSourcing.EventStoreAppendResult                                                        100%
  PatternKit.Application.EventSourcing.InMemoryEventStore<T1, T2>                                                   97.9%
  PatternKit.Application.EventSourcing.StoredEvent<T1, T2>                                                            80%
  PatternKit.Application.EventualConsistency.EventualConsistencyEvaluation<T>                                       92.3%
  PatternKit.Application.EventualConsistency.EventualConsistencyMonitor<T>                                          97.2%
  PatternKit.Application.EventualConsistency.EventualConsistencyMonitorState<T>                                      100%
  PatternKit.Application.EventualConsistency.EventualConsistencyWatermarks<T>                                       96.7%
  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.ManualTaskGates.ManualTaskGate<T>                                                          98.5%
  PatternKit.Application.ManualTaskGates.ManualTaskGateState<T>                                                      100%
  PatternKit.Application.ManualTaskGates.ManualTaskRecord<T>                                                        96.9%

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

@JerrettDavis JerrettDavis merged commit bc40f83 into main May 30, 2026
13 checks passed
@JerrettDavis JerrettDavis deleted the feat/eventual-consistency-monitor-453 branch May 30, 2026 19:54
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 Eventual Consistency Monitor pattern

2 participants