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

feat(metric-issues): Configure workflow notifications by group type #81609

Merged
merged 6 commits into from
Dec 13, 2024

Conversation

snigdhas
Copy link
Member

@snigdhas snigdhas commented Dec 3, 2024

Metric issues, and other detector-controlled issues, need the ability to disable workflow notifications for status changes (i.e. issue resolved/regressed/unresolved) while still sending workflow notifications for other changes to the issue such as assignments and comments.

To support this cleanly, this PR adds a field to the GroupType dataclass to allow issue types to disable the status change workflow notifications. Issue activity notifications will continue to be sent for all issue types. For issue types that do not use the existing status change workflow notifications, the issue type will be responsible for sending these notifications.

We use the new enable_status_change_workflow_notifications field to disable notifications for status-based activity types when activity.send_notification is called. Added a new test to confirm disables notifications for the MetricIssuePOC type and existing tests remain unaffected for error/other issue platform types.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Dec 3, 2024
@@ -106,7 +106,7 @@ def test_unresolve_ignored_issue(self, issue_unignored: Any) -> None:
self.projects,
self.project_lookup,
acting_user=self.user,
is_bulk=True,
is_bulk=False,
Copy link
Member Author

Choose a reason for hiding this comment

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

Here and below, the tests were set up incorrectly.

Copy link

codecov bot commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #81609      +/-   ##
==========================================
+ Coverage   80.36%   80.49%   +0.12%     
==========================================
  Files        7275     7258      -17     
  Lines      321402   322162     +760     
  Branches    20962    20805     -157     
==========================================
+ Hits       258306   259331    +1025     
+ Misses      62685    62432     -253     
+ Partials      411      399      -12     

@snigdhas snigdhas changed the title feat(metric-issues): Configure workflow notifications by groupt ype feat(metric-issues): Configure workflow notifications by group type Dec 3, 2024
Comment on lines +1020 to +1023
if "status" not in kwargs:
kwargs["status"] = GroupStatus.UNRESOLVED
kwargs["substatus"] = GroupSubStatus.NEW

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 fixes any "incorrect substatus for unresolved group" errors that stem from stricter group status validation

@snigdhas snigdhas marked this pull request as ready for review December 3, 2024 20:58
@snigdhas snigdhas requested a review from a team as a code owner December 3, 2024 20:58
@snigdhas snigdhas requested a review from wedamija December 12, 2024 18:50
@snigdhas snigdhas merged commit c445396 into master Dec 13, 2024
49 checks passed
@snigdhas snigdhas deleted the snigdha/workflow-alerts branch December 13, 2024 21:38
evanh pushed a commit that referenced this pull request Dec 17, 2024
…81609)

Metric issues, and other detector-controlled issues, need the ability to
disable workflow notifications for status changes (i.e. issue
resolved/regressed/unresolved) while still sending workflow
notifications for other changes to the issue such as assignments and
comments.

To support this cleanly, this PR adds a field to the GroupType dataclass
to allow issue types to disable the status change workflow
notifications. Issue activity notifications will continue to be sent for
all issue types. For issue types that do not use the existing status
change workflow notifications, the issue type will be responsible for
sending these notifications.

We use the new `enable_status_change_workflow_notifications` field to
disable notifications for status-based activity types when
activity.send_notification is called. Added a new test to confirm
disables notifications for the MetricIssuePOC type and existing tests
remain unaffected for error/other issue platform types.
@github-actions github-actions bot locked and limited conversation to collaborators Dec 29, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants