Skip to content

feat(conformance): support external Object Lock fixtures - #1663

Merged
overtrue merged 1 commit into
mainfrom
p9/1418-external-fixture-object-lock
Nov 27, 2026
Merged

overtrue merged 1 commit into
mainfrom
p9/1418-external-fixture-object-lock

Conversation

@overtrue

Copy link
Copy Markdown
Collaborator

Summary

Completes the final external-fixture slice of #1418 (setup.buckets[].object_lock = true), unblocked by #1512 (d7dbba80):

  • Object Lock bucket setup & readback proofs (crates/conformance/src/conn/external_fixture/object_lock.rs, lifecycle.rs, external_fixture.rs):
    • Creates object_lock = true buckets with x-amz-bucket-object-lock-enabled: true (preserving region XML content-type: application/xml for non-default regions) and strictly verifies both GET /{bucket}?object-lock (<ObjectLockEnabled>Enabled</ObjectLockEnabled>) and GET /{bucket}?versioning (<Status>Enabled</Status>), failing closed with SutError::Refused and rolling back the created bucket on any mismatch or malformed XML.
    • Rejects contradictory or mistyped object_lock declarations (object_lock = true with versioning = "disabled" or absent = true, or non-boolean object_lock/absent) before any remote contact.
    • Tracks setup objects inside Object Lock buckets by exact observed x-amz-version-id via put_fixture_version and treats Object Lock object targets as versioned in is_versioned_object_target so stale keep-alive control sockets never retry PUT and orphan duplicate versions.
  • Write gating, preflight COMPLIANCE protection, and locked cleanup (writes.rs, versioned.rs, object_lock.rs, lifecycle.rs):
    • Read-only Object Lock cases run with --allow-external-fixtures alone and clean up setup versions by exact encoded versionId without governance bypass.
    • Authored writes against Object Lock buckets require --allow-external-writes (excluded from the non-write exact-version shortcut even when versioning = "enabled" is also declared).
    • Under --allow-external-writes, cleanup deletes owned and listed versions in Object Lock buckets with x-amz-bypass-governance-retention: true and, when a Version (never a DeleteMarker) still answers 403, lifts its legal hold (PUT ...?legal-hold&versionId=... with <Status>OFF</Status> and Content-MD5) before retrying DELETE once, failing closed and retaining bucket ownership on any non-204 outcome.
    • Cases whose authored writes would apply irremovable COMPLIANCE object retention (via PutObjectRetention XML, x-amz-object-lock-mode: COMPLIANCE header, PostObject form field, or bucket COMPLIANCE DefaultRetention paired with an object write) are refused at preflight before any remote contact so they never wedge an external endpoint; bucket-only DefaultRetention without object writes remains runnable.
  • Docs & map (conformance/README.md, crates/conformance/MAP.md):
    • Documented external Object Lock fixture support and updated the corpus runnable-share statement from 538 (60.1%) to 537 (60.0%) (verified by writes_tests::the_readme_states_the_externally_runnable_share_of_this_corpus because c-lock-0008 is now skipped at preflight instead of wedging cleanup).

Closes #1418

Live External compat-sut Acceptance

Verified against freshly built compat-sut on an ephemeral port over private temp data directories (process terminated and temp dirs removed after each scenario):

  • Wall-clock read-only (--profile rustfs --allow-external-fixtures --filter c-lock-): 0 prepare/finish failures, c-lock-0028 passed, c-lock-0012/c-lock-0013 reached execute (hitting the rustfs-profile <HostId> error-body difference), remaining_entries=[].
  • Wall-clock writes (--profile rustfs --allow-external-fixtures --allow-external-writes --filter c-lock-): 0 prepare/finish failures, c-lock-0009/c-lock-0027/c-lock-0028 passed, c-lock-0005 (GOVERNANCE) and c-lock-0006 (LegalHold=ON) executed and cleaned up cleanly, c-lock-0008 skipped at preflight, remaining_entries=[].
  • Fixed-clock writes (compat-sut --fixed-time 2026-01-02T03:04:05Z, --endpoint-fixed-time 2026-01-02T03:04:05Z --allow-external-fixtures --allow-external-writes --filter c-lock-): 0 prepare/finish failures, 11 passed (c-lock-0009, c-lock-0027, c-lock-0028, c-lock-0031–c-lock-0035, c-lock-0038, c-lock-0039, c-lock-0041), c-lock-0040/c-lock-0042 multi-version GOVERNANCE/LegalHold cleaned up cleanly, c-lock-0008/c-lock-0036 skipped at preflight, remaining_entries=[].

Mutation Proofs (10/10 Killed, Restored Byte-Identically)

All 13 loopback tests (crates/conformance/src/conn/external_fixture/object_lock_tests.rs, 10 negative / 3 positive) were written TDD red-first (12 failed, 1 two-directional positive control passed) and verified against 10 deliberate red mutations:

  • M1: Omit x-amz-bucket-object-lock-enabled: true on CreateBucket -> killed by read_only_object_lock_setup_proves_lock_and_versioning_and_cleans_exact_version
  • M2: Skip GET ?object-lock readback check -> killed by unproved_object_lock_readback_refuses_and_rolls_back_the_bucket
  • M3: Skip GET ?versioning readback check -> killed by unproved_versioning_readback_after_object_lock_refuses_and_rolls_back_the_bucket
  • M4: Omit x-amz-bypass-governance-retention: true in locked version cleanup -> killed by external_writes_cleanup_bypasses_governance_lifts_legal_hold_and_removes_delete_markers
  • M5: Disable 403 -> PutObjectLegalHold(OFF) recovery -> killed by external_writes_cleanup_bypasses_governance_lifts_legal_hold_and_removes_delete_markers and failed_legal_hold_clear_or_still_forbidden_delete_retains_bucket_ownership
  • M6: Drop is_version guard on 403 legal-hold clear -> killed by delete_marker_403_does_not_attempt_legal_hold_clear_and_retains_bucket_ownership
  • M7: Disable preflight COMPLIANCE refusal in writes.rs -> killed by compliance_object_retention_writes_are_refused_at_preflight_before_contact
  • M8: Allow object_lock = true with versioning = "disabled" in plan() -> killed by object_lock_with_disabled_versioning_or_absent_or_non_bool_is_rejected_before_connecting
  • M9: Drop object_lock exclusion in non-write exact-version preflight -> killed by authored_writes_on_object_lock_bucket_are_refused_without_allow_external_writes
  • M10: Drop owned.object_lock in is_versioned_object_target -> killed by stale_control_socket_does_not_retry_put_to_object_lock_object_target

Verification

  • cargo fmt --all --check — passed
  • cargo clippy --workspace --all-targets -- -D warnings — passed
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps — passed
  • cargo test --workspace — passed (149/149 external_fixture, 24/24 keys, full workspace suite green)
  • cargo xtask verify --crate rustfs-gateway-conformance — passed (prebuild 25.19s, prepared loop 23.59s <= 30s)
  • Static & PR guards — 25/25 passed (check_module_doc 2292/2292, check_license_headers, check_file_size, check_map_files 20/20, check_protected_files, check_corpus_change_reviewed, check_known_diffs_ratchet, etc.)

Checklist

  • English-only source, comments, docs, commit message, and PR description
  • Apache-2.0 headers and three-part module docs on all Rust source files
  • No unsafe, no .unwrap()/.expect() on external input, no secrets logged
  • No Protected Files modified
  • TDD negative-majority tests + mutation verification recorded above
  • Four-command gate and live external compat-sut acceptance passed

Role Verdicts

  • simplicity-adversary: attacked external Object Lock verification, preflight COMPLIANCE guard, locked-version cleanup (crates/conformance/src/conn/external_fixture/object_lock.rs), and lifecycle/writes wiring — no break found
  • test-adversary: attacked the 13 loopback control tests (object_lock_tests.rs, 10 negative / 3 positive), all 10 deliberate red mutations M1–M10, conformance/README.md runnable-share ratchet (537 (60.0%)), and live compat-sut zero-leak acceptance — no break found

Provision setup.buckets[].object_lock = true on external endpoints by
creating buckets with x-amz-bucket-object-lock-enabled: true, verifying
both ?object-lock and ?versioning readback as Enabled (failing closed
and rolling back on refusal), tracking setup object versions by exact
version ID, and treating Object Lock object targets as versioned for
stale control socket retry safety.

Authored writes against Object Lock buckets require
--allow-external-writes, under which cleanup deletes versions with
x-amz-bypass-governance-retention: true and lifts Legal Hold (OFF) on
403 for object versions before retrying DELETE. Cases that would apply
irremovable COMPLIANCE object retention are refused at preflight before
any remote contact so they never wedge a bucket.

Closes #1418
@overtrue
overtrue merged commit 678cb30 into main Nov 27, 2026
34 checks passed
@overtrue
overtrue deleted the p9/1418-external-fixture-object-lock branch November 27, 2026 12:08
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.

conformance: send x-amz-content-sha256 under the rustfs profile, and widen the external fixture scope

1 participant