Skip to content

Remove ErrAbortedRPC#978

Open
ChrisSchinnerl wants to merge 7 commits into
masterfrom
chris/refactor-download
Open

Remove ErrAbortedRPC#978
ChrisSchinnerl wants to merge 7 commits into
masterfrom
chris/refactor-download

Conversation

@ChrisSchinnerl
Copy link
Copy Markdown
Member

With AddFailedRPC being exposed now for the Go SDK to use it the pattern we used with ErrAbortedRPC becomes more confusing.

To clean this up, this PR removes ErrAbortedRPC and 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.

@ChrisSchinnerl ChrisSchinnerl self-assigned this May 14, 2026
@github-project-automation github-project-automation Bot moved this to In Progress in Sia May 14, 2026
@ChrisSchinnerl ChrisSchinnerl force-pushed the chris/refactor-download branch from 6ef380f to 88074fb Compare May 14, 2026 13:27
@ChrisSchinnerl ChrisSchinnerl force-pushed the chris/refactor-download branch from 88074fb to e2c6d35 Compare May 14, 2026 13:35
@ChrisSchinnerl ChrisSchinnerl marked this pull request as ready for review May 14, 2026 13:39
Copilot AI review requested due to automatic review settings May 14, 2026 13:39
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread client/v2/client.go
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ErrAbortedRPC and simplify AddFailedRPC to take just a host key.
  • Replace WithCancelCause(..., ErrAbortedRPC) / WithTimeoutCause(..., ErrAbortedRPC) with plain WithCancel / WithTimeout across slabs and contracts code.
  • Add isFailedRPC helper in the client and explicit AddFailedRPC calls for slow initial shards in downloadShards.

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.

Comment thread slabs/manager_test.go Outdated
Comment thread slabs/downloads.go Outdated
Comment thread client/v2/client.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants