Answer stability round 1: 0 🔴, 1 🟡 (0 misread); refuse a blocker loop and link a blocker named twice once
CI / tests (pull_request) Failing after 3m48s

This commit is contained in:
2026-11-17 06:28:17 +01:00
parent c988bd61b4
commit 89fb819fbe
4 changed files with 35 additions and 4 deletions
+15 -1
View File
@@ -244,6 +244,8 @@ class JiraPlan:
open_keys = keys_of(answered)
if revision.blockers is not None and (missing := missing_blocker(revision.blockers, open_keys, self.label)):
return missing
if revision.blockers is not None and (looped := blocking_loop(answered, issue, revision.blockers, self.label)):
return looped
body = revision.body
if detail is not None and not self.shows(issue, detail):
description = self.description_of(detail)
@@ -403,7 +405,7 @@ def revision_of(issue: Issue, named: dict[str, str], detail: str | None, comment
body["properties"] = [{"key": PROPERTY, "value": value}]
if own and (scored.exempt == SECURITY) != (held.get("Exempt") == SECURITY):
body["update"] = {"labels": [{"add" if scored.exempt == SECURITY else "remove": SECURITY}]}
return Revision(body, release, tuple(f"{project_of(issue.key)}-{blocker}" for blocker in checked.blocked_by) if BLOCKED_BY in named else None)
return Revision(body, release, tuple(dict.fromkeys(f"{project_of(issue.key)}-{blocker}" for blocker in checked.blocked_by)) if BLOCKED_BY in named else None)
def offer_of(raw: object) -> tuple[str, str, str, str] | None:
@@ -498,6 +500,18 @@ def missing_blocker(blockers: tuple[str, ...], held: set[object], label: str) ->
return None if missing is None else Failure(f"{label} holds no item {number(missing)} to be blocked by")
def blocking_loop(answered: list[object], issue: Issue, blockers: tuple[str, ...], label: str) -> Failure | None:
"""A Failure where issue, once blocked by blockers, would block itself through the items its blockers wait for, and none of them could be taken; None otherwise. A loop the plan already holds without issue isn't this edit's."""
issues = {found.key: found for raw in answered if isinstance(found := issue_of(raw), Issue)}
waits_for = {found.key: found.blockers for found in issues.values()} | {issue.key: blockers}
reached: set[str] = set()
frontier = set(blockers)
while frontier:
reached |= frontier
frontier = {blocker for key in frontier for blocker in waits_for.get(key, ()) if blocker in issues} - reached
return Failure(f"{label}: item {issue.number} would be blocked by itself through {', '.join(str(number(key)) for key in sorted(reached - {issue.key}, key=number))}; drop one of the blockers") if issue.key in reached else None
def plan_of(issues: list[Issue], epic: Epic, to_markdown: ToMarkdown) -> Plan | Failure:
"""The plan the issues hold, in their order."""
project = project_of(epic.key)
+18 -1
View File
@@ -614,6 +614,10 @@ class Editing(unittest.TestCase):
self.assertEqual(self.edit(34, {"Blocked by": "35, 36"}), Written(34))
self.assertEqual(self.writes(), [("POST", LINKS, {"type": {"name": "Blocks"}, "inwardIssue": {"key": f"ABC-{blocker}"}, "outwardIssue": {"key": "ABC-34"}}) for blocker in (35, 36)])
def test_links_a_blocker_named_twice_once(self):
self.edit(34, {"Blocked by": "35, 35"})
self.assertEqual([body["inwardIssue"]["key"] for _, _, body in self.writes()], ["ABC-35"]) # type: ignore[index]
def test_deletes_the_link_of_each_blocker_the_edit_drops_and_makes_none_for_one_it_keeps(self):
self.open[0] = issue("ABC-34", scores=PROPERTY, blocked_by=("ABC-35", "ABC-36"))
self.assertEqual(self.edit(34, {"Blocked by": "35"}), Written(34))
@@ -669,6 +673,18 @@ class Editing(unittest.TestCase):
self.assertEqual(self.edit(34, {"L": "2", "Blocked by": "35, 40"}), Failure("jira:https://acme.atlassian.net/browse/ABC-12 holds no item 40 to be blocked by"))
self.assertEqual(self.writes(), [])
def test_a_blocker_that_makes_the_issue_wait_for_itself_fails_before_any_write(self):
self.open[1] = issue("ABC-35", scores=PROPERTY, blocked_by=("ABC-34",))
self.open[2] = issue("ABC-36", scores=PROPERTY, blocked_by=("ABC-35",))
self.assertEqual(self.edit(34, {"L": "2", "Blocked by": "36"}), Failure("jira:https://acme.atlassian.net/browse/ABC-12: item 34 would be blocked by itself through 35, 36; drop one of the blockers"))
self.assertEqual(self.writes(), [])
def test_a_loop_the_plan_holds_without_the_issue_does_not_stop_its_edit(self):
self.open[1] = issue("ABC-35", scores=PROPERTY, blocked_by=("ABC-36",))
self.open[2] = issue("ABC-36", scores=PROPERTY, blocked_by=("ABC-35",))
self.assertEqual(self.edit(34, {"Blocked by": "35"}), Written(34))
self.assertEqual([method for method, _, _ in self.writes()], ["POST"])
def test_a_blocked_by_out_of_format_or_naming_the_issue_itself_fails_before_any_write(self):
for cell in ("ABC-35", "35,36", "34"):
with self.subTest(cell=cell):
@@ -677,7 +693,8 @@ class Editing(unittest.TestCase):
def test_the_links_of_an_issue_a_person_filed_are_never_changed(self):
for id_ in (35, 36):
self.assertEqual(self.edit(id_, {"Blocked by": "34"}, None, COMMENT), Failure(f"a person filed ABC-{id_}, so the loop sets only its scores: change its summary, description, links and Fix Version in Jira"))
with self.subTest(id_=id_):
self.assertEqual(self.edit(id_, {"Blocked by": "34"}, None, COMMENT), Failure(f"a person filed ABC-{id_}, so the loop sets only its scores: change its summary, description, links and Fix Version in Jira"))
self.assertEqual(self.writes(), [])
def test_an_issue_that_is_no_open_child_of_the_epic_is_not_edited(self):
+1 -1
View File
@@ -45,7 +45,7 @@ ranking fails or scores the item under the bar.
In a Jira epic, edit changes an issue the loop filed: its summary, description and scores, the label
`security` with --exempt, and its "is blocked by" links with --blocked-by: it makes a link for each
blocker added and deletes the link of each blocker dropped. Each blocker must be an open child of the
epic, and a link to any other issue stays.
epic that doesn't wait for the issue itself, directly or through others. A link to any other issue stays.
Of an issue a person filed it sets only the scores, --moves and --exempt, and only with --comment;
--blocked-by fails there, since its links are the team's.
The four scores are set together where the issue holds none yet.
+1 -1
View File
@@ -376,7 +376,7 @@ Messages keep each file's usual name, such as `todo.md`, as its label, since the
- **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 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. 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 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.
- **`todo-item edit --comment` carries the comment, and a plan in a file takes the flag and keeps no comment**, so one command works in every project, as goal 1.3 asks. A bench of readers picked the spelling: three fresh readers, seated as the consultant who runs the loop in a client's project, each picked `--comment` over `--reason`, `--why` and `--because`. Only it says the text is posted where the team reads it, and `--reason` read as `--exempt`'s reason.
- **The store finishes an item with the transition that the config's `jira-finish-transition` names**, which must lead to the status `jira-finish-status` names, since each Jira workflow differs (lilleman's call, 2026-11-12); any open child of the epic may move. It refuses a status outside Jira's done status category: the read counts an issue as finished only in that category, so the item would stay in the plan. Where the issue's present status has no direct transition to the status `jira-finish-status` names, `todo-item finish` fails and a person moves the issue in Jira: the store never walks an issue through other statuses to reach it. lilleman answered on 2026-11-15: "If it is possible to move it to done without a transisiont, that should happen. If not, fail." The implementer read "without a transition" as "without a transition in between". `rank_todo.py` refuses to rank a plan in Jira, and its `--check` passes, since Jira's backlog ranks it; rule-hook's rank check skips it. Each read first asks Jira for the epic itself, since a search under an epic the account cannot see answers no issues, as a finished plan does.