Skip to content

fix(incidents): Sync Slack participants before visibility check for private incidents#253

Merged
rgibert merged 3 commits into
mainfrom
rgibert/fix-private-incident-visibility-sync
Jul 3, 2026
Merged

fix(incidents): Sync Slack participants before visibility check for private incidents#253
rgibert merged 3 commits into
mainfrom
rgibert/fix-private-incident-visibility-sync

Conversation

@rgibert

@rgibert rgibert commented Jun 11, 2026

Copy link
Copy Markdown
Member

The UI views checked filter_visible_to_user() before syncing participants from Slack, causing 404s for channel members whose participant records hadn't been synced to the DB yet. Meanwhile, Slack commands (e.g. /inc update) use get_incident_from_channel() which has no visibility check at all -- so a user could interact with a private incident via Slack but get a 404 when trying to view it in Firetower.

Adds a _get_visible_incident() helper that tries the normal visibility filter first (fast path), then for private incidents, force-syncs participants from Slack and re-checks visibility before returning 404. This ensures channel members are recognised on their first UI visit. The fallback path only fires for authenticated users on private incidents where they aren't already a participant/captain/reporter, so the Slack API cost is minimal.

Updated views: IncidentDetailUIView, ActionItemListView, SyncActionItemsView, SyncIncidentParticipantsView.

Refs LINEAR-RELENG-832

Agent transcript: https://claudescope.sentry.dev/share/vrooxZ-Kyb0pEjwNrvGOcI0W8sq0EcAuXNWsrfmrCKQ

…rivate incidents

The UI views checked visibility before syncing participants from Slack,
causing 404s for channel members who hadn't been synced to the DB yet.
Meanwhile, Slack commands had no visibility check at all, so channel
members could interact with private incidents via /inc but not view
them in the Firetower UI.

Add a _get_visible_incident helper that tries the normal visibility
filter first, then falls back to a force-sync from Slack for private
incidents before re-checking visibility. This ensures channel members
are recognised on their first UI visit.

Refs LINEAR-RELENG-832
Co-Authored-By: Claude <noreply@anthropic.com>

Agent transcript: https://claudescope.sentry.dev/share/Z34J4fwlHa2-tleFcG8vgI7ko2aMzMxOpyE6yfvdj5Y
Comment thread src/firetower/incidents/views.py
rgibert added 2 commits July 3, 2026 11:45
When a user goes through the visibility fallback path in
_get_visible_incident, a force sync already fires to check channel
membership. SyncIncidentParticipantsView.post() then called
sync_incident_participants_from_slack(force=True) again, wasting a
Slack API round-trip.

Stash the sync stats on the incident object during the visibility
check and reuse them in post() instead of syncing twice.

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

Agent transcript: https://claudescope.sentry.dev/share/nq_KjfQLgQvXAVm98OBQSCW9RSeli5h0kIU-ZL0ldxk
@rgibert rgibert marked this pull request as ready for review July 3, 2026 16:02
@rgibert rgibert requested a review from a team as a code owner July 3, 2026 16:02
@rgibert rgibert self-assigned this Jul 3, 2026
return int(match.group(1))


def _get_visible_incident(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice this works well

@rgibert rgibert merged commit c3e8127 into main Jul 3, 2026
33 checks passed
@rgibert rgibert deleted the rgibert/fix-private-incident-visibility-sync branch July 3, 2026 17:17
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.

2 participants