Answer stability round 1: 2 🔴, 5 🟡 (0 misread); fixed the import order and the unused return, tested the scenario steps offline, passed env and timeout in, reused the paged search

This commit is contained in:
2026-11-19 04:52:10 +01:00
parent 6ee55681a3
commit 587363c3ed
7 changed files with 255 additions and 59 deletions
+6 -5
View File
@@ -6,6 +6,7 @@ from atlassian.client import basic_auth, Http, jira_json, ToAdf
from failure import Failure
from adf_codec.convert import markdown_to_adf
from do_epic.e2e.settings import Sandbox
from plan_store.jira_epic import searched
EPIC_TYPE = "Epic"
# How a team-managed project's workflow moves an issue to done, as do-epic's `jira-finish-transition` and `jira-finish-status` name it.
@@ -61,11 +62,11 @@ def epic_made(sandbox: Sandbox, summary: str, http: Http = jira_json, to_adf: To
def deleted_with_children(sandbox: Sandbox, key: str, authorization: str, http: Http) -> None | Failure:
"""Deletes the epic's child issues, with their sub-tasks, and then the epic: Jira deletes an epic's sub-tasks along with it, but not its child issues."""
children = http("POST", api(sandbox, "search/jql"), authorization, {"jql": f"parent = {key}", "fields": ["summary"], "maxResults": 100})
found = children.get("issues") if isinstance(children, dict) else None
# The first failure is the one to report; the epic is deleted all the same.
problem = children if isinstance(children, Failure) else None if isinstance(found, list) else Failure(f"Jira answered the search for {key}'s issues with {children!r}, which holds no issues")
for each in [*(item.get("key") for item in found if isinstance(item, dict)), key] if isinstance(found, list) else [key]:
found = searched(sandbox.jira_url, f"the issues of {key}", f"parent = {key}", {"fields": ["summary"]}, authorization, http)
# The epic is deleted all the same; the first failure is the one to report.
problem = found if isinstance(found, Failure) else None
children = [] if isinstance(found, Failure) else [item["key"] for item in found if isinstance(item, dict) and isinstance(item.get("key"), str)]
for each in [*children, key]:
deleted = http("DELETE", api(sandbox, f"issue/{each}?deleteSubtasks=true"), authorization, None)
problem = problem or (deleted if isinstance(deleted, Failure) else None)
return problem