Skip to content

SQS: CreateQueue never raises QueueDeletedRecently or QueueNameExists #429

Closed

Description

@scttfrdmn

Noticed while implementing #413. Same shape of problem: a documented AWS error branch
a consumer cannot reach, so their handling of it is untestable and any test asserting
on it passes vacuously.

What AWS documents on CreateQueue

  • QueueDeletedRecently — "You must wait 60 seconds after deleting a queue before
    you can create another queue with the same name."
  • QueueNameExists — a queue with that name already exists, with a different set
    of attributes than the ones requested.

What substrate does

createQueue is unconditionally idempotent: it early-returns the existing queue's URL
regardless of whether the requested attributes differ, and it retains no memory of a
recent delete. So both error paths are unreachable, and a consumer's retry-after-delete
loop or attribute-conflict handler can never be exercised offline.

Note the AWS nuance for QueueNameExists: creating a queue with the same name and the
same attributes is idempotent and returns the existing URL. The current behavior
is correct for that case and must stay that way — only the differing-attributes case
should error.

Proposed shape

Reuse the sqs-ctrl seed namespace and control-plane pattern from #413 (#427):

  • QueueDeletedRecently — seedable, counted in misses rather than measured as
    a duration, for the same reason SQS: seedable eventual-consistency delay on GetQueueUrl after CreateQueue #413 is: TimeController.Now() advances with wall
    time from its baseline, so a duration-based window would make assertions wall-clock
    dependent, which substrate's testing rules forbid. POST /v1/sqs/deleted-recently
    with {"queueName":..,"misses":N}, or an extra counter on the existing
    sqsConsistencySeed.
  • QueueNameExists — not seeded. This one is deterministic from state: compare
    the requested attributes against the existing queue's and raise it when they differ.
    It needs no seed because the condition is observable, which also makes it the more
    valuable half.

Both codes are documented as HTTP 400. Worth checking the exact code strings against
the current API reference before implementing — #413 turned up that substrate had been
emitting a legacy alias (AWS.SimpleQueueService.NonExistentQueue) that no current SDK
dispatches on, so the assumption isn't safe here either.

Acceptance criteria

  • CreateQueue with an existing name and differing attributes raises
    QueueNameExists; same-name-same-attributes stays idempotent (regression test).
  • Which attribute differences count is decided and documented — at minimum whether
    unspecified attributes are treated as "no opinion" or as their defaults.
  • QueueDeletedRecently is seedable and count-based; unseeded behavior unchanged.
  • Error codes and HTTP status verified against the current CreateQueue API
    reference, not assumed.
  • Tests under both query and JSON protocols.
  • docs/services.md SQS section updated, including the seed curl examples.

Activity

  1. added
    type: feature
    priority: medium
    on Aug 1, 2026
  2. added this to the v0.83.0 milestone on Aug 1, 2026
  3. scttfrdmn commented on Aug 1, 2026

    @scttfrdmn
    OwnerAuthor

    Shipped in v0.83.0 (go get github.com/scttfrdmn/[email protected]).

    The release notes and CHANGELOG.md record the reasoning behind each decision, including where substrate deliberately stops short of what was suggested here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: sqspriority: mediumtype: feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions