feat: per-item error handling / dead-lettering (multi-stream) (#11) - #239
Merged
Conversation
XmlMultiStreamExtractor<T> and XmlMultiStreamLoader<T> now honour the assignable ErrorPolicy inherited from the Abstractions base (0.21+): a Skip / SkipAndDeadLetter / …-and-log policy skips or dead-letters a stream/record that fails to (de)serialize and keeps going, with the count on CurrentErrorItemCount. Default stays fail-fast; single-stream classes stay fail-fast (a shared document can't resume mid-record). Ported from the parked 0.22 stack onto 0.21 (main already ships 0.21 via #236), so this ships in 0.5.0 without waiting on 0.22. ErrorPolicies package pinned to 0.21.0. 285 tests pass; per-class coverage ≥90%. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds per-item error handling / dead-lettering support to the multi-stream XML extractor and loader by routing (de)serialization failures through the assignable ErrorPolicy provided by the Abstractions base stages. This enables skip and dead-letter workflows for independent stream/record processing while keeping default behavior fail-fast.
Changes:
- Updated
XmlMultiStreamExtractor<T>andXmlMultiStreamLoader<T>to route per-item failures throughErrorPolicyand continue when policies choose to skip/dead-letter. - Added unit tests for multi-stream error-policy behavior and pinned
Wolfgang.Etl.ErrorPolicies0.21.0in tests/examples. - Documented the new capability in
README.mdand noted it inCHANGELOG.md, plus added a runnable example.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Wolfgang.Etl.Xml.Tests.Unit/XmlMultiStreamErrorPolicyTests.cs | New test coverage for multi-stream error-policy behavior (extractor/loader). |
| tests/Wolfgang.Etl.Xml.Tests.Unit/Wolfgang.Etl.Xml.Tests.Unit.csproj | Adds Wolfgang.Etl.ErrorPolicies dependency for unit tests. |
| src/Wolfgang.Etl.Xml/XmlMultiStreamLoader.cs | Routes serialization failures through ErrorPolicy during multi-stream loading. |
| src/Wolfgang.Etl.Xml/XmlMultiStreamExtractor.cs | Routes deserialization failures through ErrorPolicy during multi-stream extraction. |
| README.md | Adds usage docs and example snippet for per-item error handling & dead-lettering. |
| examples/Wolfgang.Etl.Xml.Examples/Wolfgang.Etl.Xml.Examples.csproj | Adds Wolfgang.Etl.ErrorPolicies dependency for the example app. |
| examples/Wolfgang.Etl.Xml.Examples/Program.cs | Adds a runnable dead-lettering demo for the multi-stream extractor. |
| CHANGELOG.md | Documents the new feature under Unreleased. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+183
to
186
| if (await SerializeItemOrHandleErrorAsync(item, itemNumber, streamIndex, token).ConfigureAwait(false)) | ||
| { | ||
| XmlLogMessages.StreamFactoryReturnedNull(_logger, streamIndex, null); | ||
| throw new InvalidOperationException($"Stream factory returned null for item at index {streamIndex}."); | ||
| streamIndex++; | ||
| } |
Comment on lines
+228
to
+230
| using Wolfgang.Etl.ErrorPolicies; | ||
|
|
||
| var deadLetters = new List<ItemErrorContext>(); |
Comment on lines
+124
to
+125
|
|
||
|
|
Contributor
PR benchmark delta
Job: Short (fast, ~5% variance). Filter: |
This was referenced Aug 9, 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.
First feature of the 0.5.0 cycle. Closes #11.
Ports the parked #234 error-handling implementation off the 0.22 stack onto 0.21 —
mainalready ships Abstractions 0.21 / TestKit 0.14 (via #236), and theErrorPolicyhooks +Wolfgang.Etl.ErrorPoliciespackage are 0.21 features, so this needs no 0.22.What
XmlMultiStreamExtractor<T>/XmlMultiStreamLoader<T>honour the assignableErrorPolicyinherited from the Abstractions base: assignItemErrorPolicy.Skip/SkipAndLog/SkipAndDeadLetter/SkipDeadLetterAndLogto skip or dead-letter a stream/record that fails to (de)serialize and keep going. Count surfaced onCurrentErrorItemCount.Wolfgang.Etl.ErrorPoliciespinned to 0.21.0 (tests + examples).Verified locally
XmlMultiStreamErrorPolicyTestscover skip + dead-letter on extractor and loader.XmlCoverageTests(from Bump the dotnet-dependencies group with 5 updates #236) instead of re-adding feat: per-item error handling / dead-lettering (multi-stream) (#11) #234's redundant loader coverage file.Base:
vNext.