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 implements the automatic copying of timeline events from a case to a new incident when a case is escalated. This ensures that all relevant context and history from the case is preserved and visible in the incident’s timeline.

Details

  • New Functionality:
    • When a case is escalated to an incident, all timeline events associated with the case are copied to the new incident.
    • The copied events retain their original details (description, timestamps, owner, etc.) and are marked as having been copied from the case.
  • Integration:
    • The copying logic is integrated into the common_escalate_flow used during the escalation process.
  • Testing:
    • Added a unit test to verify that case events are correctly copied to the incident and that the original case events remain unchanged.

@whitdog47 whitdog47 requested review from aaronherman and Copilot June 20, 2025 01:11
@whitdog47 whitdog47 self-assigned this Jun 20, 2025
@whitdog47 whitdog47 added the enhancement New feature or request label Jun 20, 2025
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 automatic copying of timeline events from a case to a new incident when the case is escalated.

  • Introduces a new copy_case_events_to_incident function to replicate events.
  • Integrates the copy step into common_escalate_flow after the incident is created.
  • Adds a unit test to verify that case events are copied correctly.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/case/test_case_service.py Added test_copy_case_events_to_incident to validate event copying.
src/dispatch/case/flows.py Implemented copy_case_events_to_incident, updated imports, and integrated it into the escalation flow.
Comments suppressed due to low confidence (3)

tests/case/test_case_service.py:282

  • Consider adding assertions to verify that other event attributes (description, timestamps, owner, details) are copied correctly, not just the source, to ensure complete test coverage.
    for event in incident_events_after:

src/dispatch/case/flows.py:833

  • Ensure that changes from copy_case_events_to_incident are committed to the database; if log_incident_event does not commit internally, consider calling db_session.commit() after copying.
    copy_case_events_to_incident(case=case, incident=incident, db_session=db_session)

src/dispatch/case/flows.py:771

  • Consider wrapping the event-copying loop in a transaction or adding error handling to ensure atomicity and rollback on failure.
def copy_case_events_to_incident(

@whitdog47 whitdog47 merged commit 8883944 into main Jun 23, 2025
9 checks passed
@whitdog47 whitdog47 deleted the feat/copy-case-timeline-on-escalation branch June 23, 2025 18:39
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