Repository navigation
fix(sqs): harden delayed long-poll, attribute MD5, and host-derived queue URLs - #1
Merged
Conversation
Audit of the content-image-demand SQS sender path (Kotlin SqsSenderService awsJson1.0 SendMessage + its integration wiring, and the cid-emissions Rust SqsTransport wire payloads) found three gaps; this fixes them: - ReceiveMessage long-poll now wakes when delayed messages become visible: queue-level DelaySeconds + WaitTimeSeconds long-polls previously slept to the deadline and missed the message. - SendMessage/SendMessageBatch now return the canonical SQS MD5OfMessageAttributes (sorted names, 4-byte big-endian length prefixes, 0x01 String / 0x02 Binary transport bytes), and the JSON batch handler no longer drops entry MessageAttributes. - CreateQueue/GetQueueUrl/ListQueues queue URLs follow the request Host header instead of a hardcoded localhost:4566 (LocalStack parity), so SDKs inside containers keep the returned URLs usable. Adds CID-shaped compat tests (create-with-delay + GetQueueUrl + send through a real-AWS-shaped queue URL + delayed long-poll receive + purge/empty-poll, attribute MD5 vectors, batch attributes, Host-header URLs) and engine unit tests for the attribute digest and queue-URL resolution.
ehlerst
approved these changes
Nov 21, 2026
ehlerst
left a comment
Owner
There was a problem hiding this comment.
Reviewed, compiled, tested, and benchmarked locally:
cargo fmt --all -- --check: passRUSTFLAGS="-D warnings" cargo clippy --workspace --all-targets --all-features: passcargo test --workspace --all-targets --all-features: all tests pass (including the 4 new SQS compat tests and 2 new unit tests)- Independently verified the AWS canonical
MD5OfMessageAttributestest vectors - Benchmarks (
ruststack-benchmarks --service sqs+ Criterionsqs_benchvsmain): zero regressions (receive_and_delete_10-4.8%, all other ops within noise, A/A+ ratings maintained)
Merging.
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.
SQS Hardening
Fixes
ReceiveMessagemissed delayed messages. With queue-level or per-messageDelaySecondsand aWaitTimeSecondslong poll, the poll loop only re-scanned on new-send notifications, so delayed messages becoming visible mid-poll were not picked up until the next call. The loop now also wakes at the earliest futurevisible_at.MD5OfMessageAttributes.SendMessage/SendMessageBatch(JSON and query) now return SQS's canonical message-attribute digest (attributes sorted by name; per attribute: 4-byte big-endian length + name, length +DataType, transport byte0x01String /0x02Binary, length + value). The JSONSendMessageBatchhandler also previously dropped entryMessageAttributes— now parsed, stored, echoed on receive, and digested per batch entry.http://localhost:4566/<acct>/<name>.CreateQueue/GetQueueUrl/ListQueuesnow build URLs from the request'sHostheader (LocalStack parity), so SDKs pointed at the emulator on a container host or non-default port keep the returned URLs usable; falls back to the previous default when noHostheader is present. Queue lookup remains name-based, so previously issued URLs and AWS-shaped URLs keep working.Tests
test_sqs_delayed_long_poll_lifecycle_on_json_protocol— end-to-end JSON lifecycle: create-with-DelaySeconds,GetQueueUrl,SendMessagethrough an AWS-shaped URL, delayed-message long-poll receive, purge + empty long-poll.test_sqs_send_message_attributes_canonical_md5— attribute MD5 digest asserted against reference vectors, plus attribute round-trip on receive.test_sqs_send_message_batch_keeps_attributes— batch entry attributes are kept and reported with their canonical digest.test_sqs_queue_urls_follow_request_host— queue URLs reflect the requestHostheader; cross-host queue addressing still resolves.calculate_message_attributes_md5andresolve_queue_name.