Skip to content

feat(sqs): implement message-move tasks#697

Merged
vieiralucas merged 3 commits intomainfrom
worktree-worktree-sqs-message-move
Apr 23, 2026
Merged

feat(sqs): implement message-move tasks#697
vieiralucas merged 3 commits intomainfrom
worktree-worktree-sqs-message-move

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Apr 23, 2026

Summary

  • Add StartMessageMoveTask, CancelMessageMoveTask, ListMessageMoveTasks with real state mutation: drains source DLQ messages and routes them to the destination ARN or back to redrive sources.
  • New MessageMoveTask state record per account; tasks complete synchronously so cancel of a finished task returns UnsupportedOperation per AWS semantics.
  • SQS conformance: 20/23 -> 23/23 (100%); workspace baseline gains 70 passing variants.

Test plan

  • cargo test -p fakecloud-conformance --test sqs
  • cargo run -p fakecloud-conformance -- run --services sqs -> 23/23 OK
  • cargo run -p fakecloud-conformance -- audit -> PASS
  • cargo run -p fakecloud-conformance -- check -> PASS
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo fmt --check

Summary by cubic

Implements SQS message-move tasks in fakecloud-sqs (StartMessageMoveTask, ListMessageMoveTasks, CancelMessageMoveTask) and fixes query-protocol parsing for numeric params so SDKs like boto3 work. DLQ messages are moved synchronously to a destination or back to redrive sources; SQS conformance now passes 23/23.

  • New Features

    • StartMessageMoveTask: validate SourceArn is a DLQ; validate optional DestinationArn; enforce MaxNumberOfMessagesPerSecond (1–500); block concurrent tasks; drain DLQ and move messages; returns a handle; completes immediately.
    • ListMessageMoveTasks: filter by SourceArn; newest first; respect MaxResults (1–10); returns status, counts, timestamp; shows TaskHandle only while RUNNING.
    • CancelMessageMoveTask: cancel only RUNNING; return ApproximateNumberOfMessagesMoved; return UnsupportedOperation if not RUNNING.
  • Bug Fixes

    • Parse MaxNumberOfMessagesPerSecond and MaxResults from query strings; add tests for query-protocol parsing, range checks, DLQ-only source, explicit destination drain and unknown destination, already-running guard, unknown source/handle, cancel RUNNING vs completed, and MaxResults 10-cap with TaskHandle hidden when completed.

Written for commit c308b84. Summary will update on new commits.

Synchronously drains source-queue messages on StartMessageMoveTask,
redirecting them to the specified destination ARN or round-robin
back to the queues that name the source as their DLQ. Tasks land in
COMPLETED status immediately, so CancelMessageMoveTask returns
UnsupportedOperation for finished work and ListMessageMoveTasks
returns up to MaxResults entries newest-first.

Closes the SQS conformance gap to 23/23 (100%).
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 23, 2026

Codecov Report

❌ Patch coverage is 91.26712% with 51 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/fakecloud-sqs/src/service.rs 91.81% 47 Missing ⚠️
crates/fakecloud-sqs/src/state.rs 60.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 4 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="crates/fakecloud-sqs/src/service.rs">

<violation number="1" location="crates/fakecloud-sqs/src/service.rs:2891">
P2: `MaxNumberOfMessagesPerSecond` is parsed with `as_i64()` only, so query-protocol string values are ignored, and the early `i64 -> i32` cast can wrap before validation.</violation>

<violation number="2" location="crates/fakecloud-sqs/src/service.rs:3085">
P2: `MaxResults` parsing ignores query-protocol string values, so list operations default to 1 result even when callers pass `MaxResults`.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread crates/fakecloud-sqs/src/service.rs Outdated
Comment thread crates/fakecloud-sqs/src/service.rs Outdated
…rings

Cubic flagged that StartMessageMoveTask and ListMessageMoveTasks parsed
their integer params with as_i64() only, so Query-protocol callers
(boto3) — which encode integers as strings — silently fell back to
defaults. Switch both to val_as_i64, which already handles number-or-
string. Defer the i64 -> i32 cast on the per-second rate until after
range validation so out-of-i32 inputs can't wrap before the check.

Adds unit coverage for query-protocol parsing, range validation, DLQ
gate, unknown-source / unknown-handle / completed-task error branches.
Adds tests for explicit destination drain, unknown destination ARN,
already-running task guard, cancellation of a Running task, and
ListMessageMoveTasks 10-cap with TaskHandle hidden on Completed entries.
Lifts patch coverage above the project baseline.
@vieiralucas vieiralucas merged commit 9a27736 into main Apr 23, 2026
48 checks passed
@vieiralucas vieiralucas deleted the worktree-worktree-sqs-message-move branch April 23, 2026 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant