Fix Federated Event Stream subscription teardown on per-event errors - #9995
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes Federated Event Stream subscription behavior so that per-event failures (e.g., enrichment lookup errors, including transport failures) produce an error result for that event without tearing down the overall subscription stream, allowing subsequent events to still be delivered.
Changes:
- Adjust subscription event execution cancellation handling to distinguish “completed early due to root null-propagation” from genuine timeouts/aborts, keeping the stream alive for later events.
- Improve error/data-path resolution in result integration by handling null intermediates and ignoring inline-fragment segments when mapping source error paths.
- Add targeted regression tests covering per-event enrichment failures (lookup error + transport error), plus broader query/mutation error-behavior coverage and an HTTP+NATS end-to-end subscription scenario.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Subscriptions/EventStreamTransportFailureTests.cs | New unit test ensuring transport-style enrichment failure yields per-event error and subscription remains alive. |
| src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Execution/Subscriptions/EventStreamLookupFailureTests.cs | New unit test ensuring subgraph error/null lookup result yields per-event error and stream continues. |
| src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/QueryErrorBehaviorTests.cs | New ASP.NET Core test coverage for query error behavior (root transport failure + coercion error). |
| src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/MutationErrorBehaviorTests.cs | New ASP.NET Core test coverage for mutation error behavior across multiple failure categories. |
| src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/EventStreamEnrichmentErrorOverHttpTests.cs | New end-to-end test verifying per-event enrichment errors over HTTP with NATS JetStream don’t close the subscription. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/FetchResultStore.cs | Adjust result/error-path integration to treat null intermediates as null (not undefined) and skip inline-fragment segments when resolving error tries. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/OperationPlanExecutor.cs | Update subscription response streaming loop to avoid tearing down on root-null early completion and to replace per-event CTS when needed. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/ExecutionState.cs | Track “processing completed early” and allow swapping the CTS that CancelProcessing() affects for per-event subscription scoping. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Patch coverage100.0% of changed lines covered (30/30)
Project coverage: 52.4% (215348/411052 lines) |
|
|
No description provided.