Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

Conversation

@whitdog47
Copy link
Contributor

This PR adds comprehensive Slack Canvas integration to Dispatch, enabling automatic creation and management of participants canvases for both incidents and cases. The feature provides real-time visibility of participants in incident and cases with dedicated Slack channels and automatic role updates.

Key Features

Slack Canvas API Integration

  • Added new Slack Canvas API endpoints to the plugin enums
  • Implemented create_canvas, edit_canvas, and delete_canvas functions in the Slack service
  • Added robust error handling with graceful degradation (logs errors instead of re-raising)

Participants Canvas Management

  • Automatic Creation: Canvas created when incidents/cases are created (after participants resolved)
  • Real-time Updates: Canvas updated when participants are added, removed, or roles change
  • Role-based Organization: Participants grouped by role with dynamic headings (e.g., "Incident Commander" vs "Incident Commanders")
  • Empty State Handling: Shows "No participants" message when no participants exist

Database Integration

  • Created new Canvas SQLAlchemy model with TimeStampMixin and ProjectMixin
  • Added CanvasType enum with participants type
  • Implemented full CRUD operations in canvas/service.py
  • Added bidirectional relationships to Incident.canvases and Case.canvases

Lifecycle Integration

  • Incident Flows: Canvas created in incident_create_resources, updated in participant flows
  • Case Flows: Canvas created in case_create_resources_flow, updated in participant flows
  • Self-healing: Canvas automatically recreated if missing during updates
  • Error Resilience: Participant processing errors don't break canvas creation

Robust Error Handling

  • Added comprehensive safety checks for conversation and channel_id existence
  • Implemented graceful error handling in case creation flows
  • Canvas operations continue even if participant processing fails
  • All errors logged with appropriate levels (DEBUG, WARNING, ERROR)

Technical Implementation

Canvas Content Generation

  • Role-based sorting with priority: Incident Commander > Scribe > Reporter > Participant > Observer
  • Dynamic pluralization of role headings (e.g., "Incident Commander" vs "Incident Commanders")
  • Clean bulleted list format for easy reading
  • Handles empty participant lists gracefully

Permission Management

  • Incidents: Incident Commander gets edit permissions
  • Cases: Case Assignee gets edit permissions
  • Canvas locked to specific users to prevent unauthorized edits

Integration Points

  • Incident Creation: Canvas created after all participants resolved
  • Participant Addition: Canvas updated when new participants added
  • Participant Removal: Canvas updated when participants removed
  • Role Assignment: Canvas updated when roles change

Files Changed

New Files

  • src/dispatch/canvas/ - New canvas package
    • models.py - Canvas SQLAlchemy model
    • service.py - CRUD operations
    • enums.py - CanvasType enum
    • flows.py - Canvas creation/update logic

Modified Files

  • src/dispatch/plugins/dispatch_slack/
    • enums.py - Added Canvas API endpoints
    • service.py - Added canvas API functions
    • plugin.py - Added canvas methods to plugin instance
  • src/dispatch/incident/flows.py - Integrated canvas creation/updates
  • src/dispatch/case/flows.py - Integrated canvas creation/updates
  • src/dispatch/incident/models.py - Added canvases relationship
  • src/dispatch/case/models.py - Added canvases relationship

@whitdog47 whitdog47 self-assigned this Aug 30, 2025
@whitdog47 whitdog47 added the enhancement New feature or request label Aug 30, 2025

This comment was marked as outdated.

@whitdog47 whitdog47 force-pushed the feat/slack-canvas-api branch from 702d897 to 843ce59 Compare August 30, 2025 00:24
@whitdog47 whitdog47 requested a review from Copilot August 30, 2025 00:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comprehensive Slack Canvas integration to Dispatch, enabling automatic creation and management of participants canvases for both incidents and cases. The feature provides real-time visibility of participants with dedicated Slack canvases and automatic role updates.

  • Implements new Slack Canvas API endpoints with create, edit, and delete functionality
  • Creates database models and CRUD operations for canvas management
  • Integrates canvas lifecycle management into incident and case flows with automatic creation and updates

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/dispatch/plugins/dispatch_slack/service.py Added Canvas API functions and updated string formatting
src/dispatch/plugins/dispatch_slack/plugin.py Added Canvas methods to plugin instance
src/dispatch/plugins/dispatch_slack/enums.py Added Canvas API endpoints
src/dispatch/incident/models.py Added canvases relationship
src/dispatch/incident/flows.py Integrated canvas creation and update flows
src/dispatch/database/revisions/tenant/versions/2025-08-28_ff08d822ef2c.py Database migration for canvas table
src/dispatch/case/models.py Added canvases relationship
src/dispatch/case/flows.py Integrated canvas creation and update flows
src/dispatch/canvas/service.py CRUD operations for canvas management
src/dispatch/canvas/models.py SQLAlchemy model and Pydantic schemas
src/dispatch/canvas/flows.py Canvas creation and update business logic
src/dispatch/canvas/enums.py Canvas type enumeration
src/dispatch/canvas/init.py Module initialization
src/dispatch/init.py Added canvas model import

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@jneelamekam
Copy link
Contributor

@whitdog47 : The changes look good to me.

@whitdog47 whitdog47 merged commit dd2837e into main Sep 3, 2025
13 of 14 checks passed
@whitdog47 whitdog47 deleted the feat/slack-canvas-api branch September 3, 2025 04:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants