Answer architecture round 2: 0 🔴, 1 🟡; join prose lists with one markdown_text.listed, and floor the replays at lowest_worker_rung

This commit is contained in:
2026-10-16 12:18:03 +02:00
parent 12909f233d
commit f319a96e7e
11 changed files with 40 additions and 34 deletions
+5 -10
View File
@@ -78,7 +78,7 @@ import typing
from todo_table import BLOCKED_BY, cells, HEADER_START, Item, items_table, MOVES, OLD_SHAPE, parse_row, risk, Shape, SHAPE, shape_of, Table, table_rows
from failure import Failure
from markdown_text import FENCE, sections
from markdown_text import FENCE, listed, sections
from file_writes import replace_file
LARGEST_FORMULA = 200
@@ -293,9 +293,9 @@ def read_table(lines: list[str]) -> Table | Failure:
shape = shape_of(table.columns)
if missing := [column for column in shape.risk_columns if column not in table.columns]:
old = older_columns(table, shape)
dropped = f", and drop {joined(old)}" if old else ""
columns = f"{joined(missing)} column; add it" if len(missing) == 1 else f"{joined(missing)} columns; add them"
return Failure(f"todo.md's items table has no {columns}, scoring each item's {joined(list(shape.risk_columns))} as rank_todo.py --help shows{dropped}")
dropped = f", and drop {listed(old, 'and')}" if old else ""
columns = f"{listed(missing, 'and')} column; add it" if len(missing) == 1 else f"{listed(missing, 'and')} columns; add them"
return Failure(f"todo.md's items table has no {columns}, scoring each item's {listed(shape.risk_columns, 'and')} as rank_todo.py --help shows{dropped}")
return unknown_columns(table, shape) or outside_items(lines, table) or table
@@ -304,7 +304,7 @@ def unknown_columns(table: Table, shape: Shape) -> Failure | None:
unknown = [column for column in table.columns if column not in shape.columns]
if old := older_columns(table, shape):
kind = "a column of an older shape; drop it" if len(old) == 1 else "columns of an older shape; drop them"
return Failure(f"todo.md's items table has {joined(old)}, {kind}, as rank_todo.py --help shows")
return Failure(f"todo.md's items table has {listed(old, 'and')}, {kind}, as rank_todo.py --help shows")
if unknown:
return Failure(f"todo.md's items table has the column {', '.join(unknown)}, which this rank_todo.py does not know; the columns it knows are {', '.join(shape.columns)}. Rename it, or move this machine to the release that added it")
return None
@@ -315,11 +315,6 @@ def older_columns(table: Table, shape: Shape) -> list[str]:
return [column for column in table.columns if column not in SHAPE.columns and column in OLD_SHAPE.columns] if shape is SHAPE else []
def joined(names: list[str]) -> str:
"""The names as `a, b and c`."""
return names[0] if len(names) == 1 else f"{', '.join(names[:-1])} and {names[-1]}"
def read_items(table: Table, scoring: Scoring) -> list[Item] | Failure:
items = []
for row in table.rows: