feat: Add 5-day post-mortem reminders and critical-incidents notifications #204
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements automated post-mortem reminders and notifications for the FireFighter incident management system:
Changes
Core Features
New Slack messages (slack_messages.py):
SlackMessageIncidentPostMortemCreatedAnnouncement: Announcement for PM creation in #critical-incidentsSlackMessagePostMortemReminder5Days: Reminder message for incident channelSlackMessagePostMortemReminder5DaysAnnouncement: Reminder announcement for #critical-incidentsNew Celery task (send_postmortem_reminders.py):
New rule function (slack/rules.py):
should_publish_pm_in_general_channel(): Determines if PM announcements should be sent to #critical-incidents (P1-P3 production incidents only)Database Changes
mitigated_attimestamp field to track when incidents reach MITIGATED statusCode Quality
postmortem_created_handler: Reduced complexity by extracting helper functions:_update_mitigated_at_timestamp()_create_confluence_postmortem()_create_jira_postmortem()_publish_postmortem_announcement()Testing Tools
backdate_incident_mitigated: Backdate incident mitigated_at timestamp for testingtest_postmortem_reminders: Execute reminder task manually with optional --list-only modeTest Plan
Files Changed
New Files
docs/contributing/testing-postmortem-reminders.mdsrc/firefighter/incidents/management/commands/backdate_incident_mitigated.pysrc/firefighter/incidents/management/commands/test_postmortem_reminders.pysrc/firefighter/incidents/migrations/0030_add_mitigated_at_field.pysrc/firefighter/slack/migrations/0009_add_postmortem_reminder_periodic_task.pysrc/firefighter/slack/tasks/send_postmortem_reminders.pyModified Files
src/firefighter/incidents/models/incident.pysrc/firefighter/jira_app/signals/postmortem_created.pysrc/firefighter/slack/messages/slack_messages.pysrc/firefighter/slack/rules.py