Skip to content

fix(ilm): preserve lifecycle extension fields - #355

Merged
cxymds merged 2 commits into
mainfrom
cxymds/fix-6334-lifecycle-extensions
Aug 25, 2026
Merged

fix(ilm): preserve lifecycle extension fields#355
cxymds merged 2 commits into
mainfrom
cxymds/fix-6334-lifecycle-extensions

Conversation

@cxymds

@cxymds cxymds commented Aug 25, 2026

Copy link
Copy Markdown
Member

Related Issues

Addresses rustfs/rustfs#6334, where rc bucket lifecycle rule import accepts MinIO-compatible lifecycle extensions but a subsequent export drops them.

Summary of Changes

  • Extend the core lifecycle model and XML codec to preserve ExpiredObjectAllVersions, DelMarkerExpiration, object-size predicates, repeated current/noncurrent transitions, and NewerNoncurrentVersions.
  • Reject contradictory compatibility representations, including explicit DelMarkerExpiration: false combined with an enabled form.
  • Validate lifecycle XML roots and successful response bodies so 2xx S3 <Error> envelopes cannot be treated as empty configurations.
  • Add bounded alias-configured retries for lifecycle GET/PUT, 301/307/308 endpoint redirect handling, region refresh from x-amz-bucket-region, and fresh SigV4 signing for every request.
  • Keep existing CLI read-modify-write operations lossless for extended lifecycle rules.

Verification

  • cargo fmt --all --check
  • git diff --check
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace
  • make pre-commit (workspace formatting, Clippy, tests, and doctests)
  • CARGO_BUILD_JOBS=2 cargo test -p rc-core --lib lifecycle::tests --no-fail-fast
  • CARGO_BUILD_JOBS=2 cargo test -p rc-s3 --lib lifecycle --no-fail-fast
  • CARGO_BUILD_JOBS=2 cargo test -p rustfs-cli --lib lifecycle --no-fail-fast
  • Manual import/export verification against the previously built RustFS main binary at commit 017ffb92f; the fixed client preserves both lifecycle extensions.

Adversarial review verdicts

  • Correctness: PASS — success envelopes, filter predicates, action multiplicity, and compatibility conflicts are validated or preserved.
  • Test coverage: PASS — focused regressions cover each review finding plus retry, dropped connections, redirects, and XML round-trips; workspace tests pass.
  • Compatibility: PASS — legacy prefix/JSON shapes remain accepted; additive fields preserve newer S3/RustFS configurations.
  • Security: PASS — XML roots are validated; redirects reject userinfo, HTTPS downgrade, untrusted hosts, and port changes; cross-authority custom x-amz headers are not forwarded.
  • Concurrency / durability: PASS — PUT retries replay the exact idempotent body and re-sign each attempt; no partial local state is committed.
  • Performance: PASS — lifecycle payloads are bounded configuration XML; retry/redirect loops are bounded and XML parsing overhead is linear.
  • Simplicity: PASS — transport concerns are isolated in lifecycle_xml_request/xml_request_once; no unrelated paths changed.

Impact

  • Lifecycle import, export, list, and update now round-trip RustFS/MinIO delete-all and delete-marker expiration semantics, object-size filters, and all standard S3 lifecycle actions without loss.
  • Existing standard S3 filters/actions remain supported.
  • No RustFS server code, S3 object data, or output schema files are changed.

Risks / Rollback

  • Lifecycle GET/PUT uses a small raw XML path because the AWS SDK model does not expose the RustFS/MinIO extensions; requests remain SigV4-signed, Content-MD5 protected for PUT, and path/DNS-style aware.
  • Redirect targets are restricted to the configured host or recognized S3 provider domains; custom x-amz headers are intentionally withheld across provider authority changes to avoid leaking credential-bearing values.
  • Rollback is a normal client rollback by reverting the new commit; no server-side migration is required.

Comment thread crates/s3/src/lifecycle_xml.rs
Comment thread crates/s3/src/lifecycle_xml.rs
Comment thread crates/s3/src/lifecycle_xml.rs Outdated
Comment thread crates/s3/src/client.rs
Comment thread crates/core/src/lifecycle.rs Outdated
@cxymds
cxymds merged commit 5801a2c into main Aug 25, 2026
17 checks passed
@cxymds
cxymds deleted the cxymds/fix-6334-lifecycle-extensions branch August 25, 2026 06:17
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