fix(replication): stop gating capabilities on exact contract versions - #216
Merged
Conversation
The console rejected any runtime capability block whose contract_version was not exactly 1. Servers have since bumped the remote target contract to v4 (#6376 disableProxy, #6857/#6860 temporary credentials, #6876 promoting them to writable fields), so normalizeRuntimeCapabilities() dropped the whole snapshot and the bucket replication page rendered "Replication capabilities are unavailable on this server." while replication itself kept working — the capability payload only gates the UI controls, never the replication engine. The contract version describes the *shape* of a capability block, which has been stable since v1; semantics live in `status` and the self-describing `fields` list, which the forms already read per field. Accept any integer version >= 1 and keep failing closed on a missing, zero, negative, fractional or non-numeric version, on an unsupported capability status, and on unknown field names. Also applies to the storage-class block, which had the same exact-match gate and would have broken the same way on its next bump.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
The bucket replication page renders "Replication capabilities are unavailable on this server." against current servers, and the Add / Edit / Delete rule controls are disabled — while replication itself keeps working and objects are replicated normally. The capability payload only gates console UI controls; it never reaches the replication engine.
Root cause:
normalizeRuntimeCapabilities()rejected any capability block whosecontract_versionwas not exactly1. The server has since bumped the remote target contract to v4:disableProxySo
remote_targetsnormalized tonull, the whole snapshot was dropped, and the error alert was shown.The contract version describes the shape of a capability block, which has been stable since v1. Semantics live in
statusand the self-describingfields[].statelist, which both replication forms already read per field. This PR accepts any integer version>= 1and keeps the fail-closed behaviour where it belongs:contract_version→ still rejectedstatus.state !== "supported"→ every field of that feature is still treated as unsupportedunsupportedThe same exact-match gate on the
storage_classesblock is relaxed identically; it would have broken the same way on its next server-side bump.Type of Change
Testing
The pre-existing "fail closed on unknown contract versions" case asserted the buggy behaviour, so it was rewritten into three cases: newer versions are accepted (using the real
remote_targetsv4 /storage_classesv2 shape), invalid versions still fail closed (undefined,0,-1,1.5,"1"), and a missingstorage_classesblock still fails closed.Additionally verified end to end with a payload built from the server's actual v4 field lists (
crates/replication/src/config.rs): capabilities normalize, both forms'requiredBucketFieldsSupported/requiredTargetFieldsSupportedevaluate totrue, andedgeis still reported unsupported — i.e.controlsLockedbecomesfalseand the rule controls are usable again.Checklist
Related Issues
N/A — reported through manual replication testing.
Screenshots (if applicable)
Before: the replication page showed a destructive alert titled "Replication rules unavailable" with the body "Replication capabilities are unavailable on this server.", while the site-replication rule was listed as Enabled and Add / Edit / Delete were greyed out.
Additional Notes
No server-side change is required. This also removes the recurring maintenance trap where every server capability bump silently disables console controls until the console ships a matching release.