From ab081dd33fdccadbe12b02ecffd9be5344985a71 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Sun, 18 Oct 2026 10:37:48 +0200 Subject: [PATCH] =?UTF-8?q?Answer=20architecture=20round=201:=200=20?= =?UTF-8?q?=F0=9F=94=B4,=202=20=F0=9F=9F=A1;=20name=20the=20next=20release?= =?UTF-8?q?'s=20test,=20state=20both=20cases=20of=20the=20plan=20reader,?= =?UTF-8?q?=20keep=20one=20release=20formatter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/chunk_pick.py | 8 ++++---- bin/chunk_preflight/choices.py | 6 +----- bin/chunk_preflight/facts.py | 4 ++-- bin/loop_claude/loop/main.py | 2 +- bin/rank_todo.py | 4 ++-- bin/todo_table.py | 5 +++++ 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/bin/chunk_pick.py b/bin/chunk_pick.py index a7a67e0a..186c49b1 100644 --- a/bin/chunk_pick.py +++ b/bin/chunk_pick.py @@ -84,7 +84,7 @@ def chunk_item(found: list[Item], cut: LastCut) -> Pick: def standing(tag: str | None | Failure, changes: int | Failure, earliest: tuple[int, int, int] | None, named: set[tuple[int, int, int]] | Failure) -> tuple[Standing, tuple[int, int, int] | None]: - """How earliest, the plan's earliest release, None where the plan holds no item, stands to tag, the newest v* tag; and the next release, as Pick.release says. changes counts the changes since the tag, and named holds each release todo.md named since it.""" + """How earliest, the plan's earliest release, None where the plan holds no item, stands to tag, the newest v* tag; and the next release: earliest where it is next, else the earliest release todo.md named since the cut, None for cut and unknown. changes counts the changes since the tag, and named holds each release todo.md named since it.""" cut = re.fullmatch(r"v([0-9]+)\.([0-9]+)\.([0-9]+)", tag) if isinstance(tag, str) else None if cut is None: return "next", earliest @@ -93,12 +93,12 @@ def standing(tag: str | None | Failure, changes: int | Failure, earliest: tuple[ return "cut", None if isinstance(named, Failure): return "unknown", None - upcoming = min({release for release in named if release > version} | ({earliest} if earliest is not None else set()), default=None) - if earliest is not None and earliest == upcoming: + first_named = min((release for release in named if release > version), default=None) + if earliest is not None and (first_named is None or earliest <= first_named): return "next", earliest if isinstance(changes, Failure): return "unknown", None - return ("finished" if changes else "unplanned"), upcoming + return ("finished" if changes else "unplanned"), first_named def unreleased_changes(cut: LastCut) -> int | Failure: diff --git a/bin/chunk_preflight/choices.py b/bin/chunk_preflight/choices.py index f935105d..30e6c479 100644 --- a/bin/chunk_preflight/choices.py +++ b/bin/chunk_preflight/choices.py @@ -5,7 +5,7 @@ import re from chunk_pick import chunk_item, LastCut from failure import Failure from chunk_preflight.gathered import Forge, NoItem, Plan -from todo_table import item_details, items +from todo_table import item_details, items, version # The command each forge's CLI lists pull requests with; pulls_command adds the flags that pick their rows and fields. PULLS_LIST: dict[Forge, tuple[str, ...]] = {"gh": ("gh", "pr", "list"), "tea": ("tea", "pulls", "list")} @@ -40,10 +40,6 @@ def planned(todo: str | Failure, cut: LastCut, default: str) -> Plan | NoItem: return Plan(found, first, f"{first.tagline}\n\n{detail}".strip()) -def version(release: tuple[int, int, int]) -> str: - return ".".join(map(str, release)) - - def worktree_on(porcelain: str, branch: str) -> pathlib.Path | None: """The worktree on branch, in what `git worktree list --porcelain` printed; None where none is.""" for block in porcelain.split("\n\n"): diff --git a/bin/chunk_preflight/facts.py b/bin/chunk_preflight/facts.py index 11c0682d..39d8af65 100644 --- a/bin/chunk_preflight/facts.py +++ b/bin/chunk_preflight/facts.py @@ -1,9 +1,9 @@ """The lines the preflight prints, stated from what it gathered.""" -from todo_table import bundle_candidates, Item +from todo_table import bundle_candidates, Item, version from failure import Failure from chunk_preflight.gathered import Forge, Gathered, ItemFacts, NamedPath, NoItem, Plan, Ran from chunk_pick import LastCut, unreleased_entries -from chunk_preflight.choices import PULLS_LIST, version +from chunk_preflight.choices import PULLS_LIST from markdown_text import quoted diff --git a/bin/loop_claude/loop/main.py b/bin/loop_claude/loop/main.py index 4001f52d..d6e53fda 100644 --- a/bin/loop_claude/loop/main.py +++ b/bin/loop_claude/loop/main.py @@ -279,7 +279,7 @@ def archived_route(archive_folder: pathlib.Path, session: Session) -> Route | No def chunk_start(session: Session, preflight: pathlib.Path, root: str, effects: Effects) -> tuple[str, typing.Callable[[], Item | None]]: - """The facts for a fresh worker's prompt, empty where the session is open, and the reader of the item that routes the chunk. The preflight runs first, so the reader reads the default branch its fetch just left.""" + """The facts for a fresh worker's prompt, empty where the session is open, and the reader of the item that routes the chunk. The reader reads the default branch as last fetched: for a fresh chunk, by the preflight that runs first; for an open session, which runs none, by whatever fetched last.""" facts = "" if session_open(session) else chunk_facts(preflight, root, effects) return facts, lambda: plan_item(fetched_plan(root)) diff --git a/bin/rank_todo.py b/bin/rank_todo.py index 32a50158..02827ba6 100755 --- a/bin/rank_todo.py +++ b/bin/rank_todo.py @@ -81,7 +81,7 @@ import re import sys import typing -from todo_table import BLOCKED_BY, cells, DETAILS, HEADER_START, Item, item_details, items_table, MOVES, OLD_SHAPE, parse_row, renames, risk, Shape, SHAPE, shape_of, Table, table_rows +from todo_table import BLOCKED_BY, cells, DETAILS, HEADER_START, Item, item_details, items_table, MOVES, OLD_SHAPE, parse_row, renames, risk, Shape, SHAPE, shape_of, Table, table_rows, version from failure import Failure from markdown_text import listed, sections from file_writes import replace_file @@ -397,7 +397,7 @@ def place(id_: int, held: dict[int, tuple[Item, float]], position: dict[int, int def release_name(item: Item) -> str: - return ".".join(str(part) for part in item.release) + return version(item.release) def check_citations(items: list[Item], decisions: str) -> Failure | None: diff --git a/bin/todo_table.py b/bin/todo_table.py index 33acefcb..d87ec745 100644 --- a/bin/todo_table.py +++ b/bin/todo_table.py @@ -266,6 +266,11 @@ def release_of(version: str) -> tuple[int, int, int]: return major, minor, patch +def version(release: tuple[int, int, int]) -> str: + """The version a release names, such as 0.2.1: release_of's inverse.""" + return ".".join(map(str, release)) + + def check_cells(row: str, named: dict[str, str]) -> Failure | None: """Holds the row's ID, Release, Exempt and Item cells to the format: why one breaks it, None when none does.""" id_, release, exempt, tagline = named["ID"], named["Release"], named["Exempt"], named["Item"]