Answer stability round 1: 0 🔴, 3 🟡 (0 misread); restrict a repo name, split the multi-behaviour tests, and word the prose findings of the prose round
This commit is contained in:
@@ -98,7 +98,7 @@ class JiraEpic:
|
||||
return above if isinstance(above, Failure) else None if above == self.epic_key else no_parent(self.epic_key, parent)
|
||||
|
||||
def parent_of(self, key: str, authorization: str, why: str) -> str | None | Failure:
|
||||
"""The key of the issue above key; None where key is no issue key or has none. why ends the message for a read that fails."""
|
||||
"""The key of key's parent issue; None where key isn't an issue key or has no parent. A failed read says "cannot read <key> <why>"."""
|
||||
if not ISSUE_KEY.fullmatch(key):
|
||||
return None
|
||||
# A search may not show an issue filed a moment ago, so the issue is asked for by its key.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""What every backend of an epic's plan reads and files: an EpicIssue, and the EpicStore protocol they all meet. do-epic reads an epic only through EpicStore, so another tracker can stand behind it; contract.py holds the tests every backend passes.
|
||||
"""What every backend of an epic's plan reads, files and labels: an EpicIssue, and the EpicStore protocol they all meet. do-epic reads an epic only through EpicStore, so another tracker can stand behind it; contract.py holds the tests every backend passes.
|
||||
|
||||
EpicStore is not plan_store's PlanStore. A PlanStore item names a release, but an epic item has none (`docs/decisions.md` → `do-epic: drives one Jira epic …`), and it may be a sub-task."""
|
||||
import dataclasses
|
||||
@@ -44,18 +44,18 @@ class EpicStore(typing.Protocol):
|
||||
"""Files an open issue under parent and answers its key: a child issue where parent is the epic, a sub-task where parent is one of its child issues. detail is markdown, and may be empty."""
|
||||
|
||||
def add_label(self, key: str, label: str) -> None | Failure:
|
||||
"""Adds label to the epic's child issue named key, leaving its other labels as they are; adding one it already has changes nothing. A sub-task, or an issue outside the epic, is refused."""
|
||||
"""Adds label to the epic's child issue named key, leaving its other labels as they are; adding one it already has leaves the labels as they are. A sub-task, or an issue outside the epic, is refused."""
|
||||
|
||||
|
||||
def unfit(summary: str, labels: tuple[str, ...]) -> Failure | None:
|
||||
"""Why no tracker can file an issue with this summary and these labels; None where one can."""
|
||||
"""Why no tracker can file an issue with this summary and these labels; None where a tracker can file it."""
|
||||
if not summary.strip() or "\n" in summary:
|
||||
return Failure("the summary must be one line of text")
|
||||
return unfit_label(*labels)
|
||||
|
||||
|
||||
def unfit_label(*labels: str) -> Failure | None:
|
||||
"""Why no tracker can take one of these labels; None where one can."""
|
||||
"""Why no tracker can take one of these labels; None where a tracker can take every one."""
|
||||
if bad := next((label for label in labels if not LABEL.fullmatch(label)), None):
|
||||
return Failure(f"the label {bad!r} is empty or holds white space")
|
||||
return None
|
||||
|
||||
@@ -191,8 +191,16 @@ class Jira(Case):
|
||||
key = store.file("ABC-12", "Count the runs.", "", ())
|
||||
self.jira.answers[("PUT", f"{ISSUES}/{key}")] = Failure("Jira answered 403")
|
||||
self.assertEqual(store.add_label(str(key), "repo:log"), Failure(f"cannot label {key}: Jira answered 403"))
|
||||
read = store.read()
|
||||
assert isinstance(read, list), read
|
||||
self.assertEqual([issue.labels for issue in read], [()])
|
||||
|
||||
def test_an_issue_jira_cannot_read_is_not_labelled(self) -> None:
|
||||
store = self.new_store()
|
||||
key = store.file("ABC-12", "Count the runs.", "", ())
|
||||
self.jira.answers[("GET", f"{ISSUES}/{key}?fields=parent")] = Failure("Jira answered 500")
|
||||
self.assertEqual(store.add_label(str(key), "repo:log"), Failure(f"cannot read {key} to label it: Jira answered 500"))
|
||||
self.assertNotIn(("PUT", f"{ISSUES}/{key}"), self.jira.calls)
|
||||
|
||||
def test_an_epic_the_account_cannot_see_fails_the_read(self) -> None:
|
||||
store = JiraEpic(Epic(SITE, "ABC-99"), self.env_file, self.jira, to_markdown, to_adf)
|
||||
|
||||
Reference in New Issue
Block a user