Answer architecture round 1: 0 🔴, 4 🟡 (0 misread); move the shared loop state out of loop_claude, split ranking and routing, give the reviewer rung one rule
CI / tests (pull_request) Successful in 2m14s

This commit is contained in:
2026-11-10 22:03:16 +01:00
parent 8a80d452f2
commit 70a1b95086
70 changed files with 748 additions and 625 deletions
+8 -13
View File
@@ -30,7 +30,7 @@ import typing
from todo_item.edits import added, finished, with_bullet
from release_plan.todo_table import BLOCKED_BY, MOVES
from failure import Failure
from release_plan import ranking
from release_plan import plan_file, ranking
# Each score flag, as --l or --L, and the column it fills.
LETTERS = ("L", "E", "I", "S")
@@ -70,7 +70,7 @@ def parser() -> argparse.ArgumentParser:
def add(args: argparse.Namespace, folder: pathlib.Path, stdin: typing.TextIO) -> str | Failure:
todo = folder / "todo.md"
texts = ranking.read_all(todo)
texts = plan_file.read_all(todo)
if isinstance(texts, Failure):
return texts
named = {"Release": args.release, BLOCKED_BY: args.blocked_by, "Exempt": args.exempt, "Item": args.tagline, MOVES: args.moves}
@@ -84,9 +84,9 @@ def add(args: argparse.Namespace, folder: pathlib.Path, stdin: typing.TextIO) ->
return Failure(f"not filed: {ranked.reason}")
if under := [line for line in ranked.under_bar if line.startswith(f"item {id_} ")]:
return Failure(f"not filed: {under[0]}")
if unwritten := ranking.write(todo, ranked.text):
if unwritten := plan_file.write(todo, ranked.text):
return unwritten
report(todo, ranked)
plan_file.print_report(todo, ranked)
return f"Filed item {id_}."
@@ -96,11 +96,11 @@ def finish(args: argparse.Namespace, folder: pathlib.Path) -> str | Failure:
if isinstance(texts, Failure):
return Failure(f"not finished: {texts.reason}")
ranked, news = texts
if unwritten := ranking.write(todo, ranked.text):
if unwritten := plan_file.write(todo, ranked.text):
return Failure(f"not finished: {unwritten.reason}")
if news is not None and (unwritten := ranking.write(changelog, news)):
if news is not None and (unwritten := plan_file.write(changelog, news)):
return Failure(f"{unwritten.reason}; todo.md no longer holds item {args.id}, so add its bullet by hand")
report(todo, ranked)
plan_file.print_report(todo, ranked)
return f"Finished item {args.id}."
@@ -108,7 +108,7 @@ def finish_texts(args: argparse.Namespace, todo: pathlib.Path, changelog: pathli
"""What finish writes: todo ranked without item args.id, and changelog's new text, None where finish leaves it as is."""
if changelog.exists() and args.changelog is None and not args.no_changelog:
return Failure("CHANGELOG.md exists beside todo.md; pass --changelog <bullet>, or --no-changelog where the repo publishes nothing")
texts = ranking.read_all(todo)
texts = plan_file.read_all(todo)
if isinstance(texts, Failure):
return texts
text = finished(texts[0], args.id)
@@ -127,8 +127,3 @@ def finish_texts(args: argparse.Namespace, todo: pathlib.Path, changelog: pathli
return Failure(f"{changelog}: not UTF-8")
return news if isinstance(news, Failure) else (ranked, news)
def report(todo: pathlib.Path, ranked: ranking.Ranked) -> None:
"""Print ranking's notes and under-bar lines on stderr, each prefixed with todo.md's path, as rank_todo.py does."""
for line in ranked.notes + ranked.under_bar:
print(f"{todo}: {line}", file=sys.stderr)