Repository navigation
Record delivered subscription events as Ok on client disconnect - #10138
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves Fusion subscription observability and resilience by (1) explicitly recording when a subscription event has been delivered to the client (so diagnostics aren’t downgraded by a later client disconnect) and (2) treating event stream broker read failures as graceful stream termination while still emitting diagnostic error signals.
Changes:
- Add a new
SubscriptionEventDelivereddiagnostic callback and invoke it after a subscription event result is yielded. - Handle broker read exceptions in
EventStreamExecutionNodeby reportingSubscriptionEventErrorand completing the stream without surfacing a raw exception to the consumer. - Add a new regression test covering broker read failure behavior for event streams.
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/EventStreamBrokerReadFailureTests.cs | New test validating graceful completion + diagnostic error reporting when the broker read fails after emitting an event. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/OperationPlanExecutor.cs | Emits SubscriptionEventDelivered after yielding each subscription event result. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/EventStreamExecutionNode.cs | Catches broker read failures, reports diagnostics, and terminates the stream gracefully. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Diagnostics/IFusionExecutionDiagnosticEvents.cs | Introduces new SubscriptionEventDelivered API surface. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Diagnostics/FusionExecutionDiagnosticEventListener.cs | Adds a virtual no-op implementation for SubscriptionEventDelivered. |
| src/HotChocolate/Fusion/src/Fusion.Execution/Diagnostics/AggregateFusionExecutionDiagnosticEvents.cs | Forwards SubscriptionEventDelivered to all aggregated listeners. |
| src/HotChocolate/Fusion/src/Fusion.Diagnostics/Listeners/FusionActivityExecutionDiagnosticEventListener.cs | Stores the active subscription event span and marks it delivered when notified. |
| src/HotChocolate/Diagnostics/src/Diagnostics.Core/Spans/SubscriptionEventSpan.cs | Adds delivered tracking and forces ActivityStatusCode.Ok on completion when delivered. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1244
to
+1254
| // Execution resumes here only after the consumer finished writing the | ||
| // yielded result to the client and asked for the next event. Record the | ||
| // delivery before the event scope is disposed at the end of this loop | ||
| // iteration, so a client abort that races the resume cannot erase the | ||
| // delivered event's success status. An event whose write failed never | ||
| // resumes the stream and therefore is never reported as delivered. | ||
| context.DiagnosticEvents.SubscriptionEventDelivered( | ||
| context, | ||
| subscriptionNode, | ||
| schemaName, | ||
| subscriptionResult.Id); |
Contributor
Patch coverage79.7% of changed lines covered (51/64)
Uncovered changed lines (JSON){
"sha": "1f226f969467f6fc462db129d621bc8d71e0baa5",
"files": [
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Diagnostics/AggregateFusionExecutionDiagnosticEvents.cs", "ranges": [[380, 389]] },
{ "path": "src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/EventStreamExecutionNode.cs", "ranges": [[271, 273]] }
]
}Project coverage: 53.8% (231518/430378 lines) |
This was referenced Aug 6, 2026
Merged
This was referenced Aug 13, 2026
Closed
Closed
This was referenced Aug 25, 2026
Closed
This was referenced Sep 1, 2026
Closed
This was referenced Sep 15, 2026
Closed
[nuget][SUI_Matcher]- Bump the sui-package-updates group with 20 updates
DFE-Digital/SUI_Matcher#405
Closed
This was referenced Sep 22, 2026
Closed
Closed
[nuget][SUI_Matcher]- Bump the sui-package-updates group with 20 updates
DFE-Digital/SUI_Matcher#410
Merged
This was referenced Oct 5, 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.
No description provided.