Repository navigation
Description
Follow-up from #461, which made message attributes round-trip. Both rules below are reachable now that attributes are stored.
The gaps
The SQS developer guide's Message metadata → Message attributes page states three constraints substrate does not enforce:
- At most 10 attributes per message. SQS: message attributes are measured but not stored or returned #461 has a test asserting a 10-attribute message is accepted (the boundary), but an 11th is accepted too. Real SQS rejects it.
- Reserved name prefixes. A name may not start with
AWS.orAmazon.— those are reserved for AWS use. - Name character and shape rules. Names may contain alphanumerics, hyphen, underscore and period only; may not start or end with a period; may not contain two consecutive periods; and are limited to 256 characters. Names are case-sensitive and must be unique within a message.
There is also a fourth, related to DataType rather than the name: the type must be one of String, Number, Binary or one of those with a custom suffix. Number in particular is documented as having to be a valid numeric value.
Provenance to establish first
The SendMessage reference's Errors section documents InvalidMessageContents and UnsupportedOperation but does not name the error for any of these. #454 and #461 hit the same wall — the codes and messages have to come from captured real-AWS responses or from independent reimplementations emitting identical strings, and whichever it is must be stated plainly rather than implied to be a doc citation. Do not guess a code.
Acceptance criteria
- An 11-attribute message is rejected with the real code, message and HTTP status; provenance stated
- A name starting with
AWS.orAmazon.is rejected; the check is case-sensitive or case-insensitive per observed behaviour, not per assumption - A name with a leading period, trailing period, two consecutive periods, an illegal character, or over 256 characters is rejected
- A
Numberattribute whose value is not numeric is rejected - The rules apply to
SendMessageand eachSendMessageBatchentry, with the batch's per-entry error shape (BatchResultErrorEntry) rather than a whole-request failure where AWS uses one - The 10-attribute boundary test from SQS: message attributes are measured but not stored or returned #461 still passes
-
docs/services.md— the two "not enforced" limits under §Message attributes are replaced
Activity
scttfrdmn commentedon Aug 2, 2026
Shipped in v0.86.0 (#485). Two findings worth recording, one of which is a trap.
The
AWS./Amazon.prefix check is case-INsensitive — the opposite of #452'saws:tagrule. The SQS developer guide says an attribute name "can't start with
AWS.orAmazon.(or any casing variations)", and LocalStack matches its regex againstname.lower(). EC2 tags are the other way:AWS:foois an ordinary user tag and #452established that deliberately. Both are correct, because the two services document
different rules — so the two checks are not shared, and both code comments say why. A
reader who knows one and assumes the other will get it backwards, which is exactly what the
aws.fooandAwS.footest rows exist to catch.The 10-attribute rejection has no captured code or message anywhere. "Each message can
have up to 10 attributes" is documented, but the rejection is not:
SendMessage's Errorssection names neither, the API model carries nothing, and neither moto nor LocalStack
enforces the count at all — which is likely why substrate accepting an eleventh attribute
went unnoticed until #461 made attributes observable. So substrate emits
InvalidParameterValue(inferred from the sibling attribute rules, which LocalStack reportsunder that code) with its own message text interpolating the count and the limit. That
provenance is labelled as inferred in the code, the CHANGELOG and
docs/services.md.It is the weakest claim in the change and is marked as such.
Everything else has a source. The name and type messages are LocalStack's verbatim,
snapshot-tested against real AWS — including the trailing space and the odd "upper and lower
score characters" phrasing, reproduced exactly, with a comment warning against "fixing"
them. Two guide rules needed separate handling: sequential periods pass the character class
(
..matches^[a-zA-Z0-9_.-]*$), so there is an explicit check; and uniqueness within amessage is structural, since attributes arrive as a Go map.
Numbervalue validation is implemented, since aNumberattribute holding"abc"isexactly the silent-success shape this tracker exists to close. The guide bounds it precisely
(38 digits of precision, 10^-128 to 10^+126) while LocalStack validates only the character
set, so the range check is substrate's own and the bounds are computed exactly rather than
via float64 —
1e126as a float64 is not 10^126, and there is a mutation test for that.SendMessageBatchreports per-entry failures at HTTP 200 withSenderFault: true,which required adding the
BatchResultErrorEntrytype substrate never had (both batch pathsemitted empty
Failedplaceholders). That is deliberately different from the batch sizecheck ten lines away, which fails the whole request:
BatchRequestTooLongis a documentedwhole-request error about the aggregate, while an attribute violation belongs to one entry.
A message written into state before these rules existed is still returned as stored, because
withholding it would make a recorded run unreplayable. Tracked in #491.