This repository was archived by the owner on Sep 3, 2025. It is now read-only.
feat(case): copy case timeline events to incident on escalation#6068
Merged
Conversation
Contributor
There was a problem hiding this comment.
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_incidentfunction to replicate events. - Integrates the copy step into
common_escalate_flowafter 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_incidentare committed to the database; iflog_incident_eventdoes not commit internally, consider callingdb_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(
aaronherman
approved these changes
Jun 23, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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
common_escalate_flowused during the escalation process.