feat(block): Add cloudwatch publish operation#4027
Conversation
|
@BugBot review |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Updates the CloudWatch block UI/config to expose a Publish Metric operation (new fields for value/unit/dimensions), adds timestamp wand helpers for start/end time, and registers the new operation in integration metadata and the tool registry. Tightens CloudWatch error/behavior defaults (invalid dimensions now returns Reviewed by Cursor Bugbot for commit 9a4d394. Configure here. |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c204d32. Configure here.
…a conventions - Update tool version strings from '1.0' to '1.0.0' across all three integrations - Add missing `export * from './types'` barrel re-exports (cloudwatch, cloudformation) - Add docsLink, wandConfig timestamps, mode: 'advanced' on optional fields (cloudwatch) - Add dropdown defaults, ZodError handling, docs intro section (cloudwatch) - Add mode: 'advanced' on limit field (cloudformation) - Alphabetize registry entries (cloudwatch, cloudformation) - Fix athena docs maxResults range (1-999) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c204d32 to
f8cbbe7
Compare
…outputs, fix JSON error handling - Add all 27 valid CloudWatch StandardUnit values to metricUnit dropdown (was 13) - Add missing block outputs for put_metric_data: success, namespace, metricName, value, unit - Add try-catch around dimensions JSON.parse in put-metric-data route for proper 400 errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR adds a Publish Metric ( Confidence Score: 5/5Safe to merge — no P0/P1 findings remain; prior review concerns (NaN guard, unit dropdown coverage, dimensions validation) are all resolved. All previous review issues are addressed. The new put_metric_data route, tool, and block are correctly implemented following existing patterns. Validation is thorough (finite-number check, full unit enum, JSON-object dimensions guard). No new logic, security, or data-integrity issues were found. No files require special attention.
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/tools/cloudwatch/put-metric-data/route.ts | New route for publishing CloudWatch metric data; Zod schema guards NaN/Infinity values and validates dimensions as a JSON object; auth, error handling, and logging are all correct. |
| apps/sim/blocks/blocks/cloudwatch.ts | Adds put_metric_data UI fields (value, unit dropdown with all 27 units, dimensions table), wires params correctly with NaN guard and JSON dimensions serialization, and updates outputs section. |
| apps/sim/tools/cloudwatch/put_metric_data.ts | New tool config for cloudwatch_put_metric_data; request body mapping and transformResponse are consistent with the existing CloudWatch tool pattern. |
| apps/sim/tools/cloudwatch/types.ts | Adds CloudWatchPutMetricDataParams and CloudWatchPutMetricDataResponse interfaces; types are correct and consistent with the route/tool implementation. |
| apps/sim/tools/cloudwatch/index.ts | Adds putMetricDataTool import and re-export; barrel export is consistent with existing pattern. |
| apps/sim/blocks/blocks/cloudformation.ts | Minor fix: adds mode: 'advanced' to the describe_stack_events limit field, matching the pattern used by other limit fields in the codebase. |
| apps/docs/content/docs/en/tools/cloudwatch.mdx | Adds intro section and new cloudwatch_put_metric_data operation documentation; output fields and parameters are accurate. |
Sequence Diagram
sequenceDiagram
participant UI as Sim Block UI
participant Block as CloudWatch Block
participant Tool as putMetricDataTool
participant Route as /api/tools/cloudwatch/put-metric-data
participant CW as AWS CloudWatch
UI->>Block: User selects Publish Metric, fills fields
Block->>Block: params() — validate, coerce to Number, serialize dimensions
Block->>Tool: Invoke cloudwatch_put_metric_data
Tool->>Route: POST request with credentials and metric data
Route->>Route: checkInternalAuth()
Route->>Route: Zod parse — finite number, valid unit, valid JSON dimensions
Route->>CW: PutMetricDataCommand
CW-->>Route: 200 OK
Route-->>Tool: success + output fields
Tool-->>Block: transformResponse
Block-->>UI: Outputs available
Reviews (4): Last reviewed commit: "fix(cloudwatch): use Number.isFinite to ..." | Re-trigger Greptile
…All Types" selected Per AWS docs, omitting AlarmTypes returns only MetricAlarm. Now explicitly sends both MetricAlarm and CompositeAlarm when no filter is selected. Also fix dimensions JSON parse errors returning 500 instead of 400 in get-metric-statistics route. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move dimensions validation from runtime try-catch to Zod refinement, catching malformed JSON and arrays at schema validation time (400) instead of runtime (500). Also rejects JSON arrays that would produce meaningless numeric dimension names. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 66ffcd9. Configure here.
|
Tip: Greploop — Automatically fix all review issues by running Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal. |
…ublishing 0 Add NaN guard in block config and .finite() refinement in Zod schema so "abc" → NaN is caught at both layers instead of coercing to 0. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@greptile |
|
@cursor review |
… config Aligns block-level validation with route's Zod .finite() refinement so Infinity/-Infinity are caught at the block config layer, not just the API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 9a4d394. Configure here.
Summary
Brief description of what this PR does and why.
Fixes #(issue)
Type of Change
Testing
How has this been tested? What should reviewers focus on?
Checklist
Screenshots/Videos