fix(jira): correct ticket hierarchy — campaigns=Epic, all tests=Task
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled

- Campaign issue type changed from Task to Epic (required to nest under
  Initiative OFS-20795 in classic Jira)
- Added customfield_10011 (Epic Name) — required when creating Epics
- Removed JIRA_ISSUE_TYPE_SUBTASK; all tests are now Task regardless of
  whether they are inside a campaign or standalone
- Standalone tests use the configured standalone parent (OFS-20798, an
  Epic) so Task→Task parent is never attempted
- Campaign tests use the campaign Epic key passed via parent_ticket_override

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
kitos
2026-05-27 16:29:50 +02:00
parent 27184627f8
commit d8a0b0c449
2 changed files with 12 additions and 22 deletions

View File

@@ -406,9 +406,11 @@ def auto_create_campaign_issue(
"description": _build_campaign_description(campaign),
"issuetype": {"name": settings.JIRA_ISSUE_TYPE_CAMPAIGN},
"labels": ["aegis", "campaign"],
# customfield_10011 = Epic Name (required for Epic type in classic Jira)
"customfield_10011": campaign.name,
}
# Always nest under the configured parent ticket (e.g. OFS-9107)
# Nest under the configured parent ticket (Initiative, e.g. OFS-20795)
if parent_ticket:
fields["parent"] = {"key": parent_ticket}
@@ -478,24 +480,13 @@ def auto_create_test_issue(
try:
jira = get_user_jira_client(actor, db)
# Resolve parent and issue type together:
# - campaign parent override → Sub-task (Task cannot parent Task)
# - explicit standalone parent configured → Sub-task (same reason;
# the standalone parent is a Task, e.g. OFS-20798)
# - only the general parent ticket (Epic) → Task
standalone_parent = get_jira_parent_ticket_standalone(db)
general_parent = get_jira_parent_ticket(db)
parent = parent_ticket_override or standalone_parent
has_explicit_parent = bool(
parent_ticket_override
or (standalone_parent and standalone_parent != general_parent)
)
issue_type = (
settings.JIRA_ISSUE_TYPE_SUBTASK
if has_explicit_parent
else settings.JIRA_ISSUE_TYPE_TEST
)
# All tests — whether inside a campaign or standalone — are created
# as Task. Campaign tests use the campaign Jira key as parent
# (passed via parent_ticket_override); standalone tests use the
# configured standalone parent ticket (e.g. OFS-20798, which is an
# Epic so it can parent Tasks).
parent = parent_ticket_override or get_jira_parent_ticket_standalone(db)
issue_type = settings.JIRA_ISSUE_TYPE_TEST # always Task
fields: dict = {
"project": {"key": project_key},