fix(np): Adds attachment to Slack render type, updates metric renderer#112312
fix(np): Adds attachment to Slack render type, updates metric renderer#112312GabeVillalobos merged 10 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Direct dict access on NotRequired field causes KeyError
- Updated Slack integration send_notification to use payload.get("attachments", None) so missing optional attachments no longer raises KeyError.
Or push these changes by commenting:
@cursor push a00fda5534
Preview (a00fda5534)
diff --git a/src/sentry/integrations/slack/integration.py b/src/sentry/integrations/slack/integration.py
--- a/src/sentry/integrations/slack/integration.py
+++ b/src/sentry/integrations/slack/integration.py
@@ -117,7 +117,7 @@
channel=target.resource_id,
blocks=payload["blocks"],
text=payload["text"],
- attachments=payload["attachments"],
+ attachments=payload.get("attachments", None),
unfurl_links=False,
unfurl_media=False,
)This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
Backend Test FailuresFailures on
|
Backend Test FailuresFailures on
|
| serialized_blocks.append(block.to_dict()) | ||
|
|
||
| return {"blocks": serialized_blocks} | ||
| return {"blocks": serialized_blocks, "attachments": message.get("attachments", None)} |
There was a problem hiding this comment.
nit: .get()'s default value is already none
Backend Test FailuresFailures on
|
70d6aca to
969ec6d
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0b40258. Configure here.
| blocks=renderable["blocks"], | ||
| blocks=renderable["blocks"] if len(renderable["blocks"]) > 0 else None, | ||
| text=renderable["text"], | ||
| attachments=renderable.get("attachments"), |
There was a problem hiding this comment.
Inconsistent unfurl flags across Slack message methods
Low Severity
This commit adds unfurl_links=False and unfurl_media=False to send_notification, send_notification_with_threading, and update_message, but omits them from send_threaded_message and send_threaded_ephemeral_message. Previously none of these methods set unfurl flags, so they were all consistent. Now threaded messages will still show link previews while non-threaded ones won't.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 0b40258. Configure here.
There was a problem hiding this comment.
Diverging code paths used by different callers with different expectations.



Updates the
SlackRenderabletype to includeattachmentsas a renderable type, which allows for some legacy functionality, like colored borders on blocks. This is currently needed for feature parity with our metric alerting, and can be used by the default renderer in the future if we so choose.This PR also adds the metric alert template to our debug UI, since the rendering has been simplified significantly.