refactor(feedback): extract app builder Slack notifications into modules with thread support#433
Open
kiloconnect[bot] wants to merge 1 commit intomainfrom
Open
Conversation
…es with thread support Moves the inline Slack notification logic out of the router into dedicated modules: internal-notifications.ts (low-level WebClient primitives) and app-builder-feedback-slack.ts (app-builder-specific formatting). Switches from an incoming webhook to chat.postMessage so we can obtain the message ts and post the full feedback text as a thread reply when it exceeds the 500-char preview limit.
| } | ||
| notifyAppBuilderFeedback(input.project_id, input.feedback_text).catch(error => { | ||
| console.error('[AppBuilderFeedback] Failed to post to Slack', error); | ||
| }); |
Contributor
Author
There was a problem hiding this comment.
[SUGGESTION]: Dead .catch() handler — notifyAppBuilderFeedback already catches and logs all errors internally (see its try/catch on lines 25–52 of app-builder-feedback-slack.ts), so this promise will never reject.
You can simplify to a bare call:
Suggested change
| }); | |
| notifyAppBuilderFeedback(input.project_id, input.feedback_text); |
Alternatively, if you'd prefer the router to own error logging, remove the try/catch inside notifyAppBuilderFeedback and keep this .catch() instead.
Contributor
Author
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (4 files)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
app-builder-feedback-router.tsinto two dedicated modules:src/lib/slack/internal-notifications.ts— low-levelWebClientprimitives (postInternalSlackMessage,postInternalSlackThreadReply)src/lib/feedback/app-builder-feedback-slack.ts— app-builder-specific formatting and orchestration (notifyAppBuilderFeedback)fetch+SLACK_USER_FEEDBACK_WEBHOOK_URL) tochat.postMessage(SLACK_FEEDBACK_BOT_TOKEN+SLACK_FEEDBACK_CHANNEL_ID), which returns the messagetsNew env vars required
The existing
SLACK_USER_FEEDBACK_WEBHOOK_URLis unchanged and still used byuser-feedback-router.ts.