Skip to content

feat(slack): Add /ft list command to show active and mitigated incidents#194

Draft
rgibert wants to merge 4 commits into
mainfrom
rgibert/slack-list-command
Draft

feat(slack): Add /ft list command to show active and mitigated incidents#194
rgibert wants to merge 4 commits into
mainfrom
rgibert/slack-list-command

Conversation

@rgibert
Copy link
Copy Markdown
Member

@rgibert rgibert commented May 13, 2026

Add a /ft list (alias /ft ls) slash command that shows all non-private
active and mitigated incidents grouped by status. Usable from any channel or
DM -- unlike other /ft subcommands, this is a read-only cross-cutting query
rather than an action on a specific incident channel.

Output is grouped into Active then Mitigated sections, newest first within
each group. Each line shows severity, incident number, title, captain, and a
link to the Slack channel.

The query uses select_related("captain") and prefetch_related("external_links")
to avoid N+1 queries. Private incidents are excluded entirely since Slack
command context does not carry an authenticated Django user.

Agent transcript: https://claudescope.sentry.dev/share/LMXluTDxc8O5rC063_tQKM7h_nJvlTD5Ei9Ype98AyE

rgibert added 2 commits May 13, 2026 15:32
Add handle_list_command that responds with active and mitigated
incidents grouped by status, excluding private and terminal-state
incidents. Includes 8 test cases covering empty state, grouping,
ordering, privacy filtering, and link formatting.

Co-Authored-By: Claude <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/rvyzwlSQ329ffIavjmsM6NVgHwtd802c79Fm0rGkXQ4
Wire handle_list_command into the command dispatcher for both "list"
and "ls" subcommands, add them to KNOWN_SUBCOMMANDS for metrics
tracking, and include the command in help output.

Co-Authored-By: Claude <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/DjJ6t8ZO_sqbk6IHmrGQiPmWd6h3xiPjb_UJw1ZZOYs
Comment thread src/firetower/slack_app/handlers/list_incidents.py
Calls users.info to check is_restricted/is_ultra_restricted before
returning incident data. Fails open on API errors to avoid blocking
legitimate users.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/xcbdzP6-Bc8Zwpwt0cbJLk-Ux2yggnJtRBcgrkBPa2A
Comment thread src/firetower/slack_app/handlers/list_incidents.py Outdated
Title and captain name are interpolated into Slack mrkdwn without
escaping, allowing crafted titles like <http://evil|click> to inject
clickable links. Uses the existing escape_slack_text helper.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/RQcgU1pYf87GRjczZdGrgFmHpHz6XbChAMuHshP78PY
Comment thread src/firetower/slack_app/handlers/list_incidents.py
Comment thread src/firetower/slack_app/handlers/list_incidents.py
Comment thread src/firetower/slack_app/handlers/list_incidents.py
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.

1 participant