The problem
Spate’s S3 crate reads objects from storage into a pipeline. One way it finds them is a storage notification, a JSON message that a store sends to a queue or topic when an object changes. A message can carry several records. The decoder reads each record, drops it or fails the whole message, and anyone who can publish to the queue chooses the bytes it receives.
Nothing was known to be broken, and notifications hadn’t reached a release yet. A
hand probe recorded in the issue found no panic, and unit tests pinned each rule. A
fuzz target is a test that generates its own inputs for as long as it runs, and when
the issue was opened none reached this decoder. s3_unit_decode arrived while my
branch was open. It tried raw bytes and one generated record per run, and checked
only the parts that came back, so a record wrongly dropped or refused went unnoticed.
What I changed
- Added the
s3_notification_decodefuzz target, which buildsRecordsmessages from generated records. Event names, keys, sizes, ETags, versions and re-enqueue counts are drawn from the shapes the decoder treats differently. - Predicted each record’s outcome from how it was built. A message with a failing record must fail, and any other must read exactly the predicted parts, in order.
- Checked every part that’s read. Its key must sit under the source’s prefix and
be one
object_storecan address. Its ETag must be quoted and valid as a header value. - Exported
addressablefromfuzz_seams, a single forwarding call and the only change tospate-s3, so the target asks the same rule the decoder asks.
I ran the target for 300 seconds, which was 586,413 runs with no crash. To check that
it could catch a bug, I lowered the decoder’s versionId cap to 1,000 bytes, and the
target failed within 120 seconds.
Judgement calls
The target predicts outcomes instead of checking properties. A property check only sees what comes back, so it can’t notice a record that vanished. My target starts from the key it means, encodes it and knows what the decoder must return. The cost is that the prediction has to follow the decoder’s order. A zero-size record for another bucket fails its message, while a zero-size record with an unusable key is dropped, because the size check runs first. A decoder change can therefore need a target change, and #1461 needed one three days later.
I left two rules uncopied. addressable is object_store’s rule, so a copy could
drift. ETag validity comes from the http crate, which replaced my first version’s
hand-written check. The target can’t catch a bug in addressable, so that rule still
relies on the listing tests.
I dropped the raw-bytes arm the issue asked for. The issue specified two arms, one
for arbitrary bytes and one for built messages. While my branch was open,
#1344 merged and added
s3_unit_decode, which already fuzzes raw bytes against the same decoder. A second
arm would have repeated that check. The same pull request taught the decoder
versionId and spateReEnqueues, so I extended the target to cover both. That
includes versionId values of 1,000 to 1,049 bytes, either side of the 1,024 cap.
What review changed
Nothing in this pull request changed. The maintainer approved it and left two points for later.
The first was a gap the target shared with the unit tests. With the created-event
check loosened to contains("ObjectCreated:"), the spate-s3 suite still passed and
the target found nothing in two 120-second runs, because it only writes that text at
the start of a name or after one s3:. A name like xObjectCreated:Put would then
read as a created object, though no store sends one. The maintainer filed an issue
and I closed it the same day in
#1364, with three new names in a unit
test. The target itself still reaches such names only by chance.
The second was that the fuzz_seams header doesn’t describe a one-call export like
addressable. The maintainer kept that wording question for themselves.
Outcome
Merged on 24 October 2026, closing #1289. A later decision record, ADR-0082, cites the target among the checks that confirm it.