Skip to content

Remove confusing warning from FileInstallationStore#1115

Merged
seratch merged 1 commit intoslackapi:mainfrom
seratch:remove-confusing-warning
Sep 13, 2021
Merged

Remove confusing warning from FileInstallationStore#1115
seratch merged 1 commit intoslackapi:mainfrom
seratch:remove-confusing-warning

Conversation

@seratch
Copy link
Copy Markdown
Contributor

@seratch seratch commented Sep 13, 2021

Summary

We've got a question about the warning at slackapi/bolt-python#464 and I found that we should not have the logs in warning level. It's just confusing and also we don't have the same log in warning level in other built-in implementations.

Category (place an x in each of the [ ])

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.signature (Request Signature Verifier)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.models (UI component builders)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.rtm_v2 (RTM client)
  • /docs-src (Documents, have you run ./scripts/docs.sh?)
  • /docs-src-v2 (Documents, have you run ./scripts/docs-v2.sh?)
  • /tutorial (PythOnBoardingBot tutorial)
  • tests/integration_tests (Automated tests for this library)

Requirements (place an x in each [ ])

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh after making the changes.

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 13, 2021

Codecov Report

Merging #1115 (1c0c1a8) into main (961706e) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1115   +/-   ##
=======================================
  Coverage   85.35%   85.35%           
=======================================
  Files         110      110           
  Lines       10517    10517           
=======================================
  Hits         8977     8977           
  Misses       1540     1540           
Impacted Files Coverage Δ
...lack_sdk/oauth/installation_store/file/__init__.py 86.66% <100.00%> (ø)

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 961706e...1c0c1a8. Read the comment docs.

except FileNotFoundError as e:
message = f"Failed to find bot installation data for enterprise: {e_id}, team: {t_id}: {e}"
self.logger.warning(message)
message = f"Any bot installation data was found for enterprise: {e_id}, team: {t_id}: {e}"
Copy link
Copy Markdown
Contributor

@eddyg eddyg Sep 13, 2021

Choose a reason for hiding this comment

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

Did you mean “No” instead of “Any” here (and in line 175)?

I’m thinking something like:

f”No bot installation data found for enterprise {e_id}, team {t_id}: {e}"

or maybe even better without the negative:

f”Installation data missing for enterprise {e_id}, team {t_id}: {e}"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops, yes, I meant "No" but I like your suggestion. Will update. Thanks!

@seratch seratch force-pushed the remove-confusing-warning branch from 9e0604a to 1c0c1a8 Compare September 13, 2021 12:08
@seratch
Copy link
Copy Markdown
Contributor Author

seratch commented Sep 13, 2021

@eddyg Thanks for your review (as always 🙇)! I've fixed the log messages and removed unintentionally added commits.

@eddyg
Copy link
Copy Markdown
Contributor

eddyg commented Sep 13, 2021

You're very welcome, @seratch. (I figured those were extra commits for another PR that snuck in. 😉)

Copy link
Copy Markdown
Contributor

@eddyg eddyg left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Copy Markdown
Contributor

@filmaj filmaj left a comment

Choose a reason for hiding this comment

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

This looks OK to me but I am wondering: aside from the situation described in slackapi/bolt-python#464, perhaps there could be other situations where the bot_filepath might be not found? E.g. wrong permissions set on the directory (or perhaps that throws a different error)?

If so, then perhaps dropping the log level from warning to debug may hide those issues? If not: then please ignore this comment 😄

@seratch
Copy link
Copy Markdown
Contributor Author

seratch commented Sep 13, 2021

@filmaj Thanks for the comment and that's a good point! But there is no problem with it. In the scenario, bolt-python's authorization middleware writes some error logs and returns an error message to end-users. https://github.com/slackapi/bolt-python/blob/v1.9.1/slack_bolt/middleware/authorization/multi_teams_authorization.py#L69-L76 Thus, the changes in this PR just removes a warning log that exists only in the file-based installation store.

Copy link
Copy Markdown
Contributor

@filmaj filmaj left a comment

Choose a reason for hiding this comment

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

Great, thanks for the details, it is very helpful to learn 🙏

@seratch seratch merged commit 12188d3 into slackapi:main Sep 13, 2021
@seratch seratch deleted the remove-confusing-warning branch September 13, 2021 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants