Skip to content

Clean up pending escalations after moving incident to new project

What does this MR do and why?

This handles when an Incident Issue is moved to a new project.

  • Removes any pending escalation records

A new escalation status is created on the new Issue (in the new project) by the existing process.

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

  1. Create an Incident Issue via GDK
  2. Create an Escalation Policy + rules
  3. Create the pending escalations like so:
incident = Issue.incident.last
policy = incident.project.incident_management_escalation_policies.first

# Create pending escalations
rules = policy.active_rules
rules.map do |rule|
  IncidentManagement::PendingEscalations::Issue.create!(
    target: incident,
    rule: rule,
    process_at: rule.elapsed_time_seconds.seconds.after(Time.current)
  )
end
  1. Check that the pending escalations and escalation status exist
  • incident.pending_escalations.count
  • incident.incident_management_issuable_escalation_status
  1. Move the isuse
  2. Check that pending escalations are removed
  • incident.pending_escalations.count
  1. Ensure the newwly created incident has the escalation status
  • Issue.incident.last.incident_management_issuable_escalation_status

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #330281 (closed)

Edited by Sean Arnold

Merge request reports