Parameterless OrInner<T>() no longer discards its inner-exception match (GH-3766) - #3769
Merged
Merged
Conversation
…ch (GH-3766) The parameterless PolicyExpression.OrInner<TException>() built the combined match but never assigned it back to _match, so the inner-exception match silently never applied unless _match already happened to be an OrMatch. Policies like OnException<NpgsqlException>().OrInner<NpgsqlException>() matched only the outer exception type, sending wrapped failures straight to the dead letter queue on first attempt. The existing or_predicate_on_inner_type test called DetermineExecutionContinuation for the wrapped case but was missing its assertion, which is how this survived — both it and the predicate twin now assert DiscardEnvelope for wrapped inner exceptions. Closes GH-3766 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013eR4GL278688VhyhrGcttJ
This was referenced Aug 1, 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
Fixes #3766 — the parameterless
PolicyExpression.OrInner<TException>()built the combined exception match and then discarded it (_matchwas never reassigned), so the inner-exception match silently never applied. The predicate overload directly below it was already correct.One subtlety worth noting:
ExceptionMatchExtensions.Ormutates in place when the receiver is already anOrMatch, so the parameterless overload accidentally worked when chained after another.Or()— but in the commonOnException<T>().OrInner<T>()shape,_matchis aTypeMatchand the newOrMatchwas thrown away.Impact
As reported:
OnException<NpgsqlException>().OrInner<NpgsqlException>().RetryWithCooldown(...)never matchedMartenCommandExceptionwrapping anNpgsqlException, so messages failing during a brief Postgres outage skipped the retry ladder and dead-lettered on the first attempt.Testing
The existing
or_predicate_on_inner_typetest already exercised the buggy path but was missing the assertion on the wrapped-exception call — the continuation was computed and dropped on the floor, which is how this survived. Both it and its predicate twin now assertDiscardEnvelopefor wrapped inner exceptions. Verified red without the product fix, green with it.🤖 Generated with Claude Code
https://claude.ai/code/session_013eR4GL278688VhyhrGcttJ