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

ref(rules): Add changes to rule edit confirmation notification #66847

Merged
merged 13 commits into from
Mar 14, 2024

Conversation

ceorourke
Copy link
Member

Follow up to #66285 to add details about what changed happened when a rule was edited to the notification.

Screenshot 2024-03-12 at 4 40 24 PM

Note that I've made a couple follow up tickets to address poor rendering of issue type enums and frequency: https://github.com/getsentry/team-core-product-foundations/issues/158 and https://github.com/getsentry/team-core-product-foundations/issues/157

@ceorourke ceorourke requested review from a team as code owners March 13, 2024 00:04
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 13, 2024
src/sentry/rules/actions/utils.py Outdated Show resolved Hide resolved
src/sentry/api/endpoints/project_rule_details.py Outdated Show resolved Hide resolved
src/sentry/api/endpoints/project_rule_details.py Outdated Show resolved Hide resolved
src/sentry/api/endpoints/project_rules.py Outdated Show resolved Hide resolved
src/sentry/rules/actions/utils.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Mar 13, 2024

Codecov Report

Attention: Patch coverage is 86.74699% with 11 lines in your changes are missing coverage. Please review.

Project coverage is 84.31%. Comparing base (c79d4b5) to head (68d71e6).
Report is 151 commits behind head on master.

❗ Current head 68d71e6 differs from pull request most recent head f7b5d75. Consider uploading reports for the commit f7b5d75 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #66847      +/-   ##
==========================================
+ Coverage   84.29%   84.31%   +0.01%     
==========================================
  Files        5306     5309       +3     
  Lines      237157   237411     +254     
  Branches    41016    41064      +48     
==========================================
+ Hits       199915   200165     +250     
- Misses      37023    37027       +4     
  Partials      219      219              
Files Coverage Δ
src/sentry/api/endpoints/project_rules.py 95.92% <100.00%> (ø)
src/sentry/api/serializers/models/rule.py 98.56% <100.00%> (ø)
.../sentry/integrations/slack/actions/notification.py 87.36% <100.00%> (+0.41%) ⬆️
...ck/message_builder/notifications/rule_save_edit.py 100.00% <100.00%> (ø)
src/sentry/rules/actions/base.py 80.76% <100.00%> (+0.76%) ⬆️
src/sentry/api/endpoints/project_rule_details.py 91.09% <90.00%> (-0.15%) ⬇️
src/sentry/rules/actions/utils.py 83.05% <83.05%> (ø)

... and 73 files with indirect coverage changes

@ceorourke ceorourke force-pushed the ceorourke/edit-notification-details branch from 87872e2 to 4ae40b8 Compare March 13, 2024 19:46
src/sentry/rules/actions/utils.py Outdated Show resolved Hide resolved
src/sentry/rules/actions/utils.py Outdated Show resolved Hide resolved
src/sentry/rules/actions/utils.py Outdated Show resolved Hide resolved
src/sentry/rules/actions/utils.py Outdated Show resolved Hide resolved
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.

lgtm

old_value = prior_state.get(key)
new_value = present_state.get(key)
return f"Changed {word} from *{old_value}* to *{new_value}*"
return None
Copy link
Contributor

Choose a reason for hiding this comment

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

small nit: can skip returning None

Copy link
Member Author

Choose a reason for hiding this comment

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

mypy wouldn't let me 😭

Copy link
Contributor

@schew2381 schew2381 Mar 13, 2024

Choose a reason for hiding this comment

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

apparently by design: python/mypy#7511 (comment)

There's a flag --no-warn-no-return to disable this but looks like we don't have it on

@ceorourke ceorourke merged commit 09ee295 into master Mar 14, 2024
48 checks passed
@ceorourke ceorourke deleted the ceorourke/edit-notification-details branch March 14, 2024 16:33
JonasBa pushed a commit that referenced this pull request Mar 17, 2024
Follow up to #66285 to add
details about what changed happened when a rule was edited to the
notification.

<img width="748" alt="Screenshot 2024-03-12 at 4 40 24 PM"
src="https://github.com/getsentry/sentry/assets/29959063/e0d7c5ca-35e5-4a66-bc67-e53c8d27dcce">


Note that I've made a couple follow up tickets to address poor rendering
of issue type enums and frequency:
getsentry/team-core-product-foundations#158
and
getsentry/team-core-product-foundations#157

---------

Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2024
Comment on lines +79 to +84
if rule_data_before.get("environment_id") and not rule_data.get("environment_id"):
environment = None
try:
environment = Environment.objects.get(id=rule_data.get("environment_id"))
except Environment.DoesNotExist:
pass
Copy link
Member

Choose a reason for hiding this comment

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

I'm pretty sure this is a typo -- the type checker is pointing this out as a bug when I enable model checking

this is always passing id=None here -- should this be using rule_data_before["environment_id"] instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fix here - #73665

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants