fix(ls): classify version listing backend failures as network#170
Merged
fix(ls): classify version listing backend failures as network#170
Conversation
Contributor
There was a problem hiding this comment.
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/NoSuchBucketlist_object_versions_pageservice failures toError::Network. - Preserve
Error::NetworkasExitCode::NetworkErrorin thels --versionsexit-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.
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.
Background
Recent changes tightened
rc ls --versionsbehavior around missing buckets, but the adjacent generic backend-failure path was still untested.Root Cause
S3Client::list_object_versions_pageconverted non-NotFound service failures intoError::General, and thels --versionsexit-code helper did not preserveError::Networkas a network exit code. That made retryable backend failures look like generic CLI failures.Solution
Return
Error::Networkfor non-missing-bucket list-version service failures and preserve that classification inrc ls --versionsexit-code mapping.Tests
cargo test -p rc-s3 list_object_versions_page --libcargo test -p rustfs-cli ls::tests --libmake pre-commit