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

chore(slack): actually type issues message builder correctly #75212

Merged
merged 13 commits into from
Aug 1, 2024

Conversation

cathteng
Copy link
Member

and don't break Slack in the process

Re-up of #74876

Copy link

sentry-io bot commented Jul 29, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: src/sentry/integrations/slack/message_builder/issues.py

Function Unhandled Issue
build TypeError: 'NoneType' object cannot be interpreted as an integer sentry.tasks.activity.send_activi...
Event Count: 19
build Actor.InvalidActor: Cannot find a User with id=2493315 sentry.tasks.digests.deliver_...
Event Count: 2

Did you find this useful? React with a 👍 or 👎

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 29, 2024
Copy link

codecov bot commented Jul 30, 2024

Codecov Report

Attention: Patch coverage is 89.13043% with 5 lines in your changes missing coverage. Please review.

Project coverage is 78.22%. Comparing base (3e9875e) to head (9b4549d).
Report is 3 commits behind head on master.

Files Patch % Lines
...entry/integrations/slack/message_builder/issues.py 84.00% 1 Missing and 3 partials ⚠️
src/sentry/integrations/message_builder.py 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #75212   +/-   ##
=======================================
  Coverage   78.21%   78.22%           
=======================================
  Files        6775     6775           
  Lines      302013   301997   -16     
  Branches    51963    51956    -7     
=======================================
+ Hits       236217   236226    +9     
+ Misses      59443    59417   -26     
- Partials     6353     6354    +1     
Files Coverage Δ
...y/integrations/slack/message_builder/base/block.py 94.05% <ø> (ø)
...sentry/integrations/slack/webhooks/options_load.py 96.36% <100.00%> (+0.20%) ⬆️
src/sentry/notifications/utils/participants.py 91.50% <100.00%> (+0.03%) ⬆️
src/sentry/utils/committers.py 91.71% <100.00%> (ø)
src/sentry/integrations/message_builder.py 88.00% <85.71%> (-0.80%) ⬇️
...entry/integrations/slack/message_builder/issues.py 92.26% <84.00%> (+6.30%) ⬆️

... and 10 files with indirect coverage changes

"""Format the release tag using the short version and make it a link"""
if not event:
return ""
Copy link
Member

Choose a reason for hiding this comment

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

Would it be better if we return None here instead of ""? Otherwise the caller will have to perform falsey checks to validate whether this was successful or not.

Copy link
Member Author

Choose a reason for hiding this comment

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

this will show up as a release tag like the below, i believe None gets rendered as "null" when dumped into json. i'm not sure which is preferable tbh

Screenshot 2024-07-30 at 15 06 55

src/sentry/utils/committers.py Outdated Show resolved Hide resolved
@cathteng cathteng force-pushed the cathy/slack/type-issues-message-builder branch from e34a292 to 9b4549d Compare July 30, 2024 22:14
@cathteng cathteng marked this pull request as ready for review July 30, 2024 22:51
@cathteng cathteng requested review from a team as code owners July 30, 2024 22:51
@cathteng cathteng requested a review from a team July 30, 2024 22:51
Copy link
Member

@asottile-sentry asottile-sentry left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@schew2381 schew2381 left a comment

Choose a reason for hiding this comment

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

for good measure

@cathteng cathteng merged commit a5885d4 into master Aug 1, 2024
49 of 50 checks passed
@cathteng cathteng deleted the cathy/slack/type-issues-message-builder branch August 1, 2024 20:06
@asottile-sentry
Copy link
Member

oops looks like this got caught in a merge race:

src/sentry/integrations/msteams/card_builder/issues.py:187: error: Argument 1 to "format_actor_options" has incompatible type "BaseQuerySet[Team, Team]"; expected "Sequence[Team | RpcUser]"  [arg-type]
src/sentry/integrations/slack/message_builder/issues.py:240: error: Argument 1 to "format_actor_options" has incompatible type "BaseQuerySet[Team, Team]"; expected "Sequence[Team | RpcUser]"  [arg-type]

@asottile-sentry asottile-sentry added the Trigger: Revert Add to a merged PR to revert it (skips CI) label Aug 1, 2024
@getsentry-bot
Copy link
Contributor

PR reverted: d2f0d29

getsentry-bot added a commit that referenced this pull request Aug 1, 2024
…75212)"

This reverts commit a5885d4.

Co-authored-by: asottile-sentry <103459774+asottile-sentry@users.noreply.github.com>
@@ -20,17 +20,17 @@


def format_actor_options(
actors: Iterable[Team | RpcUser], use_block_kit: bool = False
actors: Sequence[Team | RpcUser], is_slack: bool = False
Copy link
Member

Choose a reason for hiding this comment

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

this particular line -- the Iterable should have stayed -- probably a merge conflict sorry about that!

Copy link
Member Author

Choose a reason for hiding this comment

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

oopsie, thanks for letting me know

@github-actions github-actions bot locked and limited conversation to collaborators Aug 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components Trigger: Revert Add to a merged PR to revert it (skips CI)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants