Sort the imports and type the step that sets an issue's scores
CI / tests (pull_request) Successful in 3m39s

This commit is contained in:
Lilleman
2026-11-20 14:39:10 +01:00
parent 5f2a4b6385
commit 6c406b2609
3 changed files with 21 additions and 15 deletions
+18 -12
View File
@@ -15,10 +15,10 @@ from do_epic.backend.protocol import EpicIssue, EpicStore, no_scores
from do_epic.epic_record import EpicRecord
from failure import Failure
from record_store.stores import goals_store, store as record_store
from do_epic import issue_scores, ranking, repo_pick, repos, split
from plan.todo_table import Item
from claude_code.reply import Limited
from plan_store.jira_epic import number
from do_epic import issue_scores, ranking, repo_pick, repos, split
from model_routing.ladder_file import read_ladder, SHIPPED
from model_routing.ladder import Rung
from do_epic.scheduler import STATE
@@ -218,20 +218,26 @@ def scored(epic: Planned, issues: list[EpicIssue]) -> tuple[list[EpicIssue], Fai
answer = goals if isinstance(goals, Failure) else issue_scores.asked(issue, rule, goals, language or epic.config.language, rung, epic.effects.claude, str(folder))
if isinstance(answer, Limited):
return issues, answer
fields = answer if isinstance(answer, Failure) else no_scores(issue.key, answer.scores, answer.moves, {})
if not isinstance(answer, Failure) and not isinstance(fields, Failure):
held = dataclasses.replace(issue, scores=fields.scores, moves=fields.moves)
# The goals an answer names are checked before it is set, since a score that cannot be ranked would stay on the issue.
fields = ranking.ranked([ranking.EpicItem(item_of(held, {issue.key: number(issue.key)}, ()), repo)], weighed.formula, weighed.goals, weighed.repos)
fields = fields if isinstance(fields, Failure) else epic.store.set_scores(issue.key, answer.scores, answer.moves, answer.comment)
if fields is None:
issues = [held if each.key == issue.key else each for each in issues]
say(f"{issue.key} is scored {', '.join(f'{name} {value}' for name, value in answer.scores.items())}, Moves {answer.moves or 'none'}", epic.effects, stdout=True)
if isinstance(fields, Failure):
say(f"{issue.key} is not scored: {fields.reason}", epic.effects, stdout=True)
held = answer if isinstance(answer, Failure) else scores_set(epic, issue, answer, weighed)
if isinstance(held, Failure):
say(f"{issue.key} is not scored: {held.reason}", epic.effects, stdout=True)
continue
assert isinstance(answer, issue_scores.Scores)
issues = [held if each.key == issue.key else each for each in issues]
say(f"{issue.key} is scored {', '.join(f'{name} {value}' for name, value in held.scores.items())}, Moves {answer.moves or 'none'}", epic.effects, stdout=True)
return issues, None
def scores_set(epic: Planned, issue: EpicIssue, answer: issue_scores.Scores, weighed: Weighing) -> EpicIssue | Failure:
"""issue holding the scores of answer, once the tracker has set them and told the team. The answer is held to the plan's format and to the goals the issue may name first, since a score that cannot be ranked would stay on the issue."""
fields = no_scores(issue.key, answer.scores, answer.moves, {})
if isinstance(fields, Failure):
return fields
held = dataclasses.replace(issue, scores=fields.scores, moves=fields.moves)
ranked = ranking.ranked([ranking.EpicItem(item_of(held, {issue.key: number(issue.key)}, ()), repo_of(epic, issue))], weighed.formula, weighed.goals, weighed.repos)
return ranked if isinstance(ranked, Failure) else epic.store.set_scores(issue.key, answer.scores, answer.moves, answer.comment) or held
def scoring_rule(home: pathlib.Path) -> str | Failure:
"""The text every plan item is scored by, which says what L, E, I and S mean."""
try: