Skip to content

test(formatter): cover conflict and network inference#124

Draft
overtrue wants to merge 1 commit intomainfrom
codex/formatter-error-metadata-gaps
Draft

test(formatter): cover conflict and network inference#124
overtrue wants to merge 1 commit intomainfrom
codex/formatter-error-metadata-gaps

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

Summary

This change adds focused formatter tests for two message-inference branches introduced by the recent structured error handling work: conflict classification and retryable network classification.

Without these assertions, the formatter coverage only exercised not-found and usage inference from free-form messages, leaving recent conflict and transient-network heuristics unguarded against regression.

Root Cause

The formatter infers JSON error metadata from raw error strings, but the unit tests did not cover the branches that map messages containing destination conflicts or temporary service/network failures.

Fix

Add two unit tests in crates/cli/src/output/formatter.rs that assert:

  • conflict messages produce error_type = "conflict", are not retryable, and carry the conflict suggestion
  • temporary availability/network messages produce error_type = "network_error", are retryable, and carry the network suggestion

Validation

  • cargo test -p rustfs-cli output::formatter::tests
  • cargo fmt --all --check
  • cargo clippy --workspace -- -D warnings
  • cargo test --workspace

Note

make pre-commit could not be run because this checkout does not contain a Makefile or a pre-commit target on origin/main.

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.

1 participant