Skip to content

test(s3): cover empty delete batch#120

Draft
overtrue wants to merge 1 commit intomainfrom
codex/s3-empty-delete-batch-gap
Draft

test(s3): cover empty delete batch#120
overtrue wants to merge 1 commit intomainfrom
codex/s3-empty-delete-batch-gap

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

Summary

This change adds coverage for a small but important path introduced by the recent delete-options work in the S3 client. When delete_objects_with_options is called with an empty key list, the method should return successfully without constructing or sending an HTTP request.

That behavior matters because the rm purge and batch-delete flow now routes through the new delete-options helper, and empty batches are a legitimate no-op case during prefix cleanup or chunked deletion logic. Without an explicit regression test, a future refactor could accidentally remove the early return and start issuing malformed or unnecessary delete requests.

Root Cause

The implementation already had the correct guard clause for an empty keys vector, but the path was not covered by unit tests. Recent work added option-aware delete wrappers and header mutation logic, increasing the chance that request-building code could be touched again without preserving the no-op behavior.

Fix

Add a focused unit test in crates/s3/src/client.rs that:

  • calls delete_objects_with_options with an empty key list
  • asserts the returned deleted-key list is empty
  • asserts the request capture harness observed no outbound request

Validation

I could not run make pre-commit because this repository does not define that target. I ran the CI-equivalent checks used by the repo instead:

  • cargo test -p rc-s3 delete_objects_with_empty_keys_skips_request
  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace

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