Remove ErrAbortedRPC#978
Conversation
6ef380f to
88074fb
Compare
88074fb to
e2c6d35
Compare
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e2c6d354c5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Removes the ErrAbortedRPC sentinel and the corresponding "decorate err with context cause" plumbing in the v2 client. The client now decides whether to record a failed RPC purely from ctx.Err() (context-cancelled/deadline RPCs are no longer counted as host failures), and callers that still want those treated as failures call the now-public, error-less AddFailedRPC directly. Call sites that previously relied on ErrAbortedRPC to suppress failure accounting are switched to plain WithTimeout/WithCancel, and slabs/downloads.go now manually demotes initial-shard hosts that were cancelled.
Changes:
- Remove
ErrAbortedRPCand simplifyAddFailedRPCto take just a host key. - Replace
WithCancelCause(..., ErrAbortedRPC)/WithTimeoutCause(..., ErrAbortedRPC)with plainWithCancel/WithTimeoutacross slabs and contracts code. - Add
isFailedRPChelper in the client and explicitAddFailedRPCcalls for slow initial shards indownloadShards.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| client/v2/client.go | Adds isFailedRPC; switches deferred accounting to context-based check; updates exported AddFailedRPC to delegate to provider. |
| client/v2/hostqueue.go | Removes ErrAbortedRPC and recordFailure; collapses logic into AddFailedRPC(hostKey). |
| client/v2/hostqueue_test.go | Updates calls to new AddFailedRPC signature. |
| client/v2/rpc_test.go | Removes the TestRPCFnErrorDecoration test and now-unused mocks. |
| contracts/maintenance.go | Switches WithTimeoutCause(..., ErrAbortedRPC) to WithTimeout. |
| contracts/pinning.go | Same conversion for pin timeout. |
| contracts/pruning.go | Same conversion for prune timeout. |
| slabs/dataintegrity.go | Same conversion for integrity-check timeout. |
| slabs/downloads.go | Replaces dual cancel-with-cause contexts with a single WithCancel; manually records a failed RPC for cancelled initial-shard hosts. |
| slabs/manager.go | Adds AddFailedRPC to the HostClient interface. |
| slabs/manager_test.go | Adds no-op mock implementation of AddFailedRPC. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
With
AddFailedRPCbeing exposed now for the Go SDK to use it the pattern we used withErrAbortedRPCbecomes more confusing.To clean this up, this PR removes
ErrAbortedRPCand updates the client to only count failed RPCs if they were not caused by contexts. If they were, the client leaves it up to the caller to know what their intentions were.