Skip to content

test(cli): cover rm purge dry-run#110

Merged
overtrue merged 2 commits intomainfrom
codex/rm-purge-dry-run-gap
Apr 19, 2026
Merged

test(cli): cover rm purge dry-run#110
overtrue merged 2 commits intomainfrom
codex/rm-purge-dry-run-gap

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

Summary

This PR adds coverage for a recent rm --purge path that was still untested: running the command with --dry-run against a versioned object. Without this test, the purge feature only had assertions for real deletes, not for the safety path that should avoid both permanent deletion and delete-marker creation.

The branch also adds a minimal root Makefile with a pre-commit target because this repository did not expose make pre-commit, while the documented local validation steps already existed as standalone cargo commands. The new target simply wraps the existing required checks.

Root Cause

The recent purge work added permanent-delete behavior, but the dry-run interaction lived on a separate execution path and did not have focused regression coverage. That left a gap where a future change could accidentally route dry-run purge requests into the destructive path without a targeted test failing.

Fix

The new integration test enables versioning, uploads a single object, runs rc rm --purge --dry-run --json, and then verifies that the object still has exactly one non-delete-marker version. This keeps the scope on the changed rm purge area and exercises the user-visible behavior directly.

Validation

  • cargo test --features integration --test integration option_behavior_operations::test_rm_purge_dry_run_does_not_delete_versioned_object -- --exact --nocapture
  • make pre-commit

@overtrue overtrue marked this pull request as ready for review April 19, 2026 15:00
@overtrue overtrue merged commit c06f49d into main Apr 19, 2026
15 checks passed
@overtrue overtrue deleted the codex/rm-purge-dry-run-gap branch April 19, 2026 15:00
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6455b31fc9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"rm --purge --dry-run must not create a delete marker"
);

cleanup_bucket(config_dir.path(), &bucket_name);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Purge remaining version before cleanup

After asserting --dry-run, this test leaves keep-version.txt in a versioned bucket and then calls cleanup_bucket, which only runs rm --recursive --force and rb (no --purge). In a versioned bucket, that delete path does not remove historical versions, so bucket removal can fail and the test leaks buckets/versions on every successful run; over repeated CI or local runs this can exhaust test resources and cause unrelated integration failures. The same pattern is repeated in the object remove --purge --dry-run test.

Useful? React with 👍 / 👎.

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