Skip to content

Fix Object Lock metadata field in site-replication initial sync #76

Closed

Description

@Vonng

Problem

The existing site-replication initial-sync path constructs an Object Lock metadata event with the correct type but puts the payload in the wrong field:

madmin.SRBucketMeta{
    Type:   madmin.SRBucketMetaTypeObjectLockConfig,
    Bucket: bucket,
    Tags:   &objLockStr,
}

The receiver dispatches this type to PeerBucketObjectLockConfigHandler, which reads item.ObjectLockConfig, not item.Tags. The explicit Object Lock XML is therefore absent on receive and the initial-sync operation can report success without applying that metadata.

This was confirmed while adversarially reviewing the per-bucket CORS replication follow-up in #75. It predates #71 and must remain a separate repair.

Required work

  • Reproduce initial sync with non-default Object Lock configuration.
  • Change the sender to populate ObjectLockConfig rather than Tags.
  • Add a transport/apply regression that proves the exact XML reaches PeerBucketObjectLockConfigHandler.
  • Confirm whether MakeBucket's LockEnabled setup masks any subset of this failure and document the difference between enabling lock and replicating retention configuration.
  • Run focused site-replication tests, race tests, full cmd, and remote CI.

Scope boundary

Do not combine this with the CORS #75 branch or a broad site-replication refactor. Fix the incorrect field and the directly affected tests/documentation only.

Activity

  1. added
    bug
    on Aug 28, 2026
  2. Vonng commented on Aug 28, 2026

    @Vonng
    MemberAuthor

    Reproduced diagnosis (pending Fable adversarial review)

    This is confirmed as a real bug on both single-drive and Erasure ObjectLayer backends.

    Additional evidence beyond the original issue:

    • The wrong Tags field appears in two production paths, not one:
      • existing-bucket initial sync in syncToAllPeers;
      • remote repair in healOLockConfigMetadata.
    • PeerBucketMakeWithVersioningHandler(... LockEnabled: true) installs only the minimal ObjectLockEnabled=Enabled XML.
    • A review-only regression used a lock-enabled bucket plus a 30-day GOVERNANCE DefaultRetention document. Feeding the exact current initial-sync/heal event shape returned success but left only the minimal Enabled XML; the default-retention rule never arrived.
    • Normal live PutObjectLockConfig sends ObjectLockConfig correctly, so the failure is scoped to initial sync/new-site onboarding and remote heal after a missed event.

    Provisional repair boundary

    • Fix both Tags assignments to ObjectLockConfig.
    • Keep source-timestamp work in Audit site-replication source timestamps, tombstones, and per-site counters #77 rather than mixing it here.
    • Add a regression that starts from a lock-enabled peer bucket, carries a non-default retention document through the production event-construction path, applies it through PeerBucketObjectLockConfigHandler, and verifies the exact parsed retention configuration.
    • Evaluate a tiny unexported event constructor shared by initial sync and heal so the two same-type call sites cannot drift again; retain it only if the regression can exercise production construction without heavier fake-admin infrastructure.

    No production code has been changed. Final architecture and test shape remain pending the requested multi-round Fable 5 Max challenge; the local Fable quota is currently exhausted.

  3. Vonng commented on Aug 28, 2026

    @Vonng
    MemberAuthor

    Final repair plan after four Opus 5 Max adversarial rounds

    Verdict: PLAN READY.

    Final diagnosis

    The bug is real in two sender paths:

    • existing-bucket initial sync in syncToAllPeers;
    • remote healOLockConfigMetadata.

    Both construct SRBucketMetaTypeObjectLockConfig but put the XML in Tags; the receiver reads ObjectLockConfig and silently no-ops nil. Normal live PutObjectLockConfig is unaffected. A two-backend review test proved that a 30-day GOVERNANCE DefaultRetention document is lost and only the minimal ObjectLockEnabled=Enabled XML remains.

    Normal add-peer topology should self-heal after a healthy heal interval because source CreatedAt is forwarded and the full config wins the normal election. The divergence window is nevertheless compliance-adjacent and unbounded when heal is degraded. Pre-existing same-name bucket adoption has a separate destructive overwrite and is tracked in #78.

    One-commit implementation

    1. Add unexported newSRBucketObjectLockMeta(bucket, encodedConfig, updatedAt) that sets Type, Bucket, ObjectLockConfig, and UpdatedAt.
    2. Use it in both initial sync and remote Object Lock heal. No Object Lock sender in these paths may populate Tags.
    3. Add unexported srObjectLockPayload(item) that returns:
      • item.ObjectLockConfig when present;
      • otherwise legacy item.Tags;
      • otherwise nil.
    4. Use the selector in the admin Object Lock dispatch. This makes new receiver ← old buggy sender work during rolling upgrade; new sender → old receiver already works because old receivers read ObjectLockConfig.

    Tests

    • Table-test payload selection: new style, legacy Tags fallback, both-present priority, both nil.
    • Assert constructor fields directly.
    • JSON round-trip only as protection against madmin field/tag drift; do not claim it detects the original bug.
    • ExecObjectLayerAPITest with LockEnabled: true: apply a non-default 30-day GOVERNANCE document through the selected payload and real PeerBucketObjectLockConfigHandler; assert exact persisted and parsed retention configuration on both backends.
    • Focused normal/race, full cmd, lint, generated/compatibility checks, and remote CI.

    Boundaries

    Rollback is a single commit and changes no storage or public wire schema.

  4. Vonng commented on Aug 29, 2026

    @Vonng
    MemberAuthor

    PR submitted

    PR #89 implements the corrected ObjectLockConfig sender field, rolling-upgrade Tags fallback, signed admin dispatch seam, and live/initial/heal constructor reuse. Dual-backend normal/race and remote-heal transport tests pass locally.

  5. Vonng commented on Aug 29, 2026

    @Vonng
    MemberAuthor

    Resolved by #89. Live, initial-sync, heal, and legacy payload handling now carry ObjectLockConfig correctly, with signed dispatch and compatibility tests. Final main 1be684b passed Go CI, VulnCheck, the full local race suite, and Test Release run 33254848256.

  6. moved this from Backlog to Done in Siloon Aug 29, 2026
  7. self-assigned this
    on Sep 15, 2026
  8. added theissue type on Sep 15, 2026
  9. added this to the 20260903 milestone on Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions