Answer architecture round 1: 0 🔴, 2 🟡; name the next release's test, state both cases of the plan reader, keep one release formatter
This commit is contained in:
+4
-4
@@ -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:
|
||||
|
||||
@@ -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"):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
+2
-2
@@ -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:
|
||||
|
||||
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user