Skip to content
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

fix: pin slack client, breaking change #10345

Merged
merged 1 commit into from Jul 20, 2020

Conversation

bkyryliuk
Copy link
Member

Slack client versions > 2.5.0 do not accept the file content anymore. It broke the slack integration.
Added test that would capture undesired upgrades.
Eventually we can fix via writing a tmp file and then uploading it.

TEST PLAN

  • ipython
  • unit test
  • dropbox staging

@bkyryliuk bkyryliuk changed the title Pin slack client, breaking change fix: pin slack client, breaking change Jul 16, 2020
@bkyryliuk bkyryliuk force-pushed the bogdan/downgrade_slack_client branch from 63a5476 to 3c97d31 Compare July 16, 2020 16:45
@bkyryliuk bkyryliuk force-pushed the bogdan/downgrade_slack_client branch from 3c97d31 to bdd31b3 Compare July 16, 2020 16:54
@codecov-commenter
Copy link

Codecov Report

Merging #10345 into master will decrease coverage by 11.14%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #10345       +/-   ##
===========================================
- Coverage   70.61%   59.47%   -11.15%     
===========================================
  Files         601      405      -196     
  Lines       32225    13269    -18956     
  Branches     3257     3257               
===========================================
- Hits        22757     7892    -14865     
+ Misses       9365     5196     -4169     
- Partials      103      181       +78     
Flag Coverage Δ
#cypress ?
#javascript 59.47% <ø> (+<0.01%) ⬆️
#python ?
Impacted Files Coverage Δ
superset-frontend/src/SqlLab/App.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/explore/App.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/dashboard/App.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/explore/index.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/dashboard/index.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/setup/setupColors.js 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/chart/ChartContainer.jsx 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/setup/setupFormatters.js 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/explore/reducers/index.js 0.00% <0.00%> (-100.00%) ⬇️
superset-frontend/src/setup/setupPluginsExtra.js 0.00% <0.00%> (-100.00%) ⬇️
... and 340 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e4c9c73...bdd31b3. Read the comment docs.

@bkyryliuk bkyryliuk requested review from villebro and dpgaspar and removed request for villebro July 16, 2020 17:05
@villebro
Copy link
Member

@bkyryliuk do I understand correctly that the new version doesn't support file-like objects, but requires files to be persisted to disk prior to submission?

@bkyryliuk
Copy link
Member Author

@bkyryliuk do I understand correctly that the new version doesn't support file-like objects, but requires files to be persisted to disk prior to submission?

yes
I did not dig much into the changes in the lib. We have been using 2.5.0 for last 3 month at dropbox.
I used this snippet in ipython to find the version that had the regression

import logging
logging.basicConfig(level=logging.DEBUG)

import os
from slack import WebClient
from slack.errors import SlackApiError
slack_token='your_token'
client = WebClient(token=slack_token)
fn = '/Users/bogdankyryliuk/Desktop/Screen Shot 2020-07-16 at 9.03.49 AM.png'
in_file = open(fn, "rb")
data = in_file.read()
response = client.files_upload(
  channels="#bogdan-test2",
  file=data,
  title="Test upload"
)

@mistercrunch
Copy link
Member

Had the issue been reported on their GitHub? If so can we link to it? If not can we report it?

@villebro
Copy link
Member

slackapi/python-slack-sdk#728

Seems like making it a file-like object (io.BytesIO) instead of bytearray fixes it in >2.5.0, <2.7.2. Since 2.7.2 is already out, we should probably bump to that version?

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

Check my comment above. I propose bumping to 2.7.2.

@bkyryliuk
Copy link
Member Author

slackapi/python-slackclient#728

Seems like making it a file-like object (io.BytesIO) instead of bytearray fixes it in >2.5.0, <2.7.2. Since 2.7.2 is already out, we should probably bump to that version?

This seems to work:

 response = client.files_upload(channels="#bogdan-test2", file=io.BytesIO(b'blabla'), title="Test upload", filename="test.png")

I am on PTO today, won't be able to test this approach on our staging.
My suggestion here would be to merge the library downgrade and I can do a fix forward a bit later this week.

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

To get this unblocked for 0.37, in discussions with @bkyryliuk we decided to get this merged and follow up with a 2.7.2 bump later after it has been properly tested at Dropbox.

@bkyryliuk bkyryliuk merged commit 7075c2f into apache:master Jul 20, 2020
@bkyryliuk bkyryliuk deleted the bogdan/downgrade_slack_client branch July 20, 2020 16:20
villebro pushed a commit that referenced this pull request Jul 21, 2020
Co-authored-by: bogdan kyryliuk <bogdankyryliuk@dropbox.com>
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
Co-authored-by: bogdan kyryliuk <bogdankyryliuk@dropbox.com>
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
Co-authored-by: bogdan kyryliuk <bogdankyryliuk@dropbox.com>
@mistercrunch mistercrunch added 🍒 0.37.0 🍒 0.37.1 🍒 0.37.2 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.38.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/S v0.37 🍒 0.37.0 🍒 0.37.1 🍒 0.37.2 🚢 0.38.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants