Repository navigation
Description
Summary
Substrate models eventual consistency as a first-class, seedable concept (emulator/consistency.go). The SQS plugin, however, makes a just-created queue immediately resolvable by GetQueueUrl. On real AWS there's a brief window where CreateQueue has returned but GetQueueUrl still 400s with NonExistentQueue (create→lookup propagation). A consumer's create-then-open-then-retry loop can't be exercised against Substrate today because the race never happens.
This fits the charter exactly: scope.md calls out "seedable outcomes that let a consumer's poll/retry/wait loop be tested" as in scope. This is that, for the CreateQueue→GetQueueUrl consistency window.
Why this matters (concrete)
In spore-host/spawn#70, a freshly-booted pool worker resolves its run queue via GetQueueUrl right after the submitter's CreateQueue. On real AWS it occasionally hit NonExistentQueue and (originally) exited with no retry. We added a bounded retry in OpenQueue, but couldn't test that retry offline — against Substrate the queue is always instantly visible, so the retry path is never taken in CI. A seedable delay would let the retry logic be regression-tested without a real instance.
Proposed
A seed that makes GetQueueUrl (and optionally GetQueueAttributes) for a given queue name return NonExistentQueue for the first N calls (or until a simulated-clock offset) after its CreateQueue, then resolve normally — mirroring the pattern already used for other seedable outcomes:
- e.g.
POST /v1/sqs/consistency{queue_name, get_url_misses: 3}(or a clock-duration form), and it decrements/expires like the existing consistency model. - Default (unseeded) behavior stays instant-resolve, so existing tests are unaffected.
Acceptance
- With a seeded delay,
GetQueueUrlon a just-created queue returnsNonExistentQueuefor the seeded window, then resolves — so a consumer's retry loop can be tested to succeed within budget and to fail loudly past it. - Unseeded behavior unchanged (instant resolve).
Scope note
Seedable observation of an existing API's eventual-consistency behavior — the same shape as Substrate's existing seedable outcomes. No workload execution.
Reported from spore-host/spawn#70 pooled-execution validation (companion to the OpenQueue retry, spawn#464).
Activity
fix(sqs): raise QueueDoesNotExist, not the legacy NonExistentQueue (#413
scttfrdmn commentedon Aug 1, 2026
Implemented in two PRs — #426 (merged) and #427 (open) — both landing in v0.81.0.
Three decisions here differ from what the issue proposed, so the reasoning is below.
The error code is
QueueDoesNotExist, notAWS.SimpleQueueService.NonExistentQueueThe issue body uses the dotted string, and substrate did emit it — at 14 sites. That
had to be corrected before the seed, or the seed would have reproduced the exact
defect you filed, one layer down: the retry loop still couldn't be written idiomatically,
because the error it needs to catch wasn't catchable.
AWS's GetQueueUrl reference documents the error as
QueueDoesNotExist(HTTP 400); thedotted string appears nowhere in the current API reference. SQS is an
awsQueryCompatibleJSON protocol service, and the dotted form is thequery-compatibility alias, which AWS sends in an
x-amzn-query-errorheader — notin
__type.Verified against both SDKs rather than from memory:
__typesubstrate sendsexceptclauseAWS.SimpleQueueService.NonExistentQueue(before)ClientError—except sqs.exceptions.QueueDoesNotExistnever matchedQueueDoesNotExist(now)QueueDoesNotExistaws-sdk-go-v2/service/sqsagrees: its deserializer dispatches onstrings.EqualFold("QueueDoesNotExist", errorCode), and the dotted string appearsnowhere in the module — so
errors.As(err, &types.QueueDoesNotExist{})nevermatched either.
I deliberately did not add the
x-amzn-query-errorcompat header. BecausewriteErroralready derivesx-amzn-ErrorTypefrom the code, correcting the codefixes both SDKs with no new plumbing; adding the header would need a cross-cutting
change to the shared error type for one service's legacy alias and would still leave
Error["Code"]reading the legacy string. If you have anything matching on the oldstring, that's the one behavior change to know about.
Counts, not durations
You offered "or a clock-duration form" — the seed is counted in misses instead,
and this isn't a shortcut. Substrate's
TimeController.Now()advances with walltime from its baseline; it's not a frozen, manually-stepped clock. A duration seed
would therefore self-expire partway through a test, making "still missing" assertions
wall-clock dependent, which substrate's own testing rules forbid outright. A miss
counter is exactly reproducible: seed 2, and calls 1–2 fail and call 3 succeeds, on
every machine, forever.
Keyed by queue name or the
"*"wildcard.GetQueueUrlandGetQueueAttributesgetindependent counters — your full suggestion; AWS documents
QueueDoesNotExistonboth — so you can exercise one retry loop without perturbing the other. Both default
to 0, so unseeded behavior is unchanged.
Two ordering rules that matter for how you'll write the harness:
CreateQueueis safe and is the natural order; lookups against the still-absentqueue fail but don't spend the budget. Otherwise a pre-create seed would be
silently burned and your retry assertion would mean nothing.
CreateQueue.createQueueis idempotent here, so "after its CreateQueue" is ambiguous whencreate runs twice, and re-arming would make the data path write control-plane state.
Seeds live in the state store, so
POST /v1/state/resetclears them between cases.Full docs in
docs/services.mdunder "Seeding the create-then-lookup consistencywindow".
One thing this does not fix
SQS errors are emitted as JSON regardless of request protocol. Substrate resolves
the error protocol per service and SQS is JSON-RPC, so a query-protocol request gets
a JSON error document rather than the XML
<Error>shape real SQS would return. Itdoesn't affect either SDK — both send JSON — but if you have anything hand-parsing
query-protocol error responses, it will surprise you. Out of scope here; now documented
in
docs/services.md. Say the word if it's blocking and I'll file it.Also noticed while in here
CreateQueuedocumentsQueueDeletedRecently(the 60-second wait after a delete) andQueueNameExists(same name, different attributes).createQueueis unconditionallyidempotent and returns the existing URL regardless of attribute differences, so both
of those consumer error branches are unreachable too — the same shape of problem as
this issue. Filed separately; it can reuse this seed namespace.
test(sqs): a store failure must not read as QueueDoesNotExist (#413)
docs(changelog): note the store-failure vs QueueDoesNotExist distinct…
chore(release): v0.81.0 (#432)
fix(ec2): RunInstances must reject invalid MinCount/MaxCount (#431) (#…
feat(sqs): QueueNameExists on attribute conflict, seedable QueueDelet…
feat(sqs): QueueNameExists on attribute conflict, seedable QueueDelet…
test(elb): cover the account-limit store-failure paths (#885)
test(elb): cover the account-limit store-failure paths (#885)
feat(elb): DescribeAccountLimits answers, with seedable limits (#885) (…