Sort the imports and type the step that sets an issue's scores
CI / tests (pull_request) Successful in 3m39s
CI / tests (pull_request) Successful in 3m39s
This commit is contained in:
@@ -5,12 +5,12 @@ import typing
|
|||||||
|
|
||||||
from adf_codec.convert import adfs_to_markdown, markdown_to_adf, Refused
|
from adf_codec.convert import adfs_to_markdown, markdown_to_adf, Refused
|
||||||
from atlassian.client import basic_auth, Http, jira_json, ToAdf, ToMarkdown
|
from atlassian.client import basic_auth, Http, jira_json, ToAdf, ToMarkdown
|
||||||
from plan_store.jira_epic import BLOCKS, FILED_BY, PROPERTY, scores as held_scores
|
from plan_store.jira_epic import BLOCKS, FILED_BY, scores as held_scores, PROPERTY
|
||||||
from project_config.settings import DEFAULT_ISSUE_TYPE, Epic, Finish, JIRA_FINDING_TYPE, JIRA_FINISH_STATUS, JIRA_FINISH_TRANSITION, JIRA_REVIEW_TYPE
|
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 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_scores, no_words, unfit, unfit_label
|
from do_epic.backend.protocol import EpicIssue, no_blocker, no_child, no_parent, no_scores, no_words, unfit, unfit_label
|
||||||
from plan.todo_table import MOVES
|
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
|
from plan.todo_table import MOVES
|
||||||
from do_epic.repo_pick import REVIEW_LABEL
|
from do_epic.repo_pick import REVIEW_LABEL
|
||||||
|
|
||||||
FIELDS = ["summary", "description", "labels", "assignee", "status", "parent", "issuelinks"]
|
FIELDS = ["summary", "description", "labels", "assignee", "status", "parent", "issuelinks"]
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ A headless claude call with a JSON schema, as repo_pick makes, reads the rule ev
|
|||||||
import dataclasses
|
import dataclasses
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from claude_code.entries import structured_output
|
|
||||||
from claude_code.reply import Claude, claude_reply, Limited
|
from claude_code.reply import Claude, claude_reply, Limited
|
||||||
from do_epic.backend.protocol import EpicIssue
|
from do_epic.backend.protocol import EpicIssue
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from model_routing.ladder import Rung
|
from model_routing.ladder import Rung
|
||||||
from plan_store.jira_epic import SET_SCORES
|
from plan_store.jira_epic import SET_SCORES
|
||||||
|
from claude_code.entries import structured_output
|
||||||
|
|
||||||
SCHEMA = {
|
SCHEMA = {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
|||||||
+18
-12
@@ -15,10 +15,10 @@ from do_epic.backend.protocol import EpicIssue, EpicStore, no_scores
|
|||||||
from do_epic.epic_record import EpicRecord
|
from do_epic.epic_record import EpicRecord
|
||||||
from failure import Failure
|
from failure import Failure
|
||||||
from record_store.stores import goals_store, store as record_store
|
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 plan.todo_table import Item
|
||||||
from claude_code.reply import Limited
|
from claude_code.reply import Limited
|
||||||
from plan_store.jira_epic import number
|
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_file import read_ladder, SHIPPED
|
||||||
from model_routing.ladder import Rung
|
from model_routing.ladder import Rung
|
||||||
from do_epic.scheduler import STATE
|
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))
|
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):
|
if isinstance(answer, Limited):
|
||||||
return issues, answer
|
return issues, answer
|
||||||
fields = answer if isinstance(answer, Failure) else no_scores(issue.key, answer.scores, answer.moves, {})
|
held = answer if isinstance(answer, Failure) else scores_set(epic, issue, answer, weighed)
|
||||||
if not isinstance(answer, Failure) and not isinstance(fields, Failure):
|
if isinstance(held, Failure):
|
||||||
held = dataclasses.replace(issue, scores=fields.scores, moves=fields.moves)
|
say(f"{issue.key} is not scored: {held.reason}", epic.effects, stdout=True)
|
||||||
# The goals an answer names are checked before it is set, since a score that cannot be ranked would stay on the issue.
|
continue
|
||||||
fields = ranking.ranked([ranking.EpicItem(item_of(held, {issue.key: number(issue.key)}, ()), repo)], weighed.formula, weighed.goals, weighed.repos)
|
assert isinstance(answer, issue_scores.Scores)
|
||||||
fields = fields if isinstance(fields, Failure) else epic.store.set_scores(issue.key, answer.scores, answer.moves, answer.comment)
|
issues = [held if each.key == issue.key else each for each in issues]
|
||||||
if fields is None:
|
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)
|
||||||
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)
|
|
||||||
return issues, None
|
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:
|
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."""
|
"""The text every plan item is scored by, which says what L, E, I and S mean."""
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user