Keep the history's writer beside its reader, read plan rows with rank_todo, and fetch only for commands that read the default branch

This commit is contained in:
2026-10-09 01:10:01 +02:00
parent 77fef49fce
commit 53ed5150be
8 changed files with 189 additions and 162 deletions
+10 -2
View File
@@ -375,6 +375,16 @@ def cells(row: str, count: int) -> list[str] | Failure:
def parse_item(row: str, weights: dict[str, float]) -> Item | Failure:
item = parse_row(row)
if isinstance(item, Failure):
return item
if unknown := [goal for goal in item.goals if goal not in weights]:
return Failure(f"item {item.id} cites goal {', '.join(unknown)}, which the goal weights do not list")
return item
def parse_row(row: str) -> Item | Failure:
"""An item row, every cell checked but the goals it cites."""
found = cells(row, 10)
if isinstance(found, Failure):
return found
@@ -393,8 +403,6 @@ def parse_item(row: str, weights: dict[str, float]) -> Item | Failure:
return Failure(f"item {id_}'s {name} {value!r} is not a whole number from 1 to 10")
scores[name] = int(value)
cited = tuple(goal.strip() for goal in goals.split(","))
if unknown := [goal for goal in cited if goal not in weights]:
return Failure(f"item {id_} cites goal {', '.join(unknown)}, which the goal weights do not list")
major, minor, patch = (int(part) for part in release.split("."))
return Item(int(id_), (major, minor, patch), exempt, tagline, scores, cited)