Skip to content

feat: expose SNS topics to automation - #366

Open
YoungJinJung wants to merge 2 commits into
mainfrom
feature/360-sns-agent-surface
Open

YoungJinJung wants to merge 2 commits into
mainfrom
feature/360-sns-agent-surface

Conversation

@YoungJinJung

@YoungJinJung YoungJinJung commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a read-only sns-topics JSON query that joins topics with subscriptions
  • preserve denied topic and subscription lookups as partial-result warnings
  • expose the same v1 contract through list_sns_topics and document discovery and permissions

Related Issues

Related to #360

Validation

  • make test
  • make build
  • unic schema resources sns-topics --json
  • unic capabilities --json discovery check
  • git diff --check

Checklist

  • Scope is focused
  • Branch name follows docs/branch-naming-harness.md
  • Documentation harness reviewed (docs/documentation-harness.md)
  • README updated if user-facing behavior changed
  • Relevant docs/ pages updated if architecture, auth, config, or workflow changed
  • Tests/validation included
  • Breaking changes documented (none)

Summary by CodeRabbit

  • New Features

    • Added read-only SNS topic inspection through the CLI and MCP, including topic subscriptions and dead-letter queue details.
    • Added support for AWS profile and region selection when retrieving SNS topics.
    • Partial results remain available when individual subscription lookups fail, with warnings reported in the output.
  • Documentation

    • Documented the SNS topics query, permissions, output behavior, and example usage.
    • Broadened AWS resource inspection guidance to include SNS topics alongside existing resources.

- join topics with per-topic subscriptions and partial-result warnings
- register the versioned CLI and MCP contracts
- document discovery, permissions, and agent usage
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Warning

Review limit reached

Next included review available in 52 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 45a0f983-d689-4047-b843-5f3ee8bbfc7a

📥 Commits

Reviewing files that changed from the base of the PR and between c7e2fed and 16f1f75.

📒 Files selected for processing (6)
  • internal/cli/resources.go
  • internal/cli/resources_operations.go
  • internal/cli/resources_operations_test.go
  • internal/services/aws/sns.go
  • internal/services/aws/sns_model.go
  • internal/services/aws/sns_test.go

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: e1a17e0c-1a0b-43a0-9612-684d5a8cff58

📥 Commits

Reviewing files that changed from the base of the PR and between 141d12e and c7e2fed.

📒 Files selected for processing (12)
  • README.md
  • docs/development.md
  • internal/cli/resources.go
  • internal/cli/resources_operations.go
  • internal/cli/resources_operations_test.go
  • internal/mcp/agent_surface_test.go
  • internal/mcp/server.go
  • internal/mcp/server_test.go
  • internal/services/aws/sns.go
  • internal/services/aws/sns_model.go
  • internal/services/aws/sns_test.go
  • skills/unic-aws/SKILL.md

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: test
🧰 Additional context used
📓 Path-based instructions (8)
For AWS integration code, focus on SDK client interface mockability, paginator usage, nil/empty response handling, AWS pointer conversion, stable list ordering, and user-facing error messages.

⚙️ CodeRabbit configuration file

Files:

  • internal/services/aws/sns_test.go
  • internal/services/aws/sns_model.go
  • internal/services/aws/sns.go
Check that tests cover API errors, mapping edge cases, and navigation state transitions, not only happy paths.

⚙️ CodeRabbit configuration file

Files:

  • internal/services/aws/sns_test.go
  • internal/mcp/agent_surface_test.go
  • internal/mcp/server_test.go
  • internal/cli/resources_operations_test.go
Verify that README changes match actual CLI/TUI behavior and that Currently Implemented Features, TUI Key Bindings, Usage, and Configuration content stay aligned with code changes.

⚙️ CodeRabbit configuration file

Files:

  • README.md
Documentation must match implemented behavior.

⚙️ CodeRabbit configuration file

Files:

  • docs/development.md
For Go reviews, look beyond compilation and prioritize nil pointer risks, context propagation, AWS SDK pagination, error wrapping, deterministic sorting, and stable table/detail rendering.

⚙️ CodeRabbit configuration file

Files:

  • internal/services/aws/sns_test.go
  • internal/mcp/agent_surface_test.go
  • internal/services/aws/sns_model.go
  • internal/cli/resources.go
  • internal/mcp/server_test.go
  • internal/cli/resources_operations_test.go
  • internal/services/aws/sns.go
  • internal/cli/resources_operations.go
  • internal/mcp/server.go
Tests use mock client interfaces (see `rds_test.go` pattern) in Go test files

📄 CodeRabbit inference engine (CLAUDE.md)

Files:

  • internal/services/aws/sns_test.go
  • internal/mcp/agent_surface_test.go
  • internal/mcp/server_test.go
  • internal/cli/resources_operations_test.go
When adding, modifying, or deleting features, always update `README.md` in parallel with code changes Update `Currently Implemented Features` table in README.md: add new services/features, update status changes (🚧→✅), remove deleted items...

📄 CodeRabbit inference engine (CLAUDE.md)

Files:

  • README.md
Use lipgloss for styled TUI output — column-aligned tables with dimmed labels in Go implementation files Implement scroll windowing with formula: `visibleLines := max(m.height-N, 5)` in Go TUI implementation

📄 CodeRabbit inference engine (CLAUDE.md)

Files:

  • internal/services/aws/sns_test.go
  • internal/mcp/agent_surface_test.go
  • internal/services/aws/sns_model.go
  • internal/cli/resources.go
  • internal/mcp/server_test.go
  • internal/cli/resources_operations_test.go
  • internal/services/aws/sns.go
  • internal/cli/resources_operations.go
  • internal/mcp/server.go
🪛 LanguageTool
skills/unic-aws/SKILL.md

[style] ~13-~13: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...sing an automation command contract. 4. Call a discovered read-only resource tool wi...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🔇 Additional comments (5)
internal/cli/resources.go (1)

38-66: LGTM!

Also applies to: 91-91

internal/cli/resources_operations.go (1)

73-79: LGTM!

Also applies to: 191-233

docs/development.md (1)

28-28: LGTM!

Also applies to: 35-36

internal/mcp/server.go (1)

123-131: LGTM!

Also applies to: 417-417, 425-425

internal/mcp/server_test.go (1)

58-58: LGTM!


Walkthrough

The change adds SNS topic and subscription discovery to the resources CLI and MCP server. It joins topic data with subscriptions, preserves partial lookup failures as warnings, exposes versioned JSON output, and updates related documentation and agent-surface registration.

Changes

SNS topic discovery

Layer / File(s) Summary
SNS resource aggregation
internal/services/aws/sns_model.go, internal/services/aws/sns.go, internal/services/aws/sns_test.go
SNSTopicResource groups a topic with its subscriptions. ListSNSTopicResources returns successful topics and converts per-topic subscription failures into warnings. Tests verify partial results.
CLI JSON contract
internal/cli/resources.go, internal/cli/resources_operations.go, internal/cli/resources_operations_test.go, docs/development.md
The sns-topics command supports JSON output only, maps topic and subscription fields, preserves empty subscription arrays, emits warnings, and marks pagination incomplete when warnings exist. Loader failures emit no envelope.
MCP exposure and guidance
internal/mcp/server.go, internal/mcp/server_test.go, internal/mcp/agent_surface_test.go, README.md, skills/unic-aws/SKILL.md
The list_sns_topics tool routes to the CLI command with profile and region context, declares SNS permissions and the v1 output contract, passes agent-surface validation, and updates usage guidance.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant MCPClient
  participant MCPServer
  participant ResourcesCommand
  participant AwsRepository
  MCPClient->>MCPServer: call list_sns_topics with profile and region
  MCPServer->>ResourcesCommand: execute resources sns-topics --json
  ResourcesCommand->>AwsRepository: load SNS topics and subscriptions
  AwsRepository-->>ResourcesCommand: topics, subscriptions, and warnings
  ResourcesCommand-->>MCPServer: unic.resources.sns-topics.v1 JSON
  MCPServer-->>MCPClient: paginated partial-result response
Loading

Merge Risk: ⚪ Minimal · up to c7e2f

No actionable issue remains; the SNS discovery feature is ready to merge after normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 9 files. (3 skipped: 3… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required conventional prefix, "feat:", and clearly describes the main change: exposing SNS topics to automation.
Description check ✅ Passed The description includes all required sections. It explains the change, references issue #360, lists validation steps, and completes the checklist. The issue reference uses "Related to" instead of the…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 9 files. (3 skipped: 3 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/360-sns-agent-surface

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

Comment @coderabbitai help to get the list of available commands.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR successfully adds SNS topic automation support with a clean, well-tested implementation. The new ListSNSTopicResources function properly joins topics with subscriptions while handling partial results gracefully. All functionality is correctly exposed through both CLI and MCP interfaces with appropriate metadata and comprehensive test coverage. The implementation follows existing patterns and maintains API stability. No blocking issues found - ready to merge.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@YoungJinJung YoungJinJung left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed head: c7e2fed

Findings

  1. P2 — Preserve the SNS filter-policy scope in the automation contract (internal/cli/resources.go:64, internal/cli/resources_operations.go:211). The new v1 payload emits filter_policy, but GetSubscriptionAttributes also returns FilterPolicyScope, which determines whether that JSON is evaluated against message attributes (the default) or the message body. A subscription configured with MessageBody therefore produces the same automation payload as one using MessageAttributes, so an agent inspecting delivery behavior can interpret the policy against the wrong input and misdiagnose why messages are filtered. Capture the scope when applying subscription attributes and expose it alongside filter_policy (normalizing an absent known scope to the AWS default if desired); add a contract test covering MessageBody so the distinction cannot regress.

- expose MessageBody versus MessageAttributes semantics
- default an omitted known scope to the AWS default
- cover repository mapping and the JSON contract
@YoungJinJung

Copy link
Copy Markdown
Contributor Author

Addressed the filter-policy scope finding in 16f1f75. SNS subscription mapping now captures FilterPolicyScope, defaults an omitted scope to MessageAttributes when a filter policy is present, and emits filter_policy_scope in the v1 automation payload. Repository and JSON contract tests cover MessageBody. Validation passed: make test, make build, focused SNS/CLI/MCP tests, and git diff --check.

@YoungJinJung

Copy link
Copy Markdown
Contributor Author

/q review

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary

This PR successfully adds SNS topic inspection functionality to the automation surface. The implementation is well-designed with:

Robust Error Handling: Partial results are preserved when individual resources fail, with clear warnings
Comprehensive Testing: Good test coverage including pagination, sorting, denied access scenarios, and contract validation
Safe Concurrency: Proper goroutine batching and synchronization to handle API throttling
Clean Integration: Consistent with existing resource commands and MCP tool patterns

The changes align with the stated goal of exposing SNS topics to automation while maintaining resilience against permission-restricted resources. No blocking issues identified.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

@YoungJinJung YoungJinJung left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Re-reviewed head 16f1f75 after the filter-policy-scope follow-up. The new commit preserves MessageBody versus MessageAttributes, applies the documented AWS default when the scope is omitted, and covers both repository mapping and the v1 JSON contract. I read the complete 12-file diff, tests, CI, prior reviews, comments, and inline-thread state; no further actionable concerns remain. Local validation passed: make test; make build; git diff --check origin/main...HEAD.

@youngjinjung-linq youngjinjung-linq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed head 16f1f75. I read the complete twelve-file diff, tests, CI, issue context, prior reviews, comments, and the filter-policy-scope follow-up. The partial-result behavior, deterministic ordering, JSON/MCP contracts, permissions, and documentation are aligned; no actionable concerns remain. Local validation passed: make test, make build, and git diff --check.

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.

2 participants