Answer architecture round 4: count a repeated round number, move larv-review's record commands to record.py, give the UTC stamp and the blockquote one home each, check the history's sample entry, and state why a split and a fall call more seats

This commit is contained in:
2026-10-09 15:01:29 +02:00
parent 8f02d11096
commit b2a277b642
21 changed files with 233 additions and 209 deletions
+29 -1
View File
@@ -1,5 +1,8 @@
import pathlib
from failure import Failure
from todo_table import Item
from larv_review.git import file_at, landed_since_release, top
from todo_table import Item, items, ITEMS_HEADER
def scoring_run_due(before: list[Item], after: list[Item], ships: list[int], landed: bool) -> list[str] | Failure:
@@ -24,3 +27,28 @@ def emptied(before: list[Item], after: list[Item], shipped: list[Item]) -> list[
named = {item.release for item in before + shipped}
left = {item.release for item in after if item.id not in {ship.id for ship in shipped}}
return sorted(named - left)
def plan_reasons(default: str, ids: list[int]) -> list[str] | Failure:
"""Why the plan calls a scoring run, from the default branch's todo.md and the checkout's."""
checkout = top()
if isinstance(checkout, Failure):
return checkout
before = file_at(default, "todo.md")
if isinstance(before, Failure):
return before
try:
after = pathlib.Path(checkout, "todo.md").read_text(encoding="utf-8")
except (OSError, UnicodeDecodeError) as failure:
return Failure(f"could not read todo.md: {failure}")
# While a chunk reshapes todo.md into one table, the default branch's todo.md has no items table.
planned = items(before) if ITEMS_HEADER in before.splitlines() else []
if isinstance(planned, Failure):
return Failure(f"{default}'s todo.md: {planned.reason}")
chunk = items(after)
if isinstance(chunk, Failure):
return Failure(f"the checkout's todo.md: {chunk.reason}")
landed = landed_since_release(default)
if isinstance(landed, Failure):
return landed
return scoring_run_due(planned, chunk, ids, landed)