Skip to content

feat(slack): prompt to claim Commander on auto-raised incidents - #328

Open
juanjogarciatorres43 wants to merge 3 commits into
mainfrom
feat/QC-159-auto-raised-commander-prompt
Open

feat(slack): prompt to claim Commander on auto-raised incidents#328
juanjogarciatorres43 wants to merge 3 commits into
mainfrom
feat/QC-159-auto-raised-commander-prompt

Conversation

@juanjogarciatorres43

Copy link
Copy Markdown
Collaborator

Summary

Incidents raised automatically have no human commander — the commander defaults to the automated creator (e.g. the Datadog→IMPACT receiver bot). This posts a message in the incident channel asking an invited responder to claim the Commander role, so a human takes command quickly.

What & where

A new incident_channel_done receiver (prompt_commander_when_auto_raised) posts SlackMessageIncidentAutoRaisedCommanderCall in the channel.

  • Only for auto-raised incidents — gated on incident.dedup_key being set. Automated sources always send a dedup_key; person-declared incidents leave it empty, so it reliably marks "no human commander yet". (This is the "only when we're sure it's auto-raised" guard.)
  • Self-contained — the message carries its own "Claim Commander" button (reusing UpdateRolesModal.open_action), so it doesn't depend on the ordering of the other channel-creation messages.
  • Pings the right people<!subteam^…> mentions of the Slack usergroups linked to the incident category (the same responders that get invited). Falls back to a generic prompt if the category has no usergroup.
  • Reuses the existing role-claim flow (Update Roles modal) — no new action/modal.

Wording is intentionally generic ("raised automatically") rather than Datadog-specific, to match the generic dedup_key gate.

Tests

tests/test_slack/test_auto_raised_commander_prompt.py (mocked): posts when dedup_key set, skips when empty; message blocks carry the Update-Roles action and the category usergroup mentions.

Notes

Incidents raised automatically have no human commander (the creator is the automated
caller), so post a message in the incident channel asking an invited responder to claim
the Commander role. It pings the responders from the incident category and carries its own
Update Roles button (self-contained, so message ordering does not matter), reusing the
existing role-claim flow.

Gated on the incident having a dedup_key: automated sources always set one, while
person-declared incidents leave it empty, so it reliably marks an incident with no human
commander yet. Added via an incident_channel_done receiver alongside the roles message.
Unit tests cover the gate (posts when auto-raised, skips when human-declared) and the
message blocks (Update Roles action + category usergroup mentions).
@juanjogarciatorres43
juanjogarciatorres43 marked this pull request as ready for review July 23, 2026 05:40
juanjogarciatorres43 and others added 2 commits July 23, 2026 07:44
…message

SlackMessageSurface requires get_text (notification fallback); the class only defined
get_blocks, so it could not be instantiated. Add get_text.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.22%. Comparing base (8eea070) to head (bd85ce4).

Files with missing lines Patch % Lines
src/firefighter/slack/messages/slack_messages.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #328      +/-   ##
==========================================
+ Coverage   68.19%   68.22%   +0.03%     
==========================================
  Files         218      218              
  Lines       10828    10848      +20     
  Branches     1228     1230       +2     
==========================================
+ Hits         7384     7401      +17     
- Misses       3100     3103       +3     
  Partials      344      344              
Flag Coverage Δ
unittests 68.22% <95.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants