Answer stability round 1: 0 🔴, 5 🟡 (0 misread); order issues whose keys share a number, and test the goals that fail, a malformed held score and the scoring call's folder
CI / tests (pull_request) Successful in 5m10s

This commit is contained in:
Lilleman
2026-11-20 16:09:06 +01:00
parent abe7226baa
commit 27b6433f7d
6 changed files with 54 additions and 11 deletions
+5 -4
View File
@@ -251,17 +251,18 @@ def start_order(epic: Planned, issues: list[EpicIssue]) -> list[str] | Failure:
held = [issue for issue in chunk_issues(epic, issues) if not ranking.unscored(item_of(issue, {}, ()), issue.key)]
if len(held) < 2:
return [issue.key for issue in held]
numbers = {issue.key: number(issue.key) for issue in held}
# An issue's place in the tracker is its id in the ranking: keys of two Jira projects may share a number, and issues that score the same keep the tracker's order.
numbers = {issue.key: at for at, issue in enumerate(held, 1)}
keys = {id_: key for key, id_ in numbers.items()}
if clash := next(((key, keys[id_]) for key, id_ in numbers.items() if keys[id_] != key), None):
return Failure(f"{clash[0]} and {clash[1]} share a number in different Jira projects, so the issues of the epic {epic.key} cannot be put in order of score; move one of the two to the other's Jira project")
weighed = weighing(epic, held)
if isinstance(weighed, Failure):
return weighed
by_key = {issue.key: issue for issue in issues}
items = [ranking.EpicItem(item_of(issue, numbers, before(issue, by_key, issues)), repo_of(epic, issue)) for issue in held]
ranked = ranking.ranked(items, weighed.formula, weighed.goals, weighed.repos)
return ranked if isinstance(ranked, Failure) else [keys[item.id] for item, _ in ranked]
if isinstance(ranked, Failure):
return Failure(re.sub(r"\bitem (\d+)\b", lambda named: keys.get(int(named[1]), named[0]), ranked.reason))
return [keys[item.id] for item, _ in ranked]
def before(issue: EpicIssue, by_key: dict[str, EpicIssue], issues: list[EpicIssue]) -> tuple[str, ...]: