feat(batching): ApplyItemException poisons every member of a coalesced key (GH-3289 Phase 3d)#3313
Merged
Conversation
…d key (GH-3289 Phase 3d) Final follow-up of the #3289 batch-processing plan: the CoalesceBy interplay flagged in #3302. Under CoalesceBy the handler only sees the last-wins instance for a key, so ApplyItemException previously dead-lettered only that one member and left the earlier same-key members in the survivor set. Now flagging a coalesced item poisons EVERY member that collapsed into that key. - New internal Envelope.BatchGroupId (JsonIgnore, reset in Reset()): the coalesced group index, stamped per key by CoalescingMessageBatcher; null for normal batches. - ApplyItemContinuation expands the poison set to all members sharing a poisoned member's BatchGroupId. No-op when BatchGroupId is null (non-coalesced batch), so existing reference-identity behavior is unchanged. Test (DB-free): a key with three members whose coalesced last-wins is poison dead-letters all three versions, while the healthy key survives and is replayed to success. 3a ApplyItemException + Phase 1 CoalesceBy tests still green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 9, 2026
Merged
This was referenced Jul 13, 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.
Final follow-up of the #3289 batch-processing plan: the
CoalesceBy×ApplyItemExceptioninterplay flagged as a deliberate follow-up in #3302.The gap
Under
CoalesceBy, the handler only sees the last-wins instance for a key.ApplyItemExceptionmatched poison items by reference identity, so flagging the coalesced item dead-lettered only that one member and left the earlier same-key members in the survivor set (acked/replayed). The plan calls for poisoning every member that collapsed into a flagged key.Fix
Envelope.BatchGroupId([JsonIgnore], reset inReset()) — the coalesced-group index, stamped per key byCoalescingMessageBatcher;nullfor a normal (non-coalesced) batch.ApplyItemContinuationexpands the poison set to all members sharing a poisoned member'sBatchGroupId. It's a no-op whenBatchGroupIdis null, so the existing reference-identity behavior for normal batches is unchanged.Test (DB-free)
batch_coalesce_poison.cs: a key"A"with three members (v1, v2, v3) whose coalesced last-wins (v3) is poison → all three A versions are dead-lettered, while the healthy key"B"survives and is replayed to success (captured viaIDeadLetterInterceptor). The 3aApplyItemExceptionand Phase-1CoalesceBytests still pass;dotnet build wolverine.slnx -c Releaseclean.Plan status
This completes the actionable items of the #3289 plan:
CoalesceBy+IBatchContext, 2 collision diagnostic, 3aApplyItemException, 3bIsolateBatchMembers, 3cProbeIndividuallyAfter, and this 3d refinement.🤖 Generated with Claude Code