-
Notifications
You must be signed in to change notification settings - Fork 15.1k
fix(Slack): Fix Slack recipients migration to V2 #32336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
Category | Issue | Fix Detected |
---|---|---|
Non-Specific Error Message ▹ view | ✅ | |
Unsafe String Split Operation ▹ view | ✅ |
Files scanned
File Path | Reviewed |
---|---|
superset/utils/slack.py | ✅ |
superset/reports/schemas.py | ✅ |
superset/commands/report/execute.py | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Need a new review? Comment
/korbit-review
on this PR and I'll review your latest changes.Korbit Guide: Usage and Customization
Interacting with Korbit
- You can manually ask Korbit to review your PR using the
/korbit-review
command in a comment at the root of your PR.- You can ask Korbit to generate a new PR description using the
/korbit-generate-pr-description
command in any comment on your PR.- Too many Korbit comments? I can resolve all my comment threads if you use the
/korbit-resolve
command in any comment on your PR.- Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
- Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.
Customizing Korbit
- Check out our docs on how you can make Korbit work best for you and your team.
- Customize Korbit for your organization through the Korbit Console.
Feedback and Support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review by Korbit AI
Korbit automatically attempts to detect when you fix issues in new commits.
Category | Issue | Fix Detected |
---|---|---|
Slack Channel Validation Fails with Duplicate Inputs ▹ view | ✅ | |
Invalid Search String Processing ▹ view | ✅ |
Files scanned
File Path | Reviewed |
---|---|
superset/reports/notifications/slackv2.py | ✅ |
superset/reports/notifications/slack.py | ✅ |
superset/utils/slack.py | ✅ |
superset/reports/schemas.py | ✅ |
superset/reports/api.py | ✅ |
superset/commands/report/execute.py | ✅ |
superset/utils/core.py | ✅ |
Explore our documentation to understand the languages and file types we support and the files we ignore.
Need a new review? Comment
/korbit-review
on this PR and I'll review your latest changes.Korbit Guide: Usage and Customization
Interacting with Korbit
- You can manually ask Korbit to review your PR using the
/korbit-review
command in a comment at the root of your PR.- You can ask Korbit to generate a new PR description using the
/korbit-generate-pr-description
command in any comment on your PR.- Too many Korbit comments? I can resolve all my comment threads if you use the
/korbit-resolve
command in any comment on your PR.- Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
- Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.
Customizing Korbit
- Check out our docs on how you can make Korbit work best for you and your team.
- Customize Korbit for your organization through the Korbit Console.
Feedback and Support
f38128c
to
fb82e8b
Compare
d934717
to
802c0aa
Compare
"Could not find the following channels: " | ||
f"{', '.join(missing_channels)}" | ||
) | ||
raise UpdateFailedError(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to block the conversion to v2 if channel ids can't be found or just log them and continue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eschutho from my tests currently (before this PR) what's happening is that the execution itself is listed as successful in the execution logs, but nothing is sent to Slack. I thought about calling send()
with the type set to V1
again, but that would cause an infinite loop as we would validate again if there are scopes to migrate, attempt the migration, fail again, etc. Calling it with V2
would also fail as we don't have all IDs.
Considering that the Slack deprecation is next Tuesday, I think it makes sense to consider any issues to migrate to V2 an error that should be fixed asap. Let me know your thoughts -- happy to think of other alternatives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Won't resolve this as I think it's good context for someone looking at the changes in the future
SlackChannelTypes.PUBLIC, | ||
], | ||
) | ||
"target": channel_ids, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this error/missing step, btw!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. Small formatting suggestions, but good to merge when you're ready!
7f67895
to
2c7d8dc
Compare
(cherry picked from commit d2e0e2b)
SUMMARY
This PR fixes a few things with the Slack method migration from V1 to V2 (required as Slack is fully deprecating
files.upload()
in March):get_channels_with_search
was returning a list of dictionaries (one per channel found) and we were dumping this directly in thetarget
configuration for a report. Thetarget
field expects a comma-separated list of channels IDs for the V2 approach.exact_match
search during the migration to avoid for example migrating a report fromother-channel
toanother-channel
.one-channel, second-channel
. Also removing leading#
to channel names that were supported with the V1 method.SUCCESS
even though the notification was not sent, so this seems more appropriate.One known issue is that the V1 integration allowed sending reports as a DM (by using the Member ID), and this is no longer possible with V2. The V2 APIs consider a DM as a conversation as well, so the bot would need to parse all Workspace members + public channels + private channels to support this, which would definitely hit the Slack rate limit (20+ requests per minute). We can revisit this once we have a better strategy to avoid rate limits.
Fixes #31936
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Report form when the migration failed

Execution logs when the migration failed

TESTING INSTRUCTIONS
Added testing.
ADDITIONAL INFORMATION