Skip to content

test(s3): skip request for empty delete batch#86

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

test(s3): skip request for empty delete batch#86
overtrue wants to merge 1 commit intomainfrom
codex/test-empty-delete-batch-gap

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

@overtrue overtrue commented Apr 4, 2026

Summary

A recent delete-options refactor introduced an early return in delete_objects_with_options for empty batches. That branch is important because recursive delete flows can legally produce no keys after listing, and the client should return success locally instead of attempting an unnecessary S3 request.

This change adds one focused unit test in crates/s3/src/client.rs that calls delete_objects_with_options with an empty key list, asserts the returned deleted list is empty, and verifies that no HTTP request is emitted through the capture client. Production code is unchanged.

Root Cause

The recent rm --purge work added targeted coverage for header handling on delete requests, but it did not cover the new no-op branch inside the batch delete helper. That left a regression window where a future refactor could accidentally send an empty delete request even when the function is supposed to short-circuit.

Validation

I attempted to run make pre-commit, but this repository does not define that target in the current checkout (make: *** No rule to make target 'pre-commit'. Stop.). I then ran the repository's required validation commands directly:

  • cargo test -p rc-s3 delete_objects_with_empty_keys_skips_request
  • cargo fmt --all --check
  • cargo clippy --workspace -- -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