feat: add backpressure pattern#494
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
There was a problem hiding this comment.
Pull request overview
Adds a new Backpressure messaging reliability pattern to PatternKit, including a runtime policy API, a Roslyn source generator + diagnostics, DI registration, production-style example, benchmarks, and catalog/docs/test coverage to meet the production-readiness matrix expectations.
Changes:
- Introduces
BackpressurePolicy<TResult>runtime policy with multiple saturation modes and result reporting. - Adds
[GenerateBackpressurePolicy]+ incremental generator (PKBP00xdiagnostics) and generator test coverage. - Integrates Backpressure into hosting extensions, examples/catalog, benchmarks, and documentation tables/TOCs.
Reviewed changes
Copilot reviewed 29 out of 29 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/PatternKit.Tests/Messaging/Reliability/Backpressure/BackpressurePolicyTests.cs | Adds runtime behavior/validation scenarios for backpressure policy. |
| test/PatternKit.Hosting.Extensions.Tests/DependencyInjection/PatternKitServiceCollectionExtensionsTests.cs | Verifies DI registration path for backpressure policy and input validation. |
| test/PatternKit.Generators.Tests/BackpressurePolicyGeneratorTests.cs | Adds generator scenarios + diagnostic validation for backpressure generator. |
| test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitPatternCatalogTests.cs | Updates catalog assertions to include Backpressure in production-readiness audits. |
| test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitBenchmarkCoverageTests.cs | Updates expected benchmark route-result totals for new pattern. |
| test/PatternKit.Examples.Tests/BackpressureDemo/CheckoutBackpressureDemoTests.cs | Validates example works via fluent/generated policies and DI import. |
| src/PatternKit.Hosting.Extensions/DependencyInjection/PatternKitServiceCollectionExtensions.cs | Adds AddPatternKitBackpressurePolicy<TResult> registration helper. |
| src/PatternKit.Generators/Backpressure/BackpressurePolicyGenerator.cs | Implements incremental generator emitting backpressure policy factories + diagnostics. |
| src/PatternKit.Generators/AnalyzerReleases.Unshipped.md | Records new analyzer IDs (PKBP001–PKBP004). |
| src/PatternKit.Generators.Abstractions/Backpressure/BackpressureAttributes.cs | Adds [GenerateBackpressurePolicy] attribute surface. |
| src/PatternKit.Examples/ProductionReadiness/PatternKitPatternCatalog.cs | Registers Backpressure in the pattern catalog with docs/source/tests/example pointers. |
| src/PatternKit.Examples/ProductionReadiness/PatternKitHostingIntegrationCatalog.cs | Adds Backpressure to reusable hosting integration catalog. |
| src/PatternKit.Examples/ProductionReadiness/PatternKitExampleCatalog.cs | Adds “Checkout Backpressure” to the example catalog metadata. |
| src/PatternKit.Examples/DependencyInjection/PatternKitExampleServiceCollectionExtensions.cs | Wires the new example into the examples DI catalog. |
| src/PatternKit.Examples/BackpressureDemo/CheckoutBackpressureDemo.cs | Adds production-style demo (policy + generated factory + DI import). |
| src/PatternKit.Core/Messaging/Reliability/Backpressure/BackpressurePolicy.cs | Adds Backpressure policy runtime implementation and result types. |
| README.md | Updates pattern counts/table and benchmark snapshot rows for Backpressure. |
| docs/patterns/toc.yml | Adds Backpressure to patterns TOC. |
| docs/patterns/messaging/backpressure.md | New pattern documentation page for Backpressure. |
| docs/index.md | Updates top-level pattern counts/table to include Backpressure. |
| docs/guides/hosting-extensions.md | Documents DI registration example + hosting integration matrix entry. |
| docs/guides/benchmark-results.md | Updates benchmark matrices/totals + adds Backpressure rows/hosting integration entry. |
| docs/generators/toc.yml | Adds Backpressure generator doc to generators TOC. |
| docs/generators/index.md | Adds Backpressure generator to generator index and sample block. |
| docs/generators/backpressure.md | New generator documentation page for Backpressure generator + diagnostics list. |
| docs/examples/toc.yml | Adds Checkout Backpressure example to examples TOC. |
| docs/examples/index.md | Adds Checkout Backpressure to examples landing page list. |
| docs/examples/checkout-backpressure.md | New example doc page for Checkout Backpressure. |
| benchmarks/PatternKit.Benchmarks/Messaging/BackpressureBenchmarks.cs | Adds BenchmarkDotNet routes for fluent vs generated backpressure. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Test Results 12 files 12 suites 11m 25s ⏱️ Results for commit b6b2075. ♻️ This comment has been updated with latest results. |
🔍 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. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #494 +/- ##
=========================================
Coverage 97.40% 97.41%
=========================================
Files 587 591 +4
Lines 48026 48386 +360
Branches 3101 34 -3067
=========================================
+ Hits 46782 47133 +351
- Misses 1244 1253 +9
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:
|
3a3494b to
725614e
Compare
725614e to
1b106ad
Compare
1b106ad to
b6b2075
Compare
Code Coverage |
Summary
Validation
Closes #489