Skip to content

feat: add native SNS publishing and SQS subscription topology - #432

Merged
thomhurst merged 2 commits into
mainfrom
issue-225-sns
Nov 10, 2026
Merged

thomhurst merged 2 commits into
mainfrom
issue-225-sns

Conversation

@thomhurst

@thomhurst thomhurst commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Add native SNS topic publishing to Relayer.AmazonSqs: standard/FIFO destinations, native group/deduplication IDs, typed outgoing PublishRequest callbacks, byte/count-limited PublishBatch, partial-failure responses, and aws.sns send telemetry with native request IDs. Explicit topic/raw SQS subscription declarations support read-only Validate and create-only Provision, including native queue policies through existing SQS topology. Clients supplied by the application remain caller-owned; constructed clients use unchanged native configuration and the AWS credential chain.

Builds on AWS SDK v4 Publish/PublishBatch and native topic/subscription paginators, Relayer send tracing/metrics, FIFO identity bindings, and SQS queue/policy validation. SubscribeQueueToTopicsAsync updates existing queue policies, so create-only provisioning composes native Subscribe with existing SQS declarations instead. No replacement broker ordering, deduplication, retry or scheduling layer is added. Found and reported aws/aws-sdk-net#4586; native paginators avoid the defective FindTopicAsync helper. Website usage/status and telemetry documentation are updated.

Validation:

  • Full Release solution build: zero warnings/errors.
  • 41 focused SQS/SNS tests pass, including real LocalStack standard/FIFO topic-to-queue delivery, raw CloudEvents attributes, replay deduplication, topology/policy drift, native pagination, batch failures, cancellation, ownership and telemetry.
  • npm ci and website production build pass.
  • Both new MemoryDiagnoser benchmark suites ran. Default-envelope binding allocates the same as raw native preparation: 856 B standard and 904 B FIFO (0 additional B). Native-required body/header/group strings are covered by D52; request/entry/attribute containers are pooled per concurrent operation.
  • Acknowledged LocalStack ShortRun timings are diagnostic: single-send ratios were 1.03/1.09 and batch ratios 1.74/0.91 with broad error bars. These do not establish the 5% throughput budget or the full default-JSON pipeline budget; no performance budget or trade-off was changed. The performance label enables advisory CI measurement.

Raw logs, benchmark reports, source, test reports and loaded binaries are archived outside the removable worktree at /Users/tom/git/Relayer-evidence/pr-432/1acd865a3002c81f995c5191798db9c9ba6be6e3/; copied files were SHA-256 verified against originals, with inventory in manifest.json. Focused validation was run locally; the entire multi-transport test suite and a dedicated SNS Native AOT deployment were not run. SQS receiver composition/full receive conformance remain #224's scope.

Closes #225

Review fix e91d19f corrects the SNS telemetry identifier to the convention-defined aws.sns. Existing span and metric assertions were corrected with the implementation; all 17 SnsSendTests pass. npm ci and the website production build pass. The five low npm audit findings match the existing deepmerge record in #101. No native capability is reimplemented; this reuses the existing tracing and endpoint metrics path. Per-message cost: constant string substitution, unchanged operations and 0 additional B; no benchmark needed.

Current-head test logs/reports and loaded test binaries are archived at /Users/tom/git/Relayer-evidence/pr-432/e91d19ff1a011e56e8f0a7838121938ce5c7d355/; all 239 copied files were SHA-256 verified against originals and inventoried in manifest.json. The original feature-validation archive remains the evidence for the earlier measurements.

@thomhurst thomhurst added the performance Run the advisory benchmark regression gate on this PR label Nov 10, 2026
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aa272ca8-781a-489d-99d0-a52aa1808d36
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

Copy link
Copy Markdown

Review of #432: SNS topic publishing

I read SnsSendTransport and SnsSendState against AGENTS.md and found nothing that should block merge. I did not build the PR or run its tests, and I did not read the test, benchmark or website files.

  • Native reuse: it uses PublishAsync, PublishBatchAsync, the native paginators and SubscribeAsync. It builds no parallel batching or retry layer. It also avoids FindTopicAsync because of FindTopicAsync throws when ListTopics returns no topics with v4 default collections aws/aws-sdk-net#4586, with a comment saying so.
  • Batch splitting: I traced the 10-entry flush and the 256 KiB byte-boundary flush. The swap that carries the prepared request into slot 0 keeps Used and Ids consistent, and Clear resets the state when it returns to the pool.
  • Partial failures: AmazonSnsBatchException carries the batch offset, so callers can tell which entries failed.
  • Topology: Validate is read-only and Provision only creates, as the project requires. Subscriptions must set RawMessageDelivery=true, so CloudEvents attributes survive.
  • Allocations: Utf8.GetString, header.Value.ToString() and OrderingKey.ToString() allocate per message. SNS's string-typed request model forces this, and the PR documents it. A one-line note in the PR description about the per-message cost would still help.

Non-blocking nits, not actionable for this PR:

  1. ResolveTopicsAsync sets every Arn to null before repopulating. A concurrent send during a re-apply could fail with "start the host". Resolving into a local map and then swapping it in would avoid that.
  2. CompareAttributes throws a raw JsonException if a policy attribute holds malformed JSON. Catching it and reporting a difference would be friendlier.
  3. If a later message in a batch fails validation, earlier chunks have already been published. Documenting that would help callers.

@thomhurst

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T05:49:47.632038Z e91d19f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@thomhurst

Copy link
Copy Markdown
Owner Author

Disposition of Claude's current-head review: CLEAR; all three suggestions are non-blocking, so this disposition does not change the reviewed head.

  1. Concurrent runtime topology reapplication is outside the hosted startup path (topology is applied before transports start). A map-swap refactor would be optional hardening; no added synchronization or send-path cost in this PR.
  2. Malformed declared policy JSON is invalid infrastructure configuration. Keeping the parsing exception exposes that input error; converting it into ordinary resource drift is optional presentation work.
  3. Non-atomic batching and earlier successful chunks are documented in the page's batching section; the SNS section also explains native partial delivery, successful entries not being resent and later batches stopping. No additional wording-only push.

Per-message cost: pooled native request/entry/attribute containers, UTF-8 body/header/group conversions required by the native API (D52), native size/count checks and asynchronous SDK acknowledgement. Binding MemoryDiagnoser measured 0 additional B over equivalent raw preparation; full pipeline throughput/allocation budgets are not established by the local diagnostic run.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1acd865a30

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@thomhurst

Copy link
Copy Markdown
Owner Author

@codex review

@github-actions

Copy link
Copy Markdown

Review: native SNS publishing

I read SnsSendTransport and SnsSendState. I did not run the tests or the benchmarks.

What holds up

  • It wraps the native Publish / PublishBatch, the paginators and CreateTopic / Subscribe. It adds no replacement ordering, deduplication or scheduling layer. Scheduling is rejected with a pointer to the outbox.
  • Batch chunking at 10 entries and 256 KiB is correct. I traced the byte-boundary swap and Used tracking, and the pooled state is cleared on every exit path, including a Prepare failure mid-batch.
  • Per-concurrent-operation pooled state avoids sharing SDK request objects across in-flight calls.
  • Partial batch failures surface as AmazonSnsBatchException with an offset, so the caller can tell which chunk failed.
  • The FindTopicAsync defect is worked around with native paginators and reported upstream. Docs, benchmarks and tests (including LocalStack) are in the PR.

Non-blocking observations

  1. ResolveTopicsAsync sets every Endpoint.Arn to null before it lists topics. If ApplyTopologyAsync runs again while sends are in flight, those sends can fail with 'start the host…'. If the listing throws partway, the ARNs stay null. Resolving into a local map and assigning the ARNs once at the end would remove both problems.
  2. In CompareAttributes, JsonDocument.Parse throws a raw JsonException if a policy attribute is not valid JSON. Catching it and reporting a difference would be friendlier.
  3. The topic name comes from the last : of the ARN. That is fine for topic ARNs, but a one-line comment saying so would help.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: e91d19ff1a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@thomhurst

Copy link
Copy Markdown
Owner Author

Disposition of Claude’s current-head review: all three observations are non-blocking.

  1. Runtime topology reapplication is outside hosted startup sequencing; topology resolves before transports start. A map-swap refactor is optional hardening and is declined in this review-only cycle.
  2. Malformed policy JSON is invalid infrastructure configuration; converting its parsing exception into a drift diagnostic is optional presentation work and is declined.
  3. A comment explaining the final ARN segment is an optional readability suggestion; no code push is warranted for it.

Both required reviewers cleared e91d19f; the sole inline finding is fixed and resolved. Reverified SHA-256 hashes for all 459 original feature archive files and all 239 current-head archive files against their recorded manifests at the paths in the PR body: no mismatches. Original worktree copies have been cleaned up; the prior archive-time source comparisons recorded in the PR remain the evidence of equality to originals. This verification checks retained archive integrity and does not claim a new source comparison or test run.

@thomhurst
thomhurst marked this pull request as ready for review November 10, 2026 05:53
@thomhurst
thomhurst enabled auto-merge (squash) November 10, 2026 05:53
@thomhurst
thomhurst merged commit 279bb16 into main Nov 10, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Run the advisory benchmark regression gate on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SNS topics and SQS subscription topology

1 participant