Fix [SagaIdentityFrom] ignored when NotFound declared before Handle#2522
Merged
jeremydmiller merged 1 commit intomainfrom Apr 16, 2026
Merged
Fix [SagaIdentityFrom] ignored when NotFound declared before Handle#2522jeremydmiller merged 1 commit intomainfrom
jeremydmiller merged 1 commit intomainfrom
Conversation
#2521) DetermineSagaIdMember was only scanning the first handler method found via DistinctBy, which would be NotFound if declared first in source. Since NotFound doesn't carry [SagaIdentityFrom], the attribute was silently ignored and saga ID resolution fell back to the envelope. Fix: scan ALL saga handler methods for [SagaIdentityFrom] instead of just the first one. Added new overload accepting MethodInfo[] and updated all three SagaChain constructor paths. Closes #2521 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
[SagaIdentityFrom]attribute was silently ignored when aNotFoundhandler was declared before theHandlemethod in a saga classSagaChainusedDistinctBy(x => x.HandlerType)to pick a single representative handler, then only scanned that one method's parameters for[SagaIdentityFrom]. SinceType.GetMethods()returns methods in declaration order,NotFoundwon the race when declared first — and it doesn't carry the attributeDetermineSagaIdMembernow accepts all saga handler methods (MethodInfo[]) and scans all of them for[SagaIdentityFrom]. All threeSagaChainconstructor paths updated to pass the full method setTest plan
Bug_2521_saga_identity_from_ordering— verifies saga ID is correctly resolved from[SagaIdentityFrom]whenNotFoundis declared beforeHandlesaga_id_member_determination— verifiesDetermineSagaIdMemberfinds the attribute when scanning multiple methodsBug_2056_saga_code_generationtests pass (no regression)saga_id_member_determinationtests pass🤖 Generated with Claude Code