File findings, release reviews and added items as the issue types the settings name, and refuse a type the Jira project lacks #660

Merged
lilleman merged 13 commits from item-453 into main 2026-11-20 14:06:50 +01:00
20 changed files with 216 additions and 62 deletions
+1
View File
@@ -2,6 +2,7 @@
## Unreleased
- do-epic and `todo-item add` file issues as the Jira issue types the settings `jira-finding-type` and `jira-review-type` name, Task by default, and refuse before filing where the Jira project lacks the type, naming the types it has.
- do-epic names the team's own label for each repo, from the `[label-repos]` table, when it tells a chunk's worker how to file a finding or a release review, and keeps `repo:<name>` for a repo the table doesn't name.
- do-epic records a repo pick, and the summary of each sub-task it files, in the team's own spelling: a label from the `[label-repos]` table of its config, and a `sub-task-summary` template with `{label}` and `{Summary}`.
- Add `do-epic <EPIC-KEY> --dry-run`, which prints every Jira write planning would make and each chunk that would start, and makes none of them.
+2 -1
View File
@@ -134,7 +134,7 @@ A client that plans in Jira Cloud names an epic as its project's plan: `plan = "
A read fails, naming the issue, where a child is in another Jira project or names no such Fix Version. The config's `env-file` must hold `ATLASSIAN_EMAIL` and `ATLASSIAN_API_TOKEN`, an API token of that Atlassian account, and only its owner may read that file: `chmod 600` it.
The loop reads such a plan and files items into it, each as a Task under the epic. `todo-item add` needs the item's release among the Jira project's Fix Versions, named as `1.2.0` or `v1.2.0`. The config states the formula and the bar that a todo.md states under `## Scoring`, such as `jira-score-formula = "100 * V / (2**S + 8)"` and `jira-score-bar = 1`, and fails to load without them. `todo-item add` refuses an item that scores under the bar, unless it is exempt. It ranks the new issue among the issues the loop filed: questions first, then security findings, then by score. A person's issues keep the rank the team gave them, and `rank_todo.py` doesn't rank the plan.
The loop reads such a plan and files each item into it as a Task under the epic. A Jira project that has no Task type, such as TW, sets `jira-finding-type` to a type it has, such as `"Feature"`. `todo-item add` fails, naming the project's types, where the project lacks the type set. `todo-item add` also needs the item's release among the Jira project's Fix Versions, named as `1.2.0` or `v1.2.0`. The config states the formula and the bar that a todo.md states under `## Scoring`, such as `jira-score-formula = "100 * V / (2**S + 8)"` and `jira-score-bar = 1`, and fails to load without them. `todo-item add` refuses an item that scores under the bar, unless it is exempt. It ranks the new issue among the issues the loop filed: questions first, then security findings, then by score. A person's issues keep the rank the team gave them, and `rank_todo.py` doesn't rank the plan.
`todo-item edit` and `move` change only an issue the loop filed. Of an issue a person filed, `edit` sets only the scores, and posts its `--comment` on the issue to tell the team why; the summary, description and Fix Version stay the team's to change in Jira, as do its links. On an issue the loop filed, `edit --blocked-by` makes and deletes the links to the epic's open items. For `todo-item finish`, the config names the workflow transition that finishes an item and the status it leads to, both as Jira shows them: `jira-finish-transition = "Mark as done"` and `jira-finish-status = "Done"`. Finish then moves the item's issue by that transition. It refuses a transition that leads to another status, or to one Jira doesn't count as done, and fails where the config sets neither. The four things not supported for a plan outside the checkout, above, are not supported for a plan in Jira either.
@@ -158,6 +158,7 @@ The last line prints each setting's path once the config is complete.
- `config.toml` fits do-epic to a team whose own automation moves issues, such as a CI job that moves an issue when its pull request merges. Two settings do:
- `jira-unblocking-statuses` lists the statuses at which an issue's work has landed though Jira doesn't count it done yet, such as `["Release Ready"]`, in upper or lower case. An issue in one of them takes no chunk and no longer blocks the issues it blocks, and `--status` names the statuses beside each blocker. A status Jira counts as done always does both. The release reviews, which are the epic's last chunk, still wait until Jira counts every issue done: run `do-epic <EPIC-KEY>` then, to start them.
- `jira-automation-moves-issues = true` keeps do-epic from moving the issue of a finished chunk in a repo: the automation moves it, and do-epic waits for that move before it starts what the issue blocks. An issue without a repo has no pull request, so do-epic still moves it, with `jira-finish-transition`. The setting needs `jira-unblocking-statuses`, which names the status the automation gives an issue whose pull request merged.
- `config.toml` may set `jira-finding-type`, the issue type do-epic files a finding as, and `jira-review-type`, the one it files a repo's release review as, such as `"Feature"` and `"Chore"`. Both are Task where left out. do-epic doesn't file anything where the Jira project lacks the type, and says which types it has.
- `config.toml` may set `sub-task-summary`, which shapes the summary of each sub-task do-epic files for an issue that changes several repos, such as `sub-task-summary = "{label}: {Summary}"`. `{label}` is the team's label for the repo, else the repo's name, and `{Summary}` is the issue's summary with a capital first letter. It must hold `{Summary}`. Without it a summary is `[<repo>] <the issue's summary>`.
- `config.toml` may end with a `[label-repos]` table, for a team that already labels its issues by repo. Give it one line for each such label: the label, then the repo's name, such as `twu-4 = "tenant-web-ui-4"`. do-epic reads such a label as it reads its own `repo:<name>`. Where the label is the repo's name, map the name to itself, as in `core-4 = "core-4"`. Where several lines name one repo, do-epic writes the label of the first. Write every other setting above the table.
- `repo-rule.md` is prose that says how to tell an item's repo, such as "a label that equals a repo's name names that repo". It may not be blank. `do-epic <EPIC-KEY>` uses it to pick where each open issue without such a label is worked, and records the pick as a label. For a repo that is the team's own label from `[label-repos]`, else `repo:<name>`; for work of Claude's that changes no repo, `do-epic-claude`; for a task of yours, `do-epic-human`. Where the rule leaves an issue unclear, do-epic asks you on the terminal. Answer with the label, or with Enter alone to leave the issue waiting. Change a pick by editing the label in Jira.
+26
View File
@@ -6,6 +6,7 @@ import typing
from failure import Failure
from project_config.settings import Finish, JIRA_FINISH_STATUS, JIRA_FINISH_TRANSITION
from atlassian.client import Http
from text_files.markdown_text import listed
ISSUE_KEY = re.compile(r"([A-Z][A-Z0-9_]*)-([0-9]+)")
PAGE = 100
@@ -13,6 +14,8 @@ PAGE = 100
MAX_PAGES = 100
# The key of the status category Jira Cloud gives every done status.
DONE = "done"
# The hierarchyLevel of the epic issue type in the issue types Jira lists.
EPIC_LEVEL = 1
# How a Failure names an answer in which a field is missing or of another type.
SHAPE = "is not in the shape Jira Cloud's REST API version 3 documents"
# What a failed create ends with: a request Jira never answered, or answered brokenly, may still have filed the issue.
@@ -115,6 +118,29 @@ def transition_of(offered: object, key: str, finish: Finish) -> str | Failure:
return id_
def issue_types_of(site: str, project: str, authorization: str, http: Http) -> list[dict[str, typing.Any]] | Failure:
"""The issue types Jira lists for the project, each with a name, or why it listed none."""
answered = http("GET", f"{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) or not all(isinstance(each, dict) and isinstance(each.get("name"), str) for each in types):
return Failure(f"Jira answered {project}'s issue types in a shape its REST API version 3 doesn't document")
return types
def issue_type_refusal(site: str, project: str, kind: str, setting: str, authorization: str, http: Http) -> str | None:
"""Why the project can't file a new issue under an epic as the type named kind, which the setting `setting` names; None where it can."""
types = issue_types_of(site, project, authorization, http)
if isinstance(types, Failure):
return types.reason
# An issue under an epic is a standard one: Jira refuses a sub-task there, and an epic under an epic.
names: list[str] = [each["name"] for each in types if each.get("subtask") is not True and each.get("hierarchyLevel") != EPIC_LEVEL]
if kind in names:
return None
return f"{project} has no issue type {kind!r} for an issue under an epic; " + (f"it has {listed(names, 'and')}: name one in `{setting}`" if names else "it has no other type for one")
def project_of(key: str) -> str:
"""The key of the Jira project an issue key lies in."""
return key.rpartition("-")[0]
+37
View File
@@ -70,5 +70,42 @@ class TheCategoryOfAnIssuesStatus(unittest.TestCase):
self.assertEqual(jira.status_category(wrong), Failure("its status category has no key that is text"))
class TheRefusalOfAnIssueType(unittest.TestCase):
TYPES = {"issueTypes": [{"name": "Feature", "subtask": False, "hierarchyLevel": 0}, {"name": "Bug", "subtask": False, "hierarchyLevel": 0}, {"name": "Epic", "subtask": False, "hierarchyLevel": 1}, {"name": "Subtask", "subtask": True, "hierarchyLevel": -1}]}
def refusal(self, kind: str, answer: object) -> str | None:
asked: list[tuple[str, str, object]] = []
def http(method: str, url: str, authorization: str, body: object) -> object:
asked.append((method, url, body))
return answer
refused = jira.issue_type_refusal("https://acme.atlassian.net", "ABC", kind, "jira-finding-type", "Basic x", http)
self.assertEqual(asked, [("GET", "https://acme.atlassian.net/rest/api/3/issue/createmeta/ABC/issuetypes", None)])
return refused
def test_is_none_where_the_project_has_the_type(self):
self.assertIsNone(self.refusal("Bug", self.TYPES))
def test_names_the_types_the_project_has_and_the_setting_where_it_lacks_the_type(self):
self.assertEqual(self.refusal("Task", self.TYPES), "ABC has no issue type 'Task' for an issue under an epic; it has Feature and Bug: name one in `jira-finding-type`")
def test_a_sub_task_type_and_the_epic_type_are_not_ones_for_an_issue_under_an_epic(self):
for kind in ("Subtask", "Epic"):
with self.subTest(kind=kind):
self.assertEqual(self.refusal(kind, self.TYPES), f"ABC has no issue type {kind!r} for an issue under an epic; it has Feature and Bug: name one in `jira-finding-type`")
def test_says_the_project_has_no_other_type_where_it_has_only_sub_task_types(self):
self.assertEqual(self.refusal("Bug", {"issueTypes": [{"name": "Subtask", "subtask": True}]}), "ABC has no issue type 'Bug' for an issue under an epic; it has no other type for one")
def test_says_why_where_jira_fails(self):
self.assertEqual(self.refusal("Bug", Failure("Jira answered 403")), "cannot read ABC's issue types: Jira answered 403")
def test_says_so_where_jira_answers_in_another_shape(self):
for wrong in ([], {}, {"issueTypes": "Bug"}, {"issueTypes": [{"subtask": False}]}):
with self.subTest(wrong=wrong):
self.assertEqual(self.refusal("Bug", wrong), "Jira answered ABC's issue types in a shape its REST API version 3 doesn't document")
if __name__ == "__main__":
unittest.main()
+18 -11
View File
@@ -5,11 +5,12 @@ 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, ISSUE_TYPE, PROPERTY, scores
from atlassian.jira import DONE, entry_of, finishing_transition, ISSUE_KEY, MAX_PAGES, move_refusal, PERHAPS_FILED, PERHAPS_MOVED, project_of, rank_refusal, searched, SHAPE, status_category, unshaped
from project_config.settings import Epic, Finish, JIRA_FINISH_STATUS, JIRA_FINISH_TRANSITION
from plan_store.jira_epic import BLOCKS, FILED_BY, PROPERTY, scores
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
FIELDS = ["summary", "description", "labels", "assignee", "status", "parent", "issuelinks"]
# How many child issues one search for sub-tasks names, which keeps its JQL well inside the length Jira takes.
@@ -35,6 +36,9 @@ class JiraEpic:
finish: Finish | None = None
# The pages a search may take before the read fails.
max_pages: int = MAX_PAGES
# 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
@property
def epic_key(self) -> str:
@@ -66,7 +70,7 @@ class JiraEpic:
fields: dict[str, typing.Any] = {"project": {"key": project_of(parent)}, "parent": {"key": parent}, "summary": summary, "labels": list(labels)}
# Marks the issue as the loop's, as plan_store marks the items it files.
properties = [{"key": PROPERTY, "value": {FILED_BY[0]: FILED_BY[1]}}]
kind = {"name": ISSUE_TYPE} if parent == self.epic_key else self.sub_task_type(project_of(parent), authorization)
kind = self.child_type(project_of(parent), REVIEW_LABEL in labels, authorization) if parent == self.epic_key else self.sub_task_type(project_of(parent), authorization)
if isinstance(kind, Failure):
return kind
if detail.strip():
@@ -244,15 +248,18 @@ class JiraEpic:
found = [found_of(raw) for raw in answered]
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, 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, 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}
+24 -5
View File
@@ -13,6 +13,7 @@ from do_epic.backend.contract import EpicStoreContract
from failure import Failure
from do_epic.backend.jira import JiraEpic
from adf_codec.convert import Refused
from do_epic.repo_pick import REVIEW_LABEL
SITE = "https://acme.atlassian.net"
EPIC = Epic(SITE, "ABC-12")
@@ -27,7 +28,7 @@ DONE = {"name": "Done", "statusCategory": {"key": "done"}}
TRANSITIONS = f"{ISSUES}/ABC-12/transitions"
EPIC_COMMENT = f"{ISSUES}/ABC-12/comment"
EPIC_STATUS = f"{ISSUES}/ABC-12?fields=status"
TYPES = {"issueTypes": [{"id": "10001", "name": "Task", "subtask": False}, {"id": "10003", "name": "Subtask", "subtask": True}]}
TYPES = {"issueTypes": [{"id": "10001", "name": "Task", "subtask": False}, {"id": "10002", "name": "Feature", "subtask": False}, {"id": "10004", "name": "Chore", "subtask": False}, {"id": "10003", "name": "Subtask", "subtask": True}]}
def to_adf(markdown: str) -> dict[str, object]:
@@ -46,6 +47,8 @@ class FakeJira:
answers: dict[tuple[str, str], object] = dataclasses.field(default_factory=dict)
calls: list[tuple[str, str]] = dataclasses.field(default_factory=list)
comments: dict[str, list[object]] = dataclasses.field(default_factory=dict)
# The issue type of each issue created, as the request names it.
filed_as: list[object] = dataclasses.field(default_factory=list)
# The ID of each transition made.
transitioned: list[str] = dataclasses.field(default_factory=list)
# The transitions Jira offers an issue that isn't done.
@@ -116,9 +119,10 @@ class FakeJira:
assert isinstance(body, dict)
fields = body["fields"]
parent = fields["parent"]["key"]
kind = {"name": "Task"} if parent == "ABC-12" else {"id": "10003"} if any(issue["key"] == parent for issue in self.issues) else None
kind = fields["issuetype"] if parent == "ABC-12" and fields["issuetype"] in [{"name": "Task"}, {"name": "Feature"}, {"name": "Chore"}] else {"id": "10003"} if any(issue["key"] == parent for issue in self.issues) else None
if fields["project"] != {"key": "ABC"} or kind is None or fields["issuetype"] != kind:
return Failure("Jira answered 400: the project, parent or issue type is not valid")
self.filed_as.append(fields["issuetype"])
key = f"ABC-{len(self.issues) + 100}"
# The links Jira makes as it creates the issue: the inward issue blocks the new one, which then reads "is blocked by" it.
links = [{"id": "1", "type": {"inward": "is blocked by", "outward": "blocks"}, "inwardIssue": add["add"]["inwardIssue"]} for add in body.get("update", {}).get("issuelinks", []) if add["add"]["type"] == {"name": "Blocks"}]
@@ -296,9 +300,24 @@ class Jira(Case):
assert isinstance(read, list), read
self.assertEqual([issue.key for issue in read], [key for pair in zip(children, tasks) for key in pair])
def test_files_a_child_without_asking_for_issue_types(self) -> None:
def test_files_a_child_as_a_task_where_the_settings_name_no_type(self) -> None:
self.new_store().file("ABC-12", "Count the runs.", "", ())
self.assertNotIn(("GET", ISSUE_TYPES), self.jira.calls)
self.assertEqual(self.jira.filed_as, [{"name": "Task"}])
def test_files_a_finding_and_a_release_review_as_the_types_the_settings_name(self) -> None:
store = JiraEpic(EPIC, self.env_file, self.jira, to_markdown, to_adf, finding_type="Feature", review_type="Chore")
store.file("ABC-12", "Count the runs.", "", ("repo:api",))
store.file("ABC-12", "Review api.", "", ("repo:api", REVIEW_LABEL))
self.assertEqual(self.jira.filed_as, [{"name": "Feature"}, {"name": "Chore"}])
def test_does_not_file_anything_where_the_project_lacks_the_type_and_names_the_types_it_has(self) -> None:
store = JiraEpic(EPIC, self.env_file, self.jira, to_markdown, to_adf, finding_type="Feature", review_type="Investigation")
self.assertEqual(store.file("ABC-12", "Review api.", "", (REVIEW_LABEL,)), Failure("ABC has no issue type 'Investigation' for an issue under an epic; it has Task, Feature and Chore: name one in `jira-review-type`"))
self.assertEqual(self.jira.issues, [])
def test_names_the_setting_of_a_finding_where_the_project_lacks_its_type(self) -> None:
store = JiraEpic(EPIC, self.env_file, self.jira, to_markdown, to_adf, finding_type="Investigation")
self.assertEqual(store.file("ABC-12", "Count the runs.", "", ()), Failure("ABC has no issue type 'Investigation' for an issue under an epic; it has Task, Feature and Chore: name one in `jira-finding-type`"))
def test_a_filing_jira_fails_or_answers_without_a_key_says_the_issue_may_exist(self) -> None:
for answer, reason in ((Failure("Jira answered 503"), "cannot file the issue under ABC-12: Jira answered 503"), ({"id": "1"}, "Jira answered the new issue without an issue key"), (["ABC-100"], "Jira answered the new issue without an issue key")):
@@ -314,7 +333,7 @@ class Jira(Case):
def test_files_no_sub_task_where_the_project_has_no_sub_task_type_or_its_types_cannot_be_read(self) -> None:
store = self.new_store()
child = store.file("ABC-12", "Count the runs.", "", ())
for answer, reason in ((Failure("Jira answered 403"), "cannot read ABC's issue types: Jira answered 403"), ({"issueTypes": [{"id": "10001", "subtask": False}]}, "ABC has no sub-task issue type; turn sub-tasks on in Jira"), ({}, "Jira answered ABC's issue types in a shape its REST API version 3 doesn't document"), ([], "Jira answered ABC's issue types in a shape its REST API version 3 doesn't document")):
for answer, reason in ((Failure("Jira answered 403"), "cannot read ABC's issue types: Jira answered 403"), ({"issueTypes": [{"id": "10001", "name": "Task", "subtask": False}]}, "ABC has no sub-task issue type; turn sub-tasks on in Jira"), ({}, "Jira answered ABC's issue types in a shape its REST API version 3 doesn't document"), ([], "Jira answered ABC's issue types in a shape its REST API version 3 doesn't document")):
with self.subTest(answer=answer):
self.jira.answers[("GET", ISSUE_TYPES)] = answer
self.assertEqual(store.file(str(child), "A task.", "", ()), Failure(reason))
+9 -3
View File
@@ -19,6 +19,7 @@ One pair per machine, the same for every epic (docs/decisions.md → `do-epic: d
- `jira-finish-transition` and `jira-finish-status` name the workflow transition that moves a finished chunk's issue and closes a finished epic, such as "Mark as done", and the status it leads to, such as "Done". A project's config names a plan item's the same way. Set both or neither; without them do-epic moves no issue to done and closes no epic.
- `jira-unblocking-statuses` lists the statuses at which an issue's work has landed though Jira doesn't count it done yet, such as `["Release Ready"]`, in upper or lower case. An issue in one of them takes no chunk and no longer blocks the issues it blocks. A status Jira counts as done always does both, listed or not.
- `jira-automation-moves-issues = true` says the team's own automation moves an issue when its pull request merges. do-epic then moves only the issue of a chunk without a repo, which has no pull request, and waits for the automation to move each other. It needs `jira-unblocking-statuses`, which then names the status the automation gives an issue whose pull request merged. false where left out.
- `jira-finding-type` names the Jira issue type do-epic files a finding as, and `jira-review-type` the one it files a repo's release review as, such as `"Feature"` and `"Chore"`, for a Jira project that has no Task type. Task where left out. do-epic doesn't file anything where the project lacks the type, and says which types it has.
- `sub-task-summary` shapes the summary of each sub-task do-epic files for an issue that changes several repos, such as `"{label}: {Summary}"`. `{label}` is the team's label for the repo, else the repo's name, and `{Summary}` is the issue's summary with a capital first letter. It must hold `{Summary}`. Where left out, a summary is `[<repo>] <the issue's summary>`.
- `[label-repos]` has one line for each label of the team's own that names a repo: the label, then that repo's name, such as `twu-4 = "tenant-web-ui-4"`. do-epic reads such a label as it reads its own `repo:<name>`. A team whose label is the repo's name maps the name to itself. Where several lines name one repo, do-epic writes the label of the first.
- `repo-rule.md` is prose that says how to tell an item's repo, and mustn't be blank."""
@@ -28,7 +29,7 @@ import re
import string
import types
from project_config.settings import anywhere, CONFIG, DO_EPIC, ENV_FILE, Finish, finish_faults, finish_of, JIRA_FINISH, LANGUAGE, language_fault, lies_in, name_of, parsed, PROJECTS, SITE
from project_config.settings import anywhere, CONFIG, DEFAULT_ISSUE_TYPE, DO_EPIC, ENV_FILE, Finish, finish_faults, finish_of, JIRA_FINDING_TYPE, JIRA_FINISH, JIRA_REVIEW_TYPE, LANGUAGE, language_fault, lies_in, name_of, parsed, PROJECTS, SITE, type_fault
from failure import Failure
from do_epic.backend.protocol import LABEL
from do_epic.repo_pick import LabelRepos, of_label, REPO_NAME, REVIEW_LABEL
@@ -48,7 +49,8 @@ LABEL_REPOS = "label-repos"
UNBLOCKING_STATUSES = "jira-unblocking-statuses"
AUTOMATION_MOVES = "jira-automation-moves-issues"
SUB_TASK_SUMMARY = "sub-task-summary"
OPTIONAL = (CLONE_FOLDER, LANGUAGE, *JIRA_FINISH, UNBLOCKING_STATUSES, AUTOMATION_MOVES, LABEL_REPOS, SUB_TASK_SUMMARY)
ISSUE_TYPES = (JIRA_FINDING_TYPE, JIRA_REVIEW_TYPE)
OPTIONAL = (CLONE_FOLDER, LANGUAGE, *JIRA_FINISH, UNBLOCKING_STATUSES, AUTOMATION_MOVES, LABEL_REPOS, SUB_TASK_SUMMARY, *ISSUE_TYPES)
LISTED = f"The settings are {', '.join(SETTINGS)}, and optionally {listed(OPTIONAL, 'and')}."
@@ -71,6 +73,8 @@ class DoEpicConfig:
automation_moves: bool = False
# The SUB_TASK_SUMMARY template; None where the config has none.
sub_task_summary: str | None = None
finding_type: str = DEFAULT_ISSUE_TYPE
review_type: str = DEFAULT_ISSUE_TYPE
def label_repo_faults(table: object) -> list[str]:
@@ -146,6 +150,7 @@ def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfi
*workflow_faults(values),
*(summary_template_faults(values[SUB_TASK_SUMMARY]) if SUB_TASK_SUMMARY in values else []),
*label_repo_faults(values.get(LABEL_REPOS, {})),
*(f"`{name}` is {values[name]!r}, {fault}" for name, example in zip(ISSUE_TYPES, ("Feature", "Chore")) if name in values and (fault := type_fault(values[name], example))),
*([rule.reason] if isinstance(rule, Failure) else [f"`{REPO_RULE}` is blank"] if not rule.strip() else []),
]
if faults:
@@ -158,4 +163,5 @@ def load(home: pathlib.Path, ladder_file: pathlib.Path = SHIPPED) -> DoEpicConfi
assert isinstance(statuses, list)
template = values.get(SUB_TASK_SUMMARY)
assert template is None or isinstance(template, str)
return DoEpicConfig(folder, url, env_file, clone_folder, language, model, rule, finish_of(values), types.MappingProxyType(labels), tuple(statuses), values.get(AUTOMATION_MOVES) is True, template)
finding_type, review_type = (str(values.get(name, DEFAULT_ISSUE_TYPE)) for name in ISSUE_TYPES)
return DoEpicConfig(folder, url, env_file, clone_folder, language, model, rule, finish_of(values), types.MappingProxyType(labels), tuple(statuses), values.get(AUTOMATION_MOVES) is True, template, finding_type, review_type)
+1 -1
View File
@@ -82,7 +82,7 @@ Backend = typing.Callable[[DoEpicConfig, str], tuple[EpicStore, EpicRecord]]
def jira_backend(config: DoEpicConfig, key: str) -> tuple[EpicStore, EpicRecord]:
epic = Epic(config.jira_url, key)
return JiraEpic(epic, config.env_file, finish=config.finish), EpicRecord(EpicDescription(epic, config.env_file))
return JiraEpic(epic, config.env_file, finish=config.finish, finding_type=config.finding_type, review_type=config.review_type), EpicRecord(EpicDescription(epic, config.env_file))
@dataclasses.dataclass(frozen=True)
+19
View File
@@ -123,6 +123,25 @@ class ConfigTest(unittest.TestCase):
assert isinstance(found, DoEpicConfig), found
self.assertEqual((found.unblocking, found.automation_moves), (("Release Ready", "Done"), True))
def test_the_issue_types_of_a_finding_and_a_release_review_are_task_where_left_out(self) -> None:
self.write()
found = load(self.home)
assert isinstance(found, DoEpicConfig), found
self.assertEqual((found.finding_type, found.review_type), ("Task", "Task"))
def test_reads_the_issue_types_of_a_finding_and_a_release_review(self) -> None:
self.write(SETTINGS + 'jira-finding-type = "Feature"\njira-review-type = "Chore"\n')
found = load(self.home)
assert isinstance(found, DoEpicConfig), found
self.assertEqual((found.finding_type, found.review_type), ("Feature", "Chore"))
def test_refuses_an_issue_type_that_is_no_name(self) -> None:
for setting, example in (("jira-finding-type", "Feature"), ("jira-review-type", "Chore")):
for value, shown in (("4", "4"), ('" "', "' '")):
with self.subTest(setting=setting, value=value):
self.write(SETTINGS + f"{setting} = {value}\n")
self.assertIn(f'`{setting}` is {shown}, not the name Jira shows, such as "{example}"', self.failure())
def test_refuses_unblocking_statuses_that_are_no_list_of_names_and_a_switch_that_is_no_boolean(self) -> None:
for value in ('"Done"', '["Done", " "]', "[]", "[1]"):
with self.subTest(value=value):
+5
View File
@@ -104,6 +104,11 @@ class TheJiraBackend(unittest.TestCase):
self.assertEqual((store.epic, store.env_file, store.finish), (Epic("https://acme.atlassian.net", "ABC-12"), pathlib.Path("/h/jira.env"), Finish("Mark as done", "Done"))) # type: ignore[attr-defined]
self.assertEqual((record.description.epic, record.description.env_file), (store.epic, store.env_file)) # type: ignore[attr-defined]
def test_files_the_issue_types_the_config_names(self) -> None:
config = DoEpicConfig(pathlib.Path("/c"), "https://acme.atlassian.net", pathlib.Path("/h/jira.env"), pathlib.Path("/h/code"), "English", "claude-opus-5-5", "rule", finding_type="Feature", review_type="Chore")
store, _ = main.jira_backend(config, "ABC-12")
self.assertEqual((store.finding_type, store.review_type), ("Feature", "Chore")) # type: ignore[attr-defined]
class TheLauncher(unittest.TestCase):
def test_the_repo_ships_a_do_epic_that_prints_its_help(self) -> None:
+10 -8
View File
@@ -12,8 +12,8 @@ from atlassian.client import basic_auth, Http, jira_json, ToAdf, ToMarkdown
from plan.todo_table import BLOCKED_BY, Item, item_fields, ItemFields, MOVES, SHAPE
from plan_store.markdown_edits import bold_cell, plain, unfit_text
from plan_store.plans import cells, no_item, Plan, Written
from atlassian.jira import entry_of, finishing_transition, ISSUE_KEY, Link, MAX_PAGES, move_refusal, PERHAPS_FILED, PERHAPS_MOVED, project_of, rank_refusal, searched, unshaped
from project_config.settings import Epic, Finish, JIRA_FINISH_STATUS, JIRA_FINISH_TRANSITION
from project_config.settings import DEFAULT_ISSUE_TYPE, Epic, Finish, JIRA_FINDING_TYPE, JIRA_FINISH_STATUS, JIRA_FINISH_TRANSITION
from atlassian.jira import entry_of, finishing_transition, ISSUE_KEY, issue_type_refusal, Link, MAX_PAGES, move_refusal, PERHAPS_FILED, PERHAPS_MOVED, project_of, rank_refusal, searched, unshaped
from failure import Failure
from plan.release import parsed, Release, tagged
from plan import ranking
@@ -22,8 +22,6 @@ from plan import ranking
PROPERTY = "plan-item"
# The key in PROPERTY's value that marks an issue the loop filed, and its value. An edit of an issue without it, which a person filed, writes only PROPERTY and a comment.
FILED_BY = ("Filed by", "loop")
# The issue type of an issue the loop files, which Jira Software's project templates all have; a project without it refuses the issue, saying so.
ISSUE_TYPE = "Task"
# The name of the link type whose inward side reads "is blocked by", as Jira Cloud ships it.
BLOCKS = "Blocks"
SECURITY = "security"
@@ -73,6 +71,8 @@ class JiraPlan:
finish_by: Finish | None = None
# The pages a search may take before the read fails.
max_pages: int = MAX_PAGES
# The issue type `add` files an item as.
finding_type: str = DEFAULT_ISSUE_TYPE
# How add scores an item: by the config's formula and bar, with the goal weights the project's records give.
scoring: ReadsScoring = dataclasses.field(kw_only=True)
@@ -98,7 +98,7 @@ class JiraPlan:
"""Files the item as a child issue, where it scores at the config's bar or above or is exempt, and ranks it as `placing` says.
Jira takes the links and the rank after the issue. One it refuses leaves the issue filed, so the write counts as landed, and a note says what to do by hand."""
filing = filing_of(fields, detail, self.epic)
filing = filing_of(fields, detail, self.epic, self.finding_type)
if isinstance(filing, Failure):
return filing
scoring = self.scoring.read()
@@ -113,6 +113,8 @@ class JiraPlan:
description = self.description_of(detail)
if isinstance(description, Failure):
return description
if refused := issue_type_refusal(self.epic.site, project_of(self.epic.key), self.finding_type, JIRA_FINDING_TYPE, authorization, self.http):
return Failure(refused)
issue_fields = filing.fields | ({"description": description} if description else {})
version = self.fix_version(filing.release, authorization)
if isinstance(version, Failure):
@@ -276,8 +278,8 @@ class Filing:
item: Item
def filing_of(fields: dict[str, str], detail: str, epic: Epic) -> Filing | Failure:
"""The issue to file for an item with these fields under epic, or why a field cannot be filed."""
def filing_of(fields: dict[str, str], detail: str, epic: Epic, issue_type: str) -> Filing | Failure:
"""The issue to file, of the type named issue_type, for an item with these fields under epic, or why a field cannot be filed."""
named = cells(fields)
summary = plain(named.get("Item", "")).strip()
if not summary:
@@ -290,7 +292,7 @@ def filing_of(fields: dict[str, str], detail: str, epic: Epic) -> Filing | Failu
return checked
assert checked.release is not None, "item_fields refuses an empty Release"
project = project_of(epic.key)
issue_fields: dict[str, typing.Any] = {"project": {"key": project}, "parent": {"key": epic.key}, "issuetype": {"name": ISSUE_TYPE}, "summary": summary}
issue_fields: dict[str, typing.Any] = {"project": {"key": project}, "parent": {"key": epic.key}, "issuetype": {"name": issue_type}, "summary": summary}
if checked.exempt == SECURITY:
issue_fields["labels"] = [SECURITY]
value = checked.scores | {MOVES: named.get(MOVES, ""), "Exempt": checked.exempt, FILED_BY[0]: FILED_BY[1]}
+1 -1
View File
@@ -24,7 +24,7 @@ def store(config: ProjectConfig) -> PlanStore:
# load refuses a config that names an epic and no formula or bar.
assert config.jira_scoring is not None
scoring = StatedScoring(config.jira_scoring, goals_store(config), record_store(config, "decisions"), record_store(config, "comprehension-history"), config.readability_floor)
return JiraPlan(config.epic, config.env_file, finish_by=config.jira_finish, scoring=scoring)
return JiraPlan(config.epic, config.env_file, finish_by=config.jira_finish, finding_type=config.jira_finding_type, scoring=scoring)
def file_plan(config: ProjectConfig, path: pathlib.Path | None = None) -> FilePlan:
+15 -5
View File
@@ -227,6 +227,7 @@ class JiraPlan(unittest.TestCase):
ISSUES = "https://acme.atlassian.net/rest/api/3/issue"
LINKS = "https://acme.atlassian.net/rest/api/3/issueLink"
VERSIONS = "https://acme.atlassian.net/rest/api/3/project/ABC/versions"
ISSUE_TYPES = "https://acme.atlassian.net/rest/api/3/issue/createmeta/ABC/issuetypes"
PERHAPS_FILED = "unless Jira refused the request, the issue may exist: look under ABC-12 before filing it again"
FIELDS = {"Release": "0.1.0", "Tagline": "Count the runs.", "L": "1", "E": "2", "I": "3", "S": "1", "Moves": "1 by 9"}
PROPERTY = {"L": 1, "E": 2, "I": 3, "S": 1, "Moves": "1 by 9", "Exempt": "", "Filed by": "loop"}
@@ -261,30 +262,39 @@ class Filing(unittest.TestCase):
self.linked: object = None
self.versions: object = [{"name": "0.1.0"}, {"name": "v0.2.0"}, "odd", {"name": ["0.1.0"]}, {"name": {"en": "0.1.0"}}]
self.ranked: object = None
self.types: object = {"issueTypes": [{"name": "Task", "subtask": False}, {"name": "Feature", "subtask": False}, {"name": "Subtask", "subtask": True}]}
self.scoring = Stated()
def http(self, method: str, url: str, authorization: str, body: object) -> object:
"""Stands in for Jira: answers the epic, self.versions for the project's Fix Versions, self.open to the search, self.created to a new issue, self.linked to a new link and self.ranked to a rank."""
"""Stands in for Jira: answers the epic, self.versions for the project's Fix Versions, self.types for the project's issue types, self.open to the search, self.created to a new issue, self.linked to a new link and self.ranked to a rank."""
self.calls.append((method, url, body))
assert authorization == AUTHORIZATION
return {SEARCH: {"issues": self.open}, ISSUES: self.created, LINKS: self.linked, VERSIONS: self.versions, RANK: self.ranked}.get(url, {"key": "ABC-12"})
return {SEARCH: {"issues": self.open}, ISSUES: self.created, LINKS: self.linked, VERSIONS: self.versions, ISSUE_TYPES: self.types, RANK: self.ranked}.get(url, {"key": "ABC-12"})
def to_adf(self, markdown: str) -> dict[str, object] | Failure:
return adf(markdown)
def add(self, fields: dict[str, str] = FIELDS, detail: str = ""):
return jira_epic.JiraPlan(EPIC, self.env, self.http, text_of, self.to_adf, scoring=self.scoring).add(fields, detail)
def add(self, fields: dict[str, str] = FIELDS, detail: str = "", **plan: str):
return jira_epic.JiraPlan(EPIC, self.env, self.http, text_of, self.to_adf, scoring=self.scoring, **plan).add(fields, detail)
def sent(self, url: str) -> list[object]:
return [body for _, sent_to, body in self.calls if sent_to == url]
def test_files_the_item_as_a_task_under_the_epic_marked_as_the_loops(self):
self.assertEqual(self.add(), Written(40))
self.assertEqual([call for call in self.calls if call[1] != SEARCH and "/issue/ABC-12" not in call[1]], [("GET", VERSIONS, None), ("POST", ISSUES, {
self.assertEqual([call for call in self.calls if call[1] != SEARCH and "/issue/ABC-12" not in call[1]], [("GET", ISSUE_TYPES, None), ("GET", VERSIONS, None), ("POST", ISSUES, {
"fields": {"project": {"key": "ABC"}, "parent": {"key": "ABC-12"}, "issuetype": {"name": "Task"}, "summary": "Count the runs.", "fixVersions": [{"name": "0.1.0"}]},
"properties": [{"key": "plan-item", "value": PROPERTY}],
})])
def test_files_the_item_as_the_issue_type_the_plan_names(self):
self.assertEqual(self.add(finding_type="Feature"), Written(40))
self.assertEqual(self.sent(ISSUES)[0]["fields"]["issuetype"], {"name": "Feature"}) # type: ignore[index]
def test_does_not_file_anything_where_the_project_lacks_the_issue_type_and_names_the_types_it_has(self):
self.assertEqual(self.add(finding_type="Chore"), Failure("ABC has no issue type 'Chore' for an issue under an epic; it has Task and Feature: name one in `jira-finding-type`"))
self.assertEqual(self.sent(ISSUES), [])
def test_a_bold_tagline_is_filed_plain(self):
self.add(FIELDS | {"Tagline": "**Count the runs.**"})
self.assertEqual(self.sent(ISSUES)[0]["fields"]["summary"], "Count the runs.") # type: ignore[index]
+4
View File
@@ -210,6 +210,10 @@ class Store(unittest.TestCase):
picked = stores.store(self.config(epic=epic, env_file=pathlib.Path("/secrets/acme.env"), jira_scoring=JiraScoring("V", 1)))
self.assertEqual(picked, JiraPlan(epic, pathlib.Path("/secrets/acme.env"), picked.http, scoring=picked.scoring))
def test_an_epic_files_an_item_as_the_issue_type_the_config_names(self):
picked = stores.store(self.config(epic=Epic("https://acme.atlassian.net", "ABC-12"), env_file=pathlib.Path("/secrets/acme.env"), jira_finding_type="Feature", jira_scoring=JiraScoring("V", 1)))
self.assertEqual(picked.finding_type, "Feature")
def test_an_epic_finishes_an_item_as_the_config_says(self):
finish = Finish("Mark as done", "Done")
picked = stores.store(self.config(epic=Epic("https://acme.atlassian.net", "ABC-12"), env_file=pathlib.Path("/secrets/acme.env"), jira_finish=finish, jira_scoring=JiraScoring("V", 1)))
+5 -1
View File
@@ -51,6 +51,10 @@ which must be one Jira counts as done. Write both names as Jira shows them:
Where the config leaves them out, `todo-item finish` fails in a Jira plan. Each is printed with the others only where it is set.
`jira-finding-type` is an optional setting, allowed only beside such a plan: the Jira issue type
`todo-item add` files an item as, such as "Feature", for a Jira project that has no Task type.
Task where left out. `todo-item add` fails, naming the types the project has, where it has none of that name.
`goals-and-audience` may name a Jira Cloud epic the same way, where `plan` names one too. The
epic's description is then the goals file, with ## Goals and ## Audience as headings, and
`project-config goals-and-audience` prints the setting as the config spells it. The description is
@@ -152,7 +156,7 @@ without `env-file`, sets `jira-finish-transition` or `jira-finish-status` to any
without a `plan` in Jira, names a Jira `plan` and leaves out `jira-score-formula` or `jira-score-bar`, sets
one of those two without a `plan` in Jira, sets the formula to one that doesn't parse or the bar to anything
but a number, sets `readability-floor` to anything but a number
from 1 to 10, or sets `parallel-chunks` to anything but a whole number of 1 or more, and where `coding-conventions`, `env-file`, `jira-finish-transition`, `jira-finish-status`, `notifier` or `touch-predictions` is asked for and not set. No path setting has a default.
from 1 to 10, sets `parallel-chunks` to anything but a whole number of 1 or more, or sets `jira-finding-type` to anything but a name or without a `plan` in Jira, and where `coding-conventions`, `env-file`, `jira-finish-transition`, `jira-finish-status`, `notifier` or `touch-predictions` is asked for and not set. No path setting has a default.
"""
import pathlib
import sys
+15 -2
View File
@@ -62,8 +62,13 @@ JIRA_FINISH = (JIRA_FINISH_TRANSITION, JIRA_FINISH_STATUS)
JIRA_SCORE_FORMULA = "jira-score-formula"
JIRA_SCORE_BAR = "jira-score-bar"
JIRA_SCORE = (JIRA_SCORE_FORMULA, JIRA_SCORE_BAR)
# The issue types that `todo-item add` files an item as and do-epic files a finding as, and do-epic files a release review as; only do-epic's config reads the review type.
JIRA_FINDING_TYPE = "jira-finding-type"
JIRA_REVIEW_TYPE = "jira-review-type"
# Jira Software's project templates ship Task, but a project such as TW may lack it.
DEFAULT_ISSUE_TYPE = "Task"
# The settings allowed only where `plan` names a Jira epic.
JIRA_PLAN_ONLY = (*JIRA_FINISH, *JIRA_SCORE)
JIRA_PLAN_ONLY = (*JIRA_FINISH, *JIRA_SCORE, JIRA_FINDING_TYPE)
# What opens a setting that names a Jira Cloud epic in place of a path: `jira:`, then the epic's address as the browser shows it. The settings below may name an epic; each reads its own part of it.
JIRA = "jira:"
EPIC_SPELLINGS = {
@@ -146,6 +151,8 @@ class ProjectConfig:
notifier: Notifier | None = None
# The config's `jira-finish-transition` and `jira-finish-status`, or None where it sets neither.
jira_finish: Finish | None = None
# The config's `jira-finding-type`, the issue type `todo-item add` files an item as.
jira_finding_type: str = DEFAULT_ISSUE_TYPE
# The config's `jira-score-formula` and `jira-score-bar`, which it sets where `plan` names an epic.
jira_scoring: JiraScoring | None = None
# The Confluence page of each record the config keeps on one, by the record's setting.
@@ -286,6 +293,11 @@ def text_read(fault: typing.Callable[[object], str | None]) -> typing.Callable[[
return read
def type_fault(value: object, example: str = "Feature") -> str | None:
"""Why value is no issue type's name; None where it is one. example is a name a message quotes."""
return None if name_of(value) else f'not the name Jira shows, such as "{example}"'
def formula_fault(value: object) -> str | None:
"""Why value is no formula that may score an item, as todo.md's `Score` line states one; None where it is one."""
if not isinstance(value, str):
@@ -359,8 +371,9 @@ SCALARS = (
Scalar(COMMIT_TITLE, "commit_title", text_read(templates.title_fault)),
Scalar(PULL_REQUEST_TITLE, "pull_request_title", text_read(templates.title_fault)),
Scalar(BRANCH, "branch", text_read(templates.branch_fault)),
Scalar(JIRA_FINDING_TYPE, "jira_finding_type", text_read(type_fault)),
)
OPTIONAL = tuple(sorted((CODING_CONVENTIONS, ENV_FILE, TOUCH_PREDICTIONS, *JIRA_PLAN_ONLY, *(scalar.name for scalar in SCALARS))))
OPTIONAL = tuple(sorted({CODING_CONVENTIONS, ENV_FILE, TOUCH_PREDICTIONS, *JIRA_PLAN_ONLY, *(scalar.name for scalar in SCALARS)}))
def lies_in(path: pathlib.Path, *places: pathlib.Path) -> bool:
+19 -1
View File
@@ -291,6 +291,24 @@ class LoadTest(ConfigCase):
(self.home / ".claude-projects" / "acme" / "config.toml").write_text(CLIENT + 'jira-finish-transition = "Mark as done"\njira-finish-status = "Done"\n')
self.assertIn("`jira-finish-transition` is set, so `plan` must name a Jira epic; `jira-finish-status` is set, so `plan` must name a Jira epic", self.failure())
def test_a_jira_plan_may_name_the_issue_type_it_files_items_as_which_is_task_where_left_out(self) -> None:
folder = self.write("acme", JIRA_CLIENT)
left_out = load(self.checkout, self.checkout, self.home)
assert isinstance(left_out, ProjectConfig), left_out
self.assertEqual(left_out.jira_finding_type, "Task")
(folder / "config.toml").write_text(JIRA_CLIENT + 'jira-finding-type = "Feature"\n')
named = load(self.checkout, self.checkout, self.home)
assert isinstance(named, ProjectConfig), named
self.assertEqual(named.jira_finding_type, "Feature")
def test_a_finding_type_that_is_no_name_or_beside_a_plan_in_a_file_fails_naming_it(self) -> None:
folder = self.write("acme", JIRA_CLIENT + 'jira-finding-type = 3\n')
self.assertIn("`jira-finding-type` is 3, not the name Jira shows, such as \"Feature\"", self.failure())
(folder / "config.toml").write_text(JIRA_CLIENT + 'jira-finding-type = " "\n')
self.assertIn("`jira-finding-type` is ' ', not the name Jira shows, such as \"Feature\"", self.failure())
(folder / "config.toml").write_text(CLIENT + 'jira-finding-type = "Feature"\n')
self.assertIn("`jira-finding-type` is set, so `plan` must name a Jira epic", self.failure())
def test_a_jira_plan_holds_the_formula_and_bar_it_scores_by(self) -> None:
self.write("acme", JIRA_CLIENT.replace("jira-score-bar = 1", "jira-score-bar = 0.5"))
named = load(self.checkout, self.checkout, self.home)
@@ -527,7 +545,7 @@ class LoadTest(ConfigCase):
def test_the_failure_for_a_misplaced_env_file_and_a_missing_setting_names_both_and_lists_every_setting(self) -> None:
folder = self.write("acme", "".join(line + "\n" for line in CLIENT.splitlines() if not line.startswith("plan")) + 'env-file = "checkout:.env"\n')
self.assertEqual(self.failure(), f"{folder / 'config.toml'}: `plan` is missing; `env-file` is 'checkout:.env', not {OUTSIDE}. The settings are {', '.join(SETTINGS)}, and optionally branch, coding-conventions, commit-title, env-file, jira-finish-status, jira-finish-transition, jira-score-bar, jira-score-formula, language, merge, notifier, parallel-chunks, pull-request-title, readability-floor, tooling-on-host, touch-predictions and wait-for-approval.")
self.assertEqual(self.failure(), f"{folder / 'config.toml'}: `plan` is missing; `env-file` is 'checkout:.env', not {OUTSIDE}. The settings are {', '.join(SETTINGS)}, and optionally branch, coding-conventions, commit-title, env-file, jira-finding-type, jira-finish-status, jira-finish-transition, jira-score-bar, jira-score-formula, language, merge, notifier, parallel-chunks, pull-request-title, readability-floor, tooling-on-host, touch-predictions and wait-for-approval.")
def test_two_configs_naming_one_checkout_fail_naming_both(self) -> None:
self.write("acme", CLIENT)
+3 -2
View File
@@ -29,8 +29,9 @@ add files the item under the next free ID, with the tagline in bold, and the det
stdin, if any. The detail may hold no ## or ### heading.
It prints `Filed item <ID> in <plan>.` It doesn't write anything where ranking fails or scores the item under the bar,
or where the detail holds a `Touches:` list not spelt as `touch-predictions --help` shows.
In a Jira epic, add files a Task under the epic, and <ID> is the new issue's number. The release
must be one of the Jira project's Fix Versions, named as 1.2.0 or v1.2.0 there, and --exempt
In a Jira epic, add files the item under the epic as a Task, or as the type the config's
`jira-finding-type` names, and refuses before filing where the Jira project lacks that type. <ID> is
the new issue's number. The release must be one of the Jira project's Fix Versions, named as 1.2.0 or v1.2.0 there, and --exempt
security also labels the issue `security`. The item scores by the config's `jira-score-formula`, and
add refuses it under `jira-score-bar` unless it is exempt. add then asks Jira to rank the new issue
just before the first issue the loop filed that ranks after it: a question before any other, then a
+1 -1
View File
@@ -410,7 +410,7 @@ Messages keep each file's usual name, such as `todo.md`, as its label, since the
- **An item's ID stays a whole number: the issue's number in the epic's Jira project.** About 30 modules read an ID as an int, and the `branch` and title templates already spell a ticket's name, as `ABC-{id}`. So the store refuses a child issue from another Jira project, and counts a blocker only among the plan's own items (`bin/plan_store/jira_epic.py`).
- **The scores sit in one issue property, `plan-item`**, which needs no Jira admin (lilleman, 2026-11-12). An issue without it reads as an item nobody scored.
- **The release is the earliest Fix Version named as a semver version**, and an issue with none fails the read, naming it.
- **The loop files an item as a Task under the epic, and marks it as its own** (lilleman's calls of 2026-11-12). `"Filed by": "loop"` in the `plan-item` property tells such an issue from one a person filed, whose summary and description the loop never edits. Task is an issue type every Jira Software project template has; a project without it refuses the issue, saying so. The issue takes the project's Fix Version named as the release, with a leading v or without, and the store refuses an item whose release the project has no Fix Version for, before it files anything. A security finding also gets the label `security`, and its text never holds a secret's value. Jira takes a blocker's link only after the issue exists, so the store first checks that each blocker is an open child. A link Jira still refuses leaves the issue filed: the write counts as landed, with a note naming the link to make by hand. A failed create says the issue may exist all the same, since a lost answer doesn't tell.
- **The loop files an item under the epic as a Task unless the config names another type, and marks it as its own** (lilleman's calls of 2026-11-12). `"Filed by": "loop"` in the `plan-item` property tells such an issue from one a person filed, whose summary and description the loop never edits. Task is an issue type every Jira Software project template has, so it is the default; a project without it, such as TW, names another type in its project config's `jira-finding-type`. Where the project lacks the type set, the filing fails before anything is filed, naming the types the project has. The issue takes the project's Fix Version named as the release, with a leading v or without, and the store refuses an item whose release the project has no Fix Version for, before it files anything. A security finding also gets the label `security`, and its text never holds a secret's value. Jira takes a blocker's link only after the issue exists, so the store first checks that each blocker is an open child. A link Jira still refuses leaves the issue filed: the write counts as landed, with a note naming the link to make by hand. A failed create says the issue may exist all the same, since a lost answer doesn't tell.
- **The config states the formula and the bar, and the store ranks a new issue among the loop's own** (lilleman, 2026-11-12 and 2026-11-15). A plan in Jira has no `## Scoring`, so a config whose `plan` names an epic must set `jira-score-formula` and `jira-score-bar`. It fails to load without them, or with a formula that doesn't parse, since no setting a config needs has a default. A bench of readers picked the spelling: three fresh readers, seated as the person who writes a client's `config.toml`, each picked those keys over `jira-score` and `jira-bar`, `score-formula` and `score-bar`, and bare `score` and `bar`. The prefix matches the other Jira-only settings, "formula" says the value is no score, and "score-bar" says what the bar applies to. The store scores the item as `rank_todo.py` scores a row, with the goal weights from the goals file, the decision log and the comprehension history. It refuses an item under the bar that isn't exempt, or one whose Moves names a goal the goals file lacks, before it files anything. Then it ranks the issue just before the first issue the loop filed that ranks after it. A person's issues don't count, so the team's rank of each stays as it is. The order is todo.md's within a release: a question first, then a security finding, then the higher score, with a tie after the older issue. Questions go first because `rank_todo.py` ranks them ahead of security findings, since an answer may change other items (the loop's choice, 2026-11-16). Release doesn't count, since lilleman's call ranks by score among the loop's issues. A rank Jira refuses, or an issue of the loop's that no longer scores, leaves the new issue filed and last, with a note to rank it by hand.
- **The store edits and moves only an issue the loop filed, and of an issue a person filed it sets only the scores** (lilleman's calls of 2026-11-12). On its own issue it sets the summary, description, scores and Fix Version in one request, so Jira takes all of an edit or none, and it keeps the label `security` in step with Exempt. It also sets the "is blocked by" links, in requests of their own after that one: a link per blocker added and a deletion per blocker dropped, each blocker an open child, as `add` checks, and none that waits for the item itself, directly or through others. A link to any other issue stays as it is, since a read doesn't show it and the team may have made it. Of a person's issue it writes only the `plan-item` property, and a comment: the team's screens don't show the property, so the comment tells the team why the scores changed, and the store refuses the edit without one. Its links stay the team's, which Jira shows on its board where it doesn't show a score. The comment's text comes from whoever scores, in the project's `language`. Where Jira takes the edit and then refuses a link or the comment, the edit counts as made, and a note says what to do by hand.
- **The loop may re-score a person's issue that already holds scores, and never moves it.** lilleman's calls of 2026-11-12 cover an issue nobody scored, and say nothing of one that holds scores; larv-review chose on 2026-11-16, through todo item 382. A re-score changes only the loop's own reading of the issue, and not what the person wrote, so it is allowed, with a comment as the first scores need. L, E, I and S are set together, so no issue is left partly scored. The Fix Version says when the team ships the issue, and a release is its team's, so the store refuses the move and `CLAUDE.md` has the worker ask the human to move the issue.
+1 -20
View File
@@ -13,10 +13,9 @@
| ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 469 | 0.15.0 | | | **Move a do-epic parent issue whose sub-tasks a person filed to Release Ready once every sub-task has landed, and to Done once every sub-task is done, by transitions its config names.** | 3 | 2 | 2 | 5 | 4 | 1.2 by 4, 1.5 by 4, 1.6 by 3 | 3.1 |
| 453 | 0.15.0 | | | **Make the issue types that do-epic and `todo-item add` file in Jira settings, since a Jira project such as TW has no Task type.** | 2 | 2 | 1 | 3 | 2 | 1.6 by 5 | 1.8 |
| 470 | 0.15.0 | | | **Start an epic's runnable issues in order of score alone, scoring each open issue that holds no scores, the ones people filed included, so Jira's backlog order no longer decides what starts.** | 3 | 2 | 2 | 5 | 5 | 1.2 by 4, 1.6 by 3 | 1.5 |
| 454 | 0.15.0 | | | **Start a do-epic chunk's issue as the team's board expects, by settings: assigned to the account do-epic works as, moved by a start transition and added to a board's active sprint.** | 3 | 2 | 2 | 5 | 4 | 1.6 by 4 | 1.1 |
| 467 | 0.15.0 | 453, 454, 469, 470 | question | **Cut 0.15.0 as soon as items 449, 450, 453, 454, 468, 469 and 470 have merged, before its release review, and run that review in 0.15.1.** | 1 | 1 | 1 | 1 | 1 | | 0.0 |
| 467 | 0.15.0 | 454, 469, 470 | question | **Cut 0.15.0 as soon as items 449, 450, 453, 454, 468, 469 and 470 have merged, before its release review, and run that review in 0.15.1.** | 1 | 1 | 1 | 1 | 1 | | 0.0 |
| 446 | 0.16.0 | | question | **Kill the process a stuck check names where its verdict is `stuck`, once the human says the recorded verdicts match what they would have done.** | 2 | 2 | 3 | 5 | 3 | 1.5 by 3 | 1.0 |
| 462 | 0.16.0 | | | **Run under `mutate-changes` the tests that today fail in mutmut's copy of the tree, so a mutant of a line only they cover is killed.** | 2 | 1 | 2 | 3 | 3 | code health by 3 | 4.7 |
| 77 | 0.16.0 | | | **Teach `bin/metric-bench` Go and TypeScript, rerun it once two projects' comprehension histories name places, and bring into review only a metric that tracks the panel.** | 4 | 2 | 1 | 5 | 6 | 1.1 by 7, 1.4 by 7 | 2.1 |
@@ -106,24 +105,6 @@ Touches:
- `bin/do_epic/backend/test_jira.py`
- `README.md`: `### Set up a project` (small)
### 453. Make the issue types that do-epic and `todo-item add` file in Jira settings, since a Jira project such as TW has no Task type.
do-epic and `todo-item add` file every new issue as a Task, the name `plan_store/jira_epic.py` sets as `ISSUE_TYPE`. A Jira project without a Task type, such as TW, whose types are Feature, Bug, Chore and Investigation, refuses each one. So `do-epic --file` fails there, and so does the epic's finishing, which files a release review for each repo.
- A setting in do-epic's config.toml names the type a finding is filed as, and another the type of a release review, such as `jira-finding-type = "Feature"` and `jira-review-type = "Chore"`; Task stays the default.
- A project config whose plan is a Jira epic takes the same `jira-finding-type` for `todo-item add`.
- A type the project doesn't have fails before anything is filed, naming the types the project has.
Touches:
- `bin/plan_store/jira_epic.py`: `ISSUE_TYPE`
- `bin/do_epic/backend/jira.py`: `JiraEpic.file`
- `bin/do_epic/config.py`: `DoEpicConfig`, `load` (small)
- `bin/do_epic/findings.py`: `written` (small)
- `bin/project_config/settings.py`: `SCALARS` (small)
- `bin/do_epic/backend/test_jira.py`
- `README.md`: `### Set up a project` (small)
### 470. Start an epic's runnable issues in order of score alone, scoring each open issue that holds no scores, the ones people filed included, so Jira's backlog order no longer decides what starts.
do-epic starts the issues it may run in Jira's backlog order (`scheduler.chunks`). It scores and ranks only the issues it filed itself (`planning.ranked_keys`); a person's issue holds no scores and keeps the rank the team gave it. The human asked, on 2026-11-20, that only the score decide priority on an epic such as TW-13503, where people filed every issue.