Commit bfc78e5
authored
feat(nimbus): Handle emojis added reaction (#14927)
### Because
In production, the enrollment ending notification was failing with a
Slack API error already has that reaction.
The root cause is that `send_threaded_success_message()` is being called
multiple times for the same enrollment ending request - either due to
Kinto syncs running multiple times, task retries, or periodic checks.
Each time it's called, it attempts to add the white_check_mark reaction
to the original message. On subsequent calls, the reaction already
exists, causing the API to reject the request with `already_reacted`.
Previously, any Slack API error (including `already_reacted`) was
treated as a fatal failure, logging the error and returning False. This
caused the entire notification flow to fail, even though the actual
desired state (the message exists and the reaction is on it) was already
achieved.
### This commit
Adds graceful error handling for the `already_reacted` Slack error. When
`reactions_add` fails with `already_reacted`, the error is caught and
ignored since the desired end state is already met - the reaction exists
on the message. Other Slack API errors are still re-raised and properly
logged as failures.
Additionally, this commit adds the underlying support for enrollment
ending and experiment ending request notifications with dedicated alert
types (`END_ENROLLMENT_REQUEST` and `END_EXPERIMENT_REQUEST`),
consolidates duplicate Slack notification logic, and adds comprehensive
tests to verify the fix works correctly.
Fixes #149211 parent c7aa70c commit bfc78e5
3 files changed
Lines changed: 69 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
201 | 208 | | |
202 | 209 | | |
203 | 210 | | |
| |||
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
611 | 664 | | |
612 | 665 | | |
613 | 666 | | |
| |||
0 commit comments