Skip to content

Commit 19ca193

Browse files
fix: map integer priority to Jira name in ACLI create_issue (Outbound Bridge) (merge worktree-20260324-164324)
2 parents f978c57 + 05f1422 commit 19ca193

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

plugins/dso/scripts/acli-integration.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@
2828
_MAX_ATTEMPTS: int = 3 # initial + 2 retries
2929
_AUTH_FAILURE_CODE: int = 401
3030

31+
# Local priority integer (0-4) → Jira priority name.
32+
# Mirrors the mapping in bridge-outbound.py.
33+
_LOCAL_PRIORITY_TO_JIRA: dict[int, str] = {
34+
0: "Highest",
35+
1: "High",
36+
2: "Medium",
37+
3: "Low",
38+
4: "Lowest",
39+
}
40+
3141

3242
# ---------------------------------------------------------------------------
3343
# Internal helpers
@@ -160,12 +170,19 @@ def _create_issue_from_json(
160170
directly to Jira REST API fields. Priority requires
161171
``{"name": "<Jira priority name>"}``.
162172
"""
173+
# Convert integer priority (0-4) to Jira priority name.
174+
# If already a string name, use as-is.
175+
if isinstance(priority, int):
176+
jira_priority_name = _LOCAL_PRIORITY_TO_JIRA.get(priority, "Medium")
177+
else:
178+
jira_priority_name = str(priority)
179+
163180
payload: dict[str, Any] = {
164181
"projectKey": project,
165182
"type": issue_type,
166183
"summary": summary,
167184
"additionalAttributes": {
168-
"priority": {"name": str(priority)},
185+
"priority": {"name": jira_priority_name},
169186
},
170187
}
171188
if kwargs.get("description"):

tests/scripts/test_bridge_acli_field_coverage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ def capturing_dump(obj: Any, fp: Any, **kw: Any) -> None:
152152
assert "name" in priority_field, (
153153
f"additionalAttributes.priority should have a 'name' key. Got: {priority_field}"
154154
)
155-
assert priority_field["name"] == "1", (
156-
f"additionalAttributes.priority.name should be '1' (str(priority)). "
155+
assert priority_field["name"] == "High", (
156+
f"additionalAttributes.priority.name should be 'High' (mapped from int 1). "
157157
f"Got: {priority_field['name']!r}"
158158
)
159159

0 commit comments

Comments
 (0)