Answer stability round 1: 0 🔴, 3 🟡 (0 misread); read the issue types in one place, skip the epic type, and say what todo-item add files

This commit is contained in:
Lilleman
2026-11-20 13:40:07 +01:00
parent 98d1fc1eba
commit 3d3f8c9a66
7 changed files with 51 additions and 37 deletions
+9 -12
View File
@@ -6,8 +6,8 @@ import typing
from adf_codec.convert import adfs_to_markdown, markdown_to_adf, Refused
from atlassian.client import basic_auth, Http, jira_json, ToAdf, ToMarkdown
from plan_store.jira_epic import BLOCKS, FILED_BY, PROPERTY, scores
from project_config.settings import DEFAULT_ISSUE_TYPE, Epic, Finish, JIRA_FINISH_STATUS, JIRA_FINISH_TRANSITION
from atlassian.jira import DONE, entry_of, finishing_transition, ISSUE_KEY, issue_type_refusal, MAX_PAGES, move_refusal, PERHAPS_FILED, PERHAPS_MOVED, project_of, rank_refusal, searched, SHAPE, status_category, unshaped
from project_config.settings import DEFAULT_ISSUE_TYPE, Epic, Finish, JIRA_FINDING_TYPE, JIRA_FINISH_STATUS, JIRA_FINISH_TRANSITION, JIRA_REVIEW_TYPE
from atlassian.jira import DONE, entry_of, finishing_transition, ISSUE_KEY, issue_type_refusal, issue_types_of, MAX_PAGES, move_refusal, PERHAPS_FILED, PERHAPS_MOVED, project_of, rank_refusal, searched, SHAPE, status_category, unshaped
from do_epic.backend.protocol import EpicIssue, no_blocker, no_child, no_parent, no_words, unfit, unfit_label
from failure import Failure
from do_epic.repo_pick import REVIEW_LABEL
@@ -36,7 +36,7 @@ class JiraEpic:
finish: Finish | None = None
# The pages a search may take before the read fails.
max_pages: int = MAX_PAGES
# The issue types a finding and a release review (an issue labelled REVIEW_LABEL) are filed as under the epic.
# The issue types that a finding, and a release review (an issue labelled REVIEW_LABEL), are filed as.
finding_type: str = DEFAULT_ISSUE_TYPE
review_type: str = DEFAULT_ISSUE_TYPE
@@ -249,20 +249,17 @@ class JiraEpic:
return next((each for each in found if isinstance(each, Failure)), None) or [each for each in found if isinstance(each, Found)]
def child_type(self, project: str, review: bool, authorization: str) -> dict[str, str] | Failure:
"""The issue type of a new child of the epic: the type of a release review where review, else of a finding, if the project has it."""
"""The issue type of a new child of the epic, which is the type of a release review where review is true, else of a finding; or why the project can't file that type."""
name = self.review_type if review else self.finding_type
refused = issue_type_refusal(self.epic.site, project, name, authorization, self.http)
refused = issue_type_refusal(self.epic.site, project, name, JIRA_REVIEW_TYPE if review else JIRA_FINDING_TYPE, authorization, self.http)
return Failure(refused) if refused else {"name": name}
def sub_task_type(self, project: str, authorization: str) -> dict[str, str] | Failure:
"""The project's sub-task issue type, by id, since sites name it differently, such as Subtask or Sub-task."""
answered = self.http("GET", f"{self.epic.site}/rest/api/3/issue/createmeta/{project}/issuetypes", authorization, None)
if isinstance(answered, Failure):
return Failure(f"cannot read {project}'s issue types: {answered.reason}")
types = answered.get("issueTypes") if isinstance(answered, dict) else None
if not isinstance(types, list):
return Failure(f"Jira answered {project}'s issue types in a shape its REST API version 3 doesn't document")
found = next((kind["id"] for kind in types if isinstance(kind, dict) and kind.get("subtask") is True and isinstance(kind.get("id"), str)), None)
types = issue_types_of(self.epic.site, project, authorization, self.http)
if isinstance(types, Failure):
return types
found = next((kind["id"] for kind in types if kind.get("subtask") is True and isinstance(kind.get("id"), str)), None)
return Failure(f"{project} has no sub-task issue type; turn sub-tasks on in Jira") if found is None else {"id": found}