Answer architecture round 1: 0 🔴, 8 🟡; read old routes' rungs, write R in rank_todo, route reviews through review_rungs, file item 168

This commit is contained in:
2026-10-16 12:11:25 +02:00
parent 149108e8d8
commit 12909f233d
20 changed files with 141 additions and 94 deletions
+5 -5
View File
@@ -27,6 +27,8 @@ class Shape:
score_columns: tuple[str, ...]
# The columns a reader does without: a missing BLOCKED_BY reads as blocked by nothing, a missing score as no score, and a missing Score as no score yet.
optional: tuple[str, ...]
# The columns rank_todo.py needs to rank a row, so no chunk starts on an item whose risk is unscored.
risk_columns: tuple[str, ...]
# The column naming the goals an item serves; read_goals reads it, given the item's ID to name in a failure, and write_goals writes it back.
goals_column: str
read_goals: typing.Callable[[str, str], Moves | Failure]
@@ -70,10 +72,10 @@ def write_cited(moves: Moves) -> str:
return ", ".join(goal for goal, _ in moves)
# L, E and I are optional, since score_outcomes reads tables from before they replaced C out of history; R too, since parse_row works it out from them.
SHAPE = Shape(("L", "E", "I", "R", "S"), (BLOCKED_BY, "L", "E", "I", "R", "Score"), MOVES, parse_moves, write_moves)
# L, E and I are optional, since score_outcomes reads tables from before they replaced C out of history; R too, since rank_todo.py writes it from them.
SHAPE = Shape(("L", "E", "I", "R", "S"), (BLOCKED_BY, "L", "E", "I", "R", "Score"), ("L", "E", "I"), MOVES, parse_moves, write_moves)
# The shape from before MOVES replaced A, G and Goals, and L, E and I replaced C, which older todo.md files hold; one from before C joined lacks it.
OLD_SHAPE = Shape(("R", "S", "C", "A", "G"), (BLOCKED_BY, "C", "Score"), "Goals", parse_cited, write_cited)
OLD_SHAPE = Shape(("R", "S", "C", "A", "G"), (BLOCKED_BY, "C", "Score"), ("C",), "Goals", parse_cited, write_cited)
@dataclasses.dataclass(frozen=True)
@@ -189,8 +191,6 @@ def parse_row(row: str, table: Table) -> Item | Failure:
scores = parse_scores(named["ID"], named, shape.score_columns)
if isinstance(scores, Failure):
return scores
if {"L", "E", "I"} <= scores.keys():
scores["R"] = risk(scores["L"], scores["E"], scores["I"])
blocked_by = parse_blockers(named["ID"], named.get(BLOCKED_BY, ""))
if isinstance(blocked_by, Failure):
return blocked_by