refactor(sqs): extract create_queue validation and redrive-policy helpers#328
Merged
vieiralucas merged 1 commit intomainfrom Apr 13, 2026
Merged
refactor(sqs): extract create_queue validation and redrive-policy helpers#328vieiralucas merged 1 commit intomainfrom
vieiralucas merged 1 commit intomainfrom
Conversation
…pers create_queue had three inline validation blocks that each deserved to be its own function: - DelaySeconds (0–900) and MaximumMessageSize (1024–1 MiB) validation: now validate_create_queue_attributes. - RedrivePolicy JSON parsing (the 12-line closure that pulled deadLetterTargetArn and a maxReceiveCount coerced from either a number or a string): now parse_redrive_policy. - RedrivePolicy target validation (DLQ must exist, and a FIFO source cannot use a standard DLQ): now validate_redrive_policy_target. create_queue itself gets 80 lines shorter. No behavior change — same AwsServiceError codes, same messages (including the AWS.SimpleQueueService.NonExistentQueue x-amzn-query-error header on the DLQ-not-found path), same order.
vieiralucas
added a commit
that referenced
this pull request
Apr 13, 2026
…Input The two longest functions in the SSM sub-modules were create_patch_baseline (~150 lines) and create_association_inner (~162 lines). Both were dominated by body parsing, field validation, and field extraction — with the actual state mutation only in the last 30-40 lines. This extracts dedicated *Input structs with from_body() constructors, leaving each function focused on idempotency, ID generation, and struct assembly. Same pattern as PRs #324/#328/#338/#355/#356.
2 tasks
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.
Summary
`create_queue` had three inline validation blocks that each deserved to be its own function:
`create_queue` itself gets 80 lines shorter. No behavior change — same `AwsServiceError` codes, same messages (including the `AWS.SimpleQueueService.NonExistentQueue` `x-amzn-query-error` header on the DLQ-not-found path), same order.
Test plan
Summary by cubic
Refactored
fakecloud-sqsto extractcreate_queuevalidation and redrive-policy logic into small helpers, making the function ~80 lines shorter with no behavior changes.DelaySecondsandMaximumMessageSizechecks tovalidate_create_queue_attributes.parse_redrive_policyto parse JSON and coercemaxReceiveCountfrom string or number.validate_redrive_policy_targetto verify DLQ exists and enforce FIFO-to-FIFO, preserving existing error codes/messages and thex-amzn-query-errorheader.Written for commit 1fb1111. Summary will update on new commits.