Skip to content

Feat/adding UI for aws sqs#142

Open
ingluisfelipemunoz wants to merge 9 commits into
floci-io:mainfrom
ingluisfelipemunoz:feat/adding-ui-for-aws-sqs
Open

Feat/adding UI for aws sqs#142
ingluisfelipemunoz wants to merge 9 commits into
floci-io:mainfrom
ingluisfelipemunoz:feat/adding-ui-for-aws-sqs

Conversation

@ingluisfelipemunoz

@ingluisfelipemunoz ingluisfelipemunoz commented Jul 18, 2026

Copy link
Copy Markdown

Summary

Adds Amazon SQS as a new Cloud Explorer service (queue), including a
dedicated Amazon-Console-style "send and receive messages" flow view.

  • Backend (packages/api): new queue CloudServiceType, AwsQueueAdapter
    (@aws-sdk/client-sqs) implementing list/get/create/delete plus
    sendMessage/receiveMessages/deleteMessage/purgeQueue, queueSchema.ts,
    and the matching /api/clouds/aws/services/queue/... routes
    (.../messages, .../messages/delete, .../purge). Registered in
    cloudProxy.ts and CloudProxyService.ts following the existing SPI pattern.
  • Frontend (packages/frontend): queue wired into CloudServiceType,
    the Cloud Explorer nav/routing, and DynamicResourceView. New
    QueueFlowPanel component renders a Producer → Queue → Consumer flow
    diagram with live message-count badges, animated connectors, a
    dead-letter-queue branch when a redrive policy is set, a send-message form
    (body + message attributes), and a receive/poll panel with per-message
    delete (ack). Also fixed the queue card on the Cloud Console home page
    (useCloudConsoleHomeData), which previously pointed at a nonexistent
    /queue route with a placeholder icon and no resource count.
  • Review fixes: list() now follows ListQueuesCommand's NextToken
    instead of silently dropping queues past the first page; sendMessage
    requires and forwards MessageGroupId/MessageDeduplicationId for FIFO
    queues (previously every FIFO send was rejected by SQS), with matching
    fields added to QueueFlowPanel; a malformed RedrivePolicy attribute no
    longer throws and breaks list()/get() for every queue; the purge
    confirmation now has a Cancel option; message-attribute rows are keyed by
    a stable id instead of array index; and the receive mutation is now scoped
    to the queue it targeted (a stale long-poll response could otherwise leak
    messages into a different queue's list) and dedupes by message id instead
    of receipt handle (which changes on SQS redelivery).

Closes #77, closes #65

Type of change

  • Bug fix (fix:)
  • New feature / service UI (feat:)
  • Breaking change (feat!: or fix!:)
  • Docs / chore

Area

  • Frontend (packages/frontend)
  • API / Cloud Proxy (packages/api)
  • Cloud Explorer adapter / schema
  • Build / CI / Docker

Verification

Tested against AWS SQS via a local Floci core (:4566), both directly via
curl against the API routes and end-to-end through the UI:

  • Created a queue, sent a message, polled/received it, deleted (acked) it,
    and purged the queue — confirmed message counts (Available/In flight/
    Delayed) update on the flow diagram.
  • Verified the Cloud Console home page's Queue card now shows a live count
    and routes to /cloud-explorer/aws/queue.
  • Verified the FIFO fix directly: creating a .fifo queue and sending
    without a messageGroupId now returns 400 messageGroupId is required...,
    and sending with one succeeds (201).
  • Verified the receive-mutation fix against a queue pre-loaded with several
    messages: polling renders all received message bodies with their receive
    counts, live counts update (Available/In flight), and deleting a
    message removes it from the list while the rest correctly return to
    Available after their visibility timeout.

Checklist

  • pnpm lint, pnpm type-check, pnpm test, and pnpm build pass locally
  • New or updated tests added where it makes sense (bun test in packages/api)
  • No fake/mock data added — unwired states stay empty or show an explicit placeholder
  • Commit messages / PR title follow Conventional Commits

@greptile-apps

greptile-apps Bot commented Jul 18, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds Amazon SQS as a fully-integrated "Queue" service in the Cloud Explorer, covering the backend adapter, schema, API routes, frontend client methods, nav wiring, and a bespoke QueueFlowPanel component that visualises the Producer → Queue → Consumer flow with live message-count badges, a send-message form (with FIFO support), a poll/receive panel, per-message delete, and purge.

  • Backend: AwsQueueAdapter implements list (with paginated NextToken loop), get, create, delete, sendMessage (FIFO-validated), receiveMessages, deleteMessage, and purgeQueue; new Hono routes for the message/purge sub-resources are registered before the generic SPI routes to avoid shadowing.
  • Frontend: QueueFlowPanel drives all queue-specific interactions via React Query mutations; the queueId-guarded onSuccess guard and deduplication-by-id fix the previously reported stale-receive race; the purge flow now shows a Cancel button; attribute rows use a stable row.id key; and useCloudConsoleHomeData replaces the placeholder Queue card with a live resource count and correct route.

Confidence Score: 5/5

Safe to merge; all previously raised issues have been addressed and no new functional defects were found.

The adapter correctly paginates ListQueues, safely parses RedrivePolicy, validates messageGroupId for FIFO queues, and surfaces the cancel path for purge. The receive mutation guards against stale responses from a prior queue, attribute rows use stable ids, and the queue card on the home page now resolves to a live count and a real route. The one gap is that delete-mutation errors are not shown to the user, which is a UX omission with no data-safety impact.

No files require special attention.

Important Files Changed

Filename Overview
packages/api/src/adapter-aws/AwsQueueAdapter.ts New adapter implementing the full SQS surface; NextToken pagination, FIFO validation, safe JSON parsing of RedrivePolicy, and proper error handling for missing queues are all present.
packages/api/src/adapter-aws/AwsQueueAdapter.test.ts Good coverage: pagination, FIFO validation, malformed RedrivePolicy, send/receive/delete/purge happy paths, and search filtering are all exercised.
packages/frontend/src/components/QueueFlowPanel.tsx New bespoke panel for SQS; FIFO fields appear conditionally, stable row ids used for attributes, race-condition guard on receive is in place, purge has a cancel path — one minor gap: delete-mutation errors are not surfaced to the user.
packages/api/src/routes/clouds.ts Queue-specific sub-routes for messages and purge are correctly registered before the generic resource routes; isServiceType guard updated; consistent error handling via withRuntime.
packages/api/src/service/CloudProxyService.ts New queue-message methods correctly delegate to the registered adapter; schema fallback added for queue; service descriptor pushed to services() list.
packages/frontend/src/features/cloud-console/useCloudConsoleHomeData.ts Queue card correctly replaces the old placeholder; queueResourcesQuery is disabled for non-AWS clouds via hasAvailableService; loading/error states gated on cloud === aws.
packages/api/src/cloud-spi/queueSchema.ts Schema correctly follows existing SPI pattern with columns, filters, create fields, and FIFO queue type select option.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant UI as QueueFlowPanel (React)
    participant API as Hono API (:4501)
    participant SVC as CloudProxyService
    participant SQS as AwsQueueAdapter → SQS (:4566)

    UI->>API: GET /clouds/aws/services/queue/resources
    API->>SVC: listResources(aws, queue)
    SVC->>SQS: ListQueuesCommand (paginated via NextToken)
    SQS-->>SVC: QueueUrls[] + GetQueueAttributes per URL
    SVC-->>API: CloudResource[]
    API-->>UI: queue list (name, counts, redrivePolicy)

    UI->>API: POST /clouds/aws/services/queue/resources/:id/messages
    note over UI,API: body + optional messageGroupId / messageDeduplicationId
    API->>SVC: sendQueueMessage()
    SVC->>SQS: SendMessageCommand (FIFO-validated)
    SQS-->>SVC: MessageId
    SVC-->>API: QueueMessage
    API-->>UI: 201 QueueMessage

    UI->>API: GET /clouds/aws/services/queue/resources/:id/messages
    API->>SVC: receiveQueueMessages()
    SVC->>SQS: "ReceiveMessageCommand (WaitTimeSeconds 0|5)"
    SQS-->>SVC: Messages[] (visibility → In flight)
    SVC-->>API: QueueMessage[]
    API-->>UI: messages list

    UI->>API: POST /clouds/aws/services/queue/resources/:id/messages/delete
    note over UI,API: receiptHandle
    API->>SVC: deleteQueueMessage()
    SVC->>SQS: DeleteMessageCommand
    SQS-->>API: ok
    API-->>UI: "{ok: true}"

    UI->>API: POST /clouds/aws/services/queue/resources/:id/purge
    API->>SVC: purgeQueue()
    SVC->>SQS: PurgeQueueCommand
    SQS-->>API: ok
    API-->>UI: "{ok: true}"
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant UI as QueueFlowPanel (React)
    participant API as Hono API (:4501)
    participant SVC as CloudProxyService
    participant SQS as AwsQueueAdapter → SQS (:4566)

    UI->>API: GET /clouds/aws/services/queue/resources
    API->>SVC: listResources(aws, queue)
    SVC->>SQS: ListQueuesCommand (paginated via NextToken)
    SQS-->>SVC: QueueUrls[] + GetQueueAttributes per URL
    SVC-->>API: CloudResource[]
    API-->>UI: queue list (name, counts, redrivePolicy)

    UI->>API: POST /clouds/aws/services/queue/resources/:id/messages
    note over UI,API: body + optional messageGroupId / messageDeduplicationId
    API->>SVC: sendQueueMessage()
    SVC->>SQS: SendMessageCommand (FIFO-validated)
    SQS-->>SVC: MessageId
    SVC-->>API: QueueMessage
    API-->>UI: 201 QueueMessage

    UI->>API: GET /clouds/aws/services/queue/resources/:id/messages
    API->>SVC: receiveQueueMessages()
    SVC->>SQS: "ReceiveMessageCommand (WaitTimeSeconds 0|5)"
    SQS-->>SVC: Messages[] (visibility → In flight)
    SVC-->>API: QueueMessage[]
    API-->>UI: messages list

    UI->>API: POST /clouds/aws/services/queue/resources/:id/messages/delete
    note over UI,API: receiptHandle
    API->>SVC: deleteQueueMessage()
    SVC->>SQS: DeleteMessageCommand
    SQS-->>API: ok
    API-->>UI: "{ok: true}"

    UI->>API: POST /clouds/aws/services/queue/resources/:id/purge
    API->>SVC: purgeQueue()
    SVC->>SQS: PurgeQueueCommand
    SQS-->>API: ok
    API-->>UI: "{ok: true}"
Loading

Reviews (4): Last reviewed commit: "fix: guard receive-mutation against queu..." | Re-trigger Greptile

Comment thread packages/api/src/adapter-aws/AwsQueueAdapter.ts
Comment thread packages/api/src/adapter-aws/AwsQueueAdapter.ts Outdated
Comment thread packages/frontend/src/components/QueueFlowPanel.tsx
Comment thread packages/frontend/src/components/QueueFlowPanel.tsx
Comment thread packages/api/src/adapter-aws/AwsQueueAdapter.ts Outdated
Comment thread packages/api/src/adapter-aws/AwsQueueAdapter.ts
Comment thread packages/frontend/src/components/QueueFlowPanel.tsx Outdated
- list(): follow ListQueuesCommand NextToken instead of dropping queues
  past the first page
- sendMessage(): require messageGroupId for FIFO queues and pass
  MessageGroupId/MessageDeduplicationId through to SendMessageCommand;
  QueueFlowPanel now surfaces these fields when a FIFO queue is selected
- toResource(): parse RedrivePolicy safely so one malformed policy can't
  break list()/get() for every queue
- QueueFlowPanel: add a Cancel option to the purge confirmation, and key
  message-attribute rows by a stable id instead of array index

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Comment thread packages/frontend/src/components/QueueFlowPanel.tsx
Tie the receive mutation to the queueId it targeted so a slow long-poll
response can't leak messages into a different queue's list after the
user switches queues mid-request. Also dedupe by the stable message id
instead of receiptHandle, which changes on SQS redelivery and let the
same message reappear as a false "new" entry.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.

feat(aws): SQS in Cloud Explorer foundation: add queue service-type category

1 participant