You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/architecture/jira-integration.md
+86-55Lines changed: 86 additions & 55 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,16 @@
5
5
The RAID module provides comprehensive bidirectional synchronization between Impact incidents and JIRA tickets, ensuring data consistency across both platforms.
6
6
7
7
✅ **Applies to all P1-P5**:
8
+
8
9
- All priorities create both `Incident` objects AND JIRA tickets
9
10
- The JIRA integration works identically for all priorities
10
11
12
+
✅ **Double sync (both directions)**:
13
+
14
+
- Impact → Jira: on incident updates (status, priority, title, description, commander) via `incident_updated` signals; admin saves fall back to post_save handlers for status/priority
15
+
- Jira → Impact: on Jira webhooks (status, priority, mapped fields) via webhook handlers
16
+
- Loop-prevention cache ensures a change coming from one side is not re-sent back immediately
17
+
11
18
See [incident-workflow.md](incident-workflow.md) for architecture overview.
12
19
13
20
## Synchronization Architecture
@@ -37,25 +44,29 @@ See [incident-workflow.md](incident-workflow.md) for architecture overview.
37
44
Centralizes all JIRA field preparation for both P1-P3 and P4-P5 workflows.
@@ -66,117 +77,114 @@ Centralizes all JIRA field preparation for both P1-P3 and P4-P5 workflows.
66
77
67
78
### Impact → JIRA Sync
68
79
69
-
**Trigger**: Incident field updates in Impact
70
-
**Handler**: `sync_incident_changes_to_jira()`
80
+
**Trigger**: Incident field updates in Impact (via `incident_updated` with `updated_fields`), plus admin saves via post_save fallbacks for status/priority.
81
+
82
+
**Handlers**: `incident_updated_close_ticket_when_mitigated_or_postmortem` (status), `incident_updated_sync_priority_to_jira` (priority), post_save fallbacks for both.
71
83
72
84
**Syncable Fields**:
85
+
73
86
-`title` → `summary`
74
87
-`description` → `description`
75
-
-`priority` → `priority` (with value mapping)
76
-
-`status` → `status` (with transitions)
88
+
-`priority` → Jira `customfield_11064` (numeric 1–5, or mapped option)
89
+
-`status` → Jira status (transitions via workflow)
77
90
-`commander` → `assignee`
78
91
79
92
**Process**:
93
+
80
94
1. Check if RAID is enabled
81
-
2. Validateupdate_fields parameter
82
-
3.Filter for syncable fields only
83
-
4.Apply loop prevention cache
84
-
5.Call `sync_incident_to_jira()`
95
+
2. Validate/update_fields
96
+
3.Apply loop prevention
97
+
4.Push status (Impact→Jira map)
98
+
5.Push priority to Jira `customfield_11064`
85
99
86
100
### JIRA → Impact Sync
87
101
88
102
**Trigger**: JIRA webhook updates
103
+
89
104
**Handler**: `handle_jira_webhook_update()`
90
105
91
106
**Process**:
107
+
92
108
1. Parse webhook changelog data
93
109
2. Identify changed fields
94
-
3. Apply appropriate sync functions:
95
-
-`sync_jira_status_to_incident()`
96
-
-`sync_jira_priority_to_incident()`
97
-
-`sync_jira_fields_to_incident()`
110
+
3. For each changelog item, a single helper `_sync_jira_fields_to_incident()` handles:
111
+
- Loop-prevention check (skips if mirrored Impact→Jira change)
Uses the numeric Jira priority (1–5) and writes directly to Impact.
150
+
151
+
**Impact → JIRA**:
152
+
153
+
Uses the numeric Impact priority (1–5) and writes directly to Jira `customfield_11064`. Admin saves and UI edits both sync via signals/post_save fallback.
**Webhook bounce guard**: Impact→Jira writes a short-lived cache key per change (`sync:impact_to_jira:{incident_id}:{field}:{value}`). Jira webhook processing checks and clears that key to skip the mirrored change, preventing loops for status and priority (including `customfield_11064`).
166
172
167
173
## Error Handling
168
174
169
175
### Transaction Management
170
176
171
-
- All sync operations wrapped in `transaction.atomic()`
172
-
- Rollback on any failure
177
+
- Incident update creation uses `transaction.atomic()` (in `Incident.create_incident_update`) to ensure `IncidentUpdate` persistence and recovered-event handling.
178
+
- Jira webhook and Impact→Jira signal handlers are not wrapped in `transaction.atomic()` today (they call out to Jira directly).
179
+
- Rollback on any failure where wrapped; external Jira calls are best-effort and may partially succeed.
173
180
- Detailed error logging with context
174
181
175
182
### Graceful Degradation
176
183
177
-
- Missing JIRA tickets: Log warning, continue
178
-
- Field validation errors: Skip invalid fields
179
-
- Network failures: Retry mechanism via Celery
184
+
- Missing JIRA tickets: Log warning and continue (no rollback).
185
+
- Field validation errors: Skip invalid fields (best-effort persist).
186
+
- Jira/Slack calls: Best-effort with exception logging; no automatic retry in the sync handlers today.
187
+
- Celery retries apply only to the dedicated Celery tasks (not the webhook/signal handlers).
The Jira post-mortem feature creates dedicated post-mortem issues in Jira when an incident moves to the POST_MORTEM status. This provides a structured place to document root causes, impacts, and mitigation actions.
0 commit comments