Repository navigation
client: make caller-side context cancellation/timeout errors match context.Canceled/DeadlineExceeded - #902
Merged
Conversation
Co-authored-by: roman-khimov <22092804+roman-khimov@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Wrap context-related NeoFS Client errors
client: make caller-side context cancellation/timeout errors match Oct 27, 2026
context.Canceled/DeadlineExceeded
roman-khimov
approved these changes
Oct 27, 2026
roman-khimov
marked this pull request as ready for review
October 27, 2026 15:45
roman-khimov
requested review from
carpawell,
cthulhu-rider and
smallhive
as code owners
October 27, 2026 15:45
roman-khimov
requested changes
Oct 27, 2026
roman-khimov
left a comment
Member
There was a problem hiding this comment.
@copilot, fix linter. default case in switch should be sufficient for the purpose
Co-authored-by: roman-khimov <22092804+roman-khimov@users.noreply.github.com>
Contributor
Author
Added a |
roman-khimov
approved these changes
Oct 27, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #902 +/- ##
==========================================
+ Coverage 61.38% 61.42% +0.03%
==========================================
Files 177 177
Lines 17233 17243 +10
==========================================
+ Hits 10579 10591 +12
+ Misses 6654 6652 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
smallhive
approved these changes
Oct 29, 2026
carpawell
approved these changes
Oct 30, 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.
When a caller cancels the context, client methods return a raw gRPC
statuserror (rpc error: code = Canceled ...).errors.Is(err, context.Canceled)doesn't match it, so callers have to string-match the message.wrapCtxErr(client/grpc.go)fmt.Errorf("%w: %w", ctx.Err(), err)when the caller'sctxis done and the error is a gRPCCanceledorDeadlineExceededstatus.status.Code(err)still works.Canceled/DeadlineExceededis deliberately left untouched when the localctxis still live, so a server-side cancellation is never reported as a caller cancellation.client/grpc.go, pluscallUnary'sRecvMsg.PayloadReaderandDefaultObjectWriter, viadowithTimeout.dowithTimeoutnow takes actxas its first (unexported) parameter. Both stream types store the context they were opened with. The stored context is the derived one, soClose()-initiated cancels surface ascontext.Canceledtoo.TestWrapCtxErrcovers the live ctx, cancelled ctx, nil error and deadline cases.Review note: the in-stream wrapping is exercised only by the helper's unit test. There's no end-to-end test that cancels mid-stream.