Skip to content

test(#756): pin S3's bucket projection and record it - #1350

Merged
scttfrdmn merged 1 commit into
mainfrom
test/756-s3-wire-projections
Oct 3, 2026
Merged

scttfrdmn merged 1 commit into
mainfrom
test/756-s3-wire-projections

Conversation

@scttfrdmn

Copy link
Copy Markdown
Owner

This is the fourth of ten PRs in #756's 3-line block. It is citation only, and writing it
uncovered #1349.

S3 is already projected

S3Bucket declares account_id, region and ever_tagged,omitempty. None of them reaches a body,
because every bucket response is an XML struct declared for its operation. The published members that
sound alike are different names: ListBuckets' BucketRegion and GetBucketLocation's
LocationConstraint. The walk is a case-folded equality, so neither collides.

What the new test asserts

emulator/s3_wire_test.go uses the shared wireAssertNoMemberXML to drive the operations that answer
the bucket record: CreateBucket, PutBucketTagging, HeadBucket, ListBuckets, GetBucketTagging,
DeleteBucketTagging and DeleteBucket.

Two things this test caught

  1. s3: an unrouted bucket sub-resource falls through to DeleteBucket, so DeleteBucketEncryption (and four others) delete the bucket #1349, a data-loss bug, filed. The GetBucketLocation presence anchor read a
    ListBucketResult. The bucket router reaches its defaults by absence: any sub-resource it does
    not list falls through to ListObjects, CreateBucket or DeleteBucket. A probe showed
    DeleteBucketCors, DeleteBucketEncryption, DeleteBucketWebsite, DeleteBucketOwnershipControls
    and DeleteBucketReplication each answer 204 and delete the bucket. That is S3: ?publicAccessBlock is unrouted; PUT hits CreateBucket and DELETE deletes the bucket #446's failure
    again, for every sub-resource S3: ?publicAccessBlock is unrouted; PUT hits CreateBucket and DELETE deletes the bucket #446 did not enumerate. GetBucketLocation is therefore not driven
    here, and a comment points at s3: an unrouted bucket sub-resource falls through to DeleteBucket, so DeleteBucketEncryption (and four others) delete the bucket #1349. The fix is the next PR.
  2. A bug in my own first draft. CreateBucket and PutBucketTagging answer empty bodies, so
    their held body was nil, and the test, which keyed on body == nil, re-issued them as GET / and
    walked ListBuckets in their place. The injection control exposed it. It now keys on the case
    having no method. The earlier wire tests' held bodies are all non-empty, so none of them had this
    problem.

Negative controls (each run, then restored; s3_plugin.go verified diff-free)

  1. Injecting account_id into <Buckets> fails exactly ListBuckets. That is after fixing my
    test; before the fix it also, misleadingly, failed the two held cases.
  2. Dropping the tag write fails at the ever_tagged read-back.

The ratchet

before: 319 declared, 252 projected across 105 records, 9 internal across 6 records, 58 still reachable
after:  319 declared, 255 projected across 106 records, 9 internal across 6 records, 55 still reachable

Verification

All of these pass:

  • make lint: 0 issues.
  • make test: race, -count=1.
  • docs-reference-check docs-versions version-check discarded-unmarshal-check wire-bookkeeping-check operation-catalog-check operation-docs-check.

#756 and #1349 stay open. #1349 gets its own PR next.

S3Bucket declares account_id, region and ever_tagged, and none reaches a
response: every bucket response is an XML struct declared for its operation, and
the published members that sound alike (BucketRegion, LocationConstraint) are
different names.

emulator/s3_wire_test.go drives the operations that answer the bucket, tagging
it and reading ever_tagged back before walking any response. GetBucketLocation is
not driven: ?location is unrouted and falls through to ListObjects, which is how
#1349 was found.

check-wire-bookkeeping goes from 252 projected across 105 records to 255 across
106, and from 58 still reachable to 55.

#756 stays open.
@codecov

codecov Bot commented Oct 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@scttfrdmn
scttfrdmn merged commit 953abad into main Oct 3, 2026
18 checks passed
@scttfrdmn
scttfrdmn deleted the test/756-s3-wire-projections branch October 3, 2026 03:37
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