Repository navigation
fix(mcp): confirm a bucket's Object Lock state instead of matching error messages - #65
Merged
houseme merged 1 commit intoNov 27, 2026
Conversation
…ror messages The object lock reads treated an InvalidRequest as "nothing applies" only when its message contained "ObjectLockConfiguration". Checked against the backends' sources, that matched one of the answers that matter: - AWS S3 words the refusal of a bucket without Object Lock "Bucket is missing Object Lock Configuration", which the check never matched - RustFS answers two InvalidRequest messages for two bucket states (rustfs/rustfs#9654); "Object Lock is not enabled for this bucket" was not matched either - MinIO answers a missing bucket with the same InvalidRequest it uses for a bucket without Object Lock, so a read of an object in a bucket that does not exist was reported as "no retention" - Decide by error code and confirm with the bucket: on InvalidRequest the reads now get the bucket's Object Lock configuration, and only a bucket confirmed to have Object Lock disabled turns the refusal into "nothing applies". A bucket that has Object Lock leaves the refusal an error, and so does one whose configuration cannot be read - with the failed read as part of the message - get_object_retention and get_object_legal_hold report why nothing applies, version or bucket, and their note says so: a model then knows that put_object_retention cannot help before it tries - get_bucket_lock_configuration: AWS S3, MinIO, and RustFS all answer ObjectLockConfigurationNotFoundError for a bucket without Object Lock; NoSuchObjectLockConfiguration is kept as a second accepted spelling only, and the README and CHANGELOG no longer claim it is what AWS S3 and MinIO answer - An in-process S3 endpoint (std::net, tests only) scripts the answers of the three backends, so the lock reads run through the real SDK error parsing. Its matrix fails on the previous logic for exactly the three cases above
This was referenced Nov 27, 2026
zhi22915
added a commit
to zhi22915/mcp
that referenced
this pull request
Nov 27, 2026
houseme
pushed a commit
that referenced
this pull request
Nov 27, 2026
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.
Follow-up to #60. Part of a series of three follow-ups to #60/#61/#62 (this PR, then the replication one, then the request payment one). The branches are stacked, so they merge cleanly in any order.
What was wrong in #60
#60 treated an
InvalidRequeston an object-level lock read as "nothing applies" only when its message containedObjectLockConfiguration. Checked against the backends' sources and documentation, that matched one of the answers that matter:GetObjectRetention/GetObjectLegalHoldfor a bucket with Object Lock disabled400 InvalidRequest—Bucket is missing Object Lock Configuration400 InvalidRequest—Bucket is missing ObjectLockConfiguration400 InvalidRequest—Bucket is missing ObjectLockConfiguration, orObject Lock is not enabled for this bucketfor a stored configuration that is not enabledInvalidRequest, before it looks the object up, so a read of an object in a bucket that does not exist was reported as "no retention".NoSuchObjectLockConfigurationfor the bucket-level read. They answerObjectLockConfigurationNotFoundError, the code v0.9.0 already handled.What changes
InvalidRequestthe reads now fetch the bucket's Object Lock configuration, and only a bucket confirmed to have Object Lock disabled turns the refusal into "nothing applies". A bucket that has Object Lock leaves the refusal an error, and so does one whose configuration cannot be read — with the failed read as part of the message. No message text is matched any more.get_object_retentionandget_object_legal_holdreport whether the version or the bucket is the reason, so a model knows thatput_object_retentioncannot help before it tries.get_bucket_lock_configurationkeeps acceptingNoSuchObjectLockConfigurationas a second spelling, and the README and CHANGELOG no longer claim it is what AWS S3 and MinIO answer.Test harness
The data layer had no test that went through the SDK's error parsing — which is how the wrong codes and wordings went unnoticed. This PR adds an in-process S3 endpoint for tests (
src/s3_client/fake_s3.rs,std::netonly, no new dependency): it answers scripted responses and records what the client sent. The lock reads now run against it with the answers of the three backends.With the #60 logic put back in place temporarily, the matrix fails for exactly the three cases above:
Verification
cargo fmt --all -- --check,cargo clippy --all-targets --locked -- -D warnings(default and--features io-uring),cargo test --locked --all-targets— 295 passed