feat: add Claim Check pattern#247
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Test Results 1 files 1 suites 2m 11s ⏱️ Results for commit 294ca1e. |
Code Coverage |
There was a problem hiding this comment.
Pull request overview
Adds first-class Claim Check support to PatternKit’s messaging transformation slice, including a runtime fluent API, a Roslyn source generator for strongly-typed factories, and a production-shaped large-document example with DI + documentation updates.
Changes:
- Introduces
ClaimCheck<TPayload>runtime APIs,ClaimCheckReference, store abstractions, and an in-memory store implementation. - Adds
[GenerateClaimCheck]/[ClaimCheckStoreFactory]generator + diagnostics and corresponding generator tests. - Expands examples, DI registrations, pattern catalogs, and documentation to include the new pattern.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/PatternKit.Tests/Messaging/Transformation/ClaimCheckTests.cs | Adds runtime tests for store/restore, missing claims, cancellation, and configuration validation. |
| test/PatternKit.Generators.Tests/ClaimCheckGeneratorTests.cs | Adds generator tests for successful output and diagnostics (PKCC001-003). |
| test/PatternKit.Generators.Tests/AbstractionsAttributeCoverageTests.cs | Verifies new generator attributes’ defaults and argument validation. |
| test/PatternKit.Examples.Tests/ProductionReadiness/PatternKitPatternCatalogTests.cs | Updates catalog expectations to include “Claim Check”. |
| test/PatternKit.Examples.Tests/Messaging/LargeDocumentClaimCheckExampleTests.cs | Adds example-level tests for fluent, generated, and DI paths. |
| test/PatternKit.Examples.Tests/DependencyInjection/PatternKitExampleDependencyInjectionTests.cs | Ensures the new generated claim-check example is DI-registered and functional. |
| src/PatternKit.Generators/Messaging/ClaimCheckGenerator.cs | Implements incremental generator producing ClaimCheck<TPayload> factory from attributes. |
| src/PatternKit.Generators/AnalyzerReleases.Unshipped.md | Registers new analyzer diagnostic IDs PKCC001-003. |
| src/PatternKit.Generators.Abstractions/Messaging/ClaimCheckAttributes.cs | Adds generator-facing attribute definitions. |
| src/PatternKit.Examples/ProductionReadiness/PatternKitPatternCatalog.cs | Adds Claim Check to the pattern catalog entry list. |
| src/PatternKit.Examples/ProductionReadiness/PatternKitExampleCatalog.cs | Adds “Generated Claim Check” to the example catalog descriptors. |
| src/PatternKit.Examples/Messaging/LargeDocumentClaimCheckExample.cs | Adds a full large-document workflow demonstrating fluent, generated, and DI usage. |
| src/PatternKit.Examples/DependencyInjection/PatternKitExampleServiceCollectionExtensions.cs | Registers the generated claim-check example into the global examples DI surface. |
| src/PatternKit.Core/Messaging/Transformation/ClaimCheck.cs | Introduces the core Claim Check runtime types and default in-memory store. |
| docs/patterns/toc.yml | Adds Claim Check to patterns documentation TOC. |
| docs/patterns/messaging/claim-check.md | Adds pattern documentation page for Claim Check. |
| docs/guides/pattern-coverage.md | Updates coverage matrix to include Claim Check runtime + generator. |
| docs/generators/toc.yml | Adds Claim Check to generators documentation TOC. |
| docs/generators/messaging.md | Updates messaging generator list/count and adds Claim Check section. |
| docs/generators/index.md | Adds Claim Check row to generator index table. |
| docs/generators/claim-check.md | Adds dedicated Claim Check generator documentation (usage + diagnostics). |
| docs/examples/toc.yml | Adds Generated Claim Check to examples TOC. |
| docs/examples/generated-claim-check.md | Adds example write-up for generated claim check scenario. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (message is null) | ||
| throw new ArgumentNullException(nameof(message)); | ||
|
|
||
| var effectiveContext = context ?? MessageContext.From(message, cancellationToken); |
| var stored = await _store.TryLoadAsync(claim.Payload.ClaimId, cancellationToken).ConfigureAwait(false); | ||
| if (stored is null) | ||
| return ClaimCheckRestoreResult<TPayload>.Miss($"Claim '{claim.Payload.ClaimId}' was not found in store '{StoreName}'."); |
| ```csharp | ||
| services.AddLargeDocumentClaimCheckExample(); | ||
|
|
||
| var workflow = provider.GetRequiredService<LargeDocumentWorkflow>(); | ||
| var summary = workflow.Process(documentMessage); | ||
| ``` |
|
|
||
| ```csharp | ||
| services.AddLargeDocumentClaimCheckExample(); | ||
|
|
🔍 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 #247 +/- ##
==========================================
+ Coverage 91.09% 96.27% +5.18%
==========================================
Files 304 308 +4
Lines 28459 28738 +279
Branches 3967 4008 +41
==========================================
+ Hits 25924 27667 +1743
+ Misses 1129 1071 -58
+ Partials 1406 0 -1406
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:
|
Summary
Closes #234
Validation
Note: full examples build/test remains hosted-CI validated on this workstation because the local compiler rejects the current analyzer assembly with CS9057.