Skip to content

fix(ls): classify version listing backend failures as network#170

Merged
overtrue merged 1 commit intomainfrom
codex/test-list-versions-generic-error
May 5, 2026
Merged

fix(ls): classify version listing backend failures as network#170
overtrue merged 1 commit intomainfrom
codex/test-list-versions-generic-error

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

@overtrue overtrue commented May 5, 2026

Background

Recent changes tightened rc ls --versions behavior around missing buckets, but the adjacent generic backend-failure path was still untested.

Root Cause

S3Client::list_object_versions_page converted non-NotFound service failures into Error::General, and the ls --versions exit-code helper did not preserve Error::Network as a network exit code. That made retryable backend failures look like generic CLI failures.

Solution

Return Error::Network for non-missing-bucket list-version service failures and preserve that classification in rc ls --versions exit-code mapping.

Tests

  • cargo test -p rc-s3 list_object_versions_page --lib
  • cargo test -p rustfs-cli ls::tests --lib
  • make pre-commit

@overtrue overtrue marked this pull request as ready for review May 5, 2026 09:14
Copilot AI review requested due to automatic review settings May 5, 2026 09:14
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

This PR aligns rc ls --versions error classification with other listing paths by treating non-missing-bucket backend failures as retryable network errors and ensuring the CLI returns the corresponding network exit code.

Changes:

  • Map non-NotFound/NoSuchBucket list_object_versions_page service failures to Error::Network.
  • Preserve Error::Network as ExitCode::NetworkError in the ls --versions exit-code mapping.
  • Add targeted unit tests in both the S3 client and CLI to cover the new behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
crates/s3/src/client.rs Classifies non-missing-bucket list-version service failures as Error::Network and adds a regression test for 500/InternalError mapping.
crates/cli/src/commands/ls.rs Maps Error::Network to ExitCode::NetworkError for version listing and adds a unit test for the mapping.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@overtrue overtrue merged commit 1393463 into main May 5, 2026
19 checks passed
@overtrue overtrue deleted the codex/test-list-versions-generic-error branch May 5, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants