fix(incidents): Sync Slack participants before visibility check for private incidents#253
Merged
Merged
Conversation
…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
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
spalmurray
reviewed
Jul 3, 2026
| return int(match.group(1)) | ||
|
|
||
|
|
||
| def _get_visible_incident( |
spalmurray
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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) useget_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